Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 728a729,751
- > def paint_grafana_graph(host, service = "Check MK"):
- > import ConfigParser as conf
- > host_clean = host.replace('.', '_')
- > svc_clean = service.replace(' ', '')
- > config = conf.ConfigParser()
- > config.read('/etc/check_mk/influxdb.config')
- > section = 'GrafanaSettings'
- > url = config.get(section, 'url')
- > if svc_clean.lower() in config.options(section):
- > url += config.get(section, svc_clean.lower())
- > else:
- > url += config.get(section, 'default')
- > url += "&var-host=%s&var-service=%s" % (host_clean, svc_clean)
- > return "grafanagraph", '<iframe src="%s" width="900" height="400" frameborder="0"></iframe>' % url
- >
- > multisite_painters["svc_grafanagraph"] = {
- > "title" : _("Grafana service graph"),
- > "short" : _("Grafana graph"),
- > "columns" : [ "host_name", "service_description" ],
- > "paint" : lambda row: paint_grafana_graph(row["host_name"], row["service_description"]),
- > }
- >
- >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement