1

The organization that I'm working with now uses Munin as monitoring tool. We've written a service that streams realtime data about the service that can be displayed by a Javascript component. Preferably the operations team would like to show these metrics in Munin to avoid having another system for realtime monitoring.

  1. Is it possible and feasible to use Munin for displaying realtime data using Javascript? Preferably I'd like to create this as a plugin but we're fine with modifying some Munin HTML page or similar as well and just add the Javascript component to the page.
  2. Specifying alerts/alamars when certain properties of the streams go above a certain threshold would be nice as well. Given that (1) is feasible then one idea to integrate this would be to write an external app that reads the realtime stream and identifies when an alert should be triggered. When a error is detected the external app could write this to a file on disk. The idea is then to write a Munin plugin that reads from this file and trigger alters/alarms from within Munin if applicable.
Johan
  • 37,479
  • 32
  • 149
  • 237

2 Answers2

2
  1. Munin "polls" machines for data every five minutes. In order to provice your streaming data points to the central munin server, you need to configure a munin node on the server which streams data, and write a shell script (probably involving curl and awk) to fetch the current data.

    Creating a munin plugin on a node is really simple, it's just a shell script which outputs it's data in readable form to standard out.

  2. Setting alarms is easy, for the values you return you need to set warn and critical values in the munin plugin config output. Please keep in mind that these warnings are also on a 5 minute schedule so it's not "immediate".

Read up on how munin works at http://guide.munin-monitoring.org/en/latest/

Example of a simple munin plugin (stripped version of the system load plugin):

#!/bin/sh
. $MUNIN_LIBDIR/plugins/plugin.sh

if [ "$1" = "autoconf" ]; then
        echo yes
        exit 0
fi

if [ "$1" = "config" ]; then

        echo 'graph_title Load average'
        echo 'graph_args --base 1000 -l 0'
        echo 'graph_vlabel load'
        echo 'graph_scale no'
        echo 'graph_category system'
        echo 'load.label load'
        print_warning load
        print_critical load
        echo 'graph_info The load average of the machine describes how many processes are in the run-queue (scheduled to run "immediately").'
        echo 'load.info 5 minute load average'
        exit 0
fi

echo -n "load.value "
cut -f2 -d' ' < /proc/loadavg
Community
  • 1
  • 1
Rolf
  • 7,098
  • 5
  • 38
  • 55
0

Save your data which you want to make a chart for in the database. Write another code to make a chart from that and simply update your chart with ajax request. the php code which make chart use gd library or you can do it by svg xml output which i suggest it more. And as long as time goes get the result of script by just requesting it in ajax. Thats i just know

scripter
  • 132
  • 8