wiki:Tags

Tags in munin

This is a page exploring the possible use of "tags" within munin.

Tags will add searchable metadata, to be used by a web interface for munin.

Today, the main web inteface will group graphs on:

  • "group" in the fqn, which by default is the "domain"
  • "host",
  • "category" for the plugin.
  • "problems", which are plugins outside the "warning" or "critical" thresholds.

This reflects how the graphs are stored in the file system, hierarchically.

Today, munin 2.1 stores metadata in form easy to query with SQL. That means we can add metadata to enable selection of graphs based on more complex queries.

Example

Node definition

/etc/munin/munin.conf.d/nodes_acme.example.com.conf

[mail.example.com]
address 2001:db8::1
tags    shared infrastructure, mailserver, client:acme, client:foo, client:bar

[cache.example.com]
address 2001:db8::2
tags    shared infrastructure, client:acme, client:foo, client:bar

[web.acme.example.com]
address 2001:db8:1::1
tags    client:acme, webserver

[appserver.acme.example.com]
address 2001:db8:2::1
tags    client:acme, appserver

Plugin

output of "config" for a set of plugins:

/etc/munin/plugins/one @ web.acme.example.com:

graph_title some plugin
graph_tags web application usage, dashboard

/etc/munin/plugins/two @ web.acme.example.com:

graph_title some other plugin
graph_tags  application load, dashboard

/etc/munin/plugins/three @ cache.example.com:

graph_title yet another plugin
graph_tags  errors, problem indicator

/etc/munin/plugins/four @ mailX:

graph_title yet another plugin
graph_tags  debugging

Web query

For a customer dashboard, the web interface selects page with a selection of graphs for the "client:acme" nodes, and the "server load" and "problem indicator" graphs.

API query

Example query against a hypothetical not-yet-implemented munin api:

"curl -X GET-H "Accept: application/json" \
   https://munin.example.com/api/v1/graphs?tags=client:acme,dashboard

returns:

[
  { "name" : "one",
    "description" : "some plugin",
    "tags" : [ "client:acme", "webserver", "web application usage", "dashboard" ],
    "urls"   : {
      "month" : "https://munin.example.com/munin-cgi-graph/acme.example.com/web.acme.example.com/one-month.png",
      "week"  : "https://munin.example.com/munin-cgi-graph/acme.example.com/web.acme.example.com/one-week.png",
      "day"   : "https://munin.example.com/munin-cgi-graph/acme.example.com/web.acme.example.com/one-day.png"
    }
  },
  { "name" : "two",
    "description" : "some other plugin",
    "tags" : [ "client:acme", "webserver", "application load", "dashboard" ],
    "urls"   : {
      "month" : "https://munin.example.com/munin-cgi-graph/acme.example.com/web.acme.example.com/two-month.png",
      "week"  : "https://munin.example.com/munin-cgi-graph/acme.example.com/web.acme.example.com/two-week.png",
      "day"   : "https://munin.example.com/munin-cgi-graph/acme.example.com/web.acme.example.com/two-day.png"
    }
  },
  { "name" : "three",
    "description" : "yet another plugin",
    "tags" : [ "client:acme", "webserver", "errors", "problem indicator", "dashboard" ],
    "urls"   : {
      "month" : "https://munin.example.com/munin-cgi-graph/example.com/cache.example.com/three-month.png",
      "week"  : "https://munin.example.com/munin-cgi-graph/example.com/cache.example.com/three-week.png",
      "day"   : "https://munin.example.com/munin-cgi-graph/example.com/cache.example.com/three-day.png"
    }
  }
]

(and so on)

Example search for "application load" and "shared infrastructure":

"curl -X GET-H "Accept: application/json" \
   https://munin.example.com/api/v1/graphs?tags=client:shared%20infrastructure,problem%20indicator

Multiple parameters query

A quick grammar could be like the one proposed on IRC:

  <@TheSnide> so search for { this is very +important +"munin monitoring" } meant "search every element that have at least one of "this", "is" or "very" and all of
"important" & "munin monitoring"
  <@TheSnide> https://munin.example.com/api/v1/graphs?tags=this+is+very+%2Bimportant+%2B%22munin+monitoring%22
  <@TheSnide> the resulting SQL was quite easy to generate.
  <@TheSnide> WHERE tags CONTAINS 'important' AND tags CONTAINS 'munin monitoring' AND (tags CONTAINS 'this' OR tags CONTAINS 'is' OR tags CONTAINS 'very')
  <@TheSnide> (the CONTAINS with SQLite is left as an exercise to the reader)

It would be quite easy to parse, and already powerful.

Last modified at 2014-10-06T18:48:32+02:00 Last modified on 2014-10-06T18:48:32+02:00