Munin (contrib)
Last change
Graph Categories
Python (2.x)


Sadly there is no documentation for this plugin.

#!/usr/bin/env python
"""Thomas R. N. Jansson (

# The SNMP traps for the NetApp filer can be found in
# /net/netappfiler/vol0/etc/mib/traps.dat if the filer is
# NFS automounted mounted on server.
# Example: the SNMP id for cpuBusyTimePerCent is
# snmp.
# and retrieval of this value is done by
# snmpget -v 1 -c public netappfiler
# Requires snmpget and assumes public community.

import commands
import sys

# Provided a servername and a snmpid it returns the value stripped of bogus information.
def snmpget(iservername,isnmpid):
    runcmd = 'snmpget -v 1 -c public ' + iservername + ' ' + isnmpid
    output = commands.getoutput(runcmd)
    return output.split()[3]

snmpid      = ""
warning     = 80
critical    = 95
servername  = sys.argv[0].split('_')[1]

if len(sys.argv) == 2 and sys.argv[1]  == "config":
    print 'graph_title CPU usage on', servername
    print 'graph_args --base 1000 -r --lower-limit 0 --upper-limit 100'
    print 'graph_vlabel %'
    print 'graph_scale no'
    print 'graph_info This graph shows how CPU time is spent.'
    print 'graph_period second'
    print 'graph_category cpu'

    print 'usage.label cpu_usage '
    print 'usage.draw STACK'
    print 'usage.warning ', warning
    print 'usage.critical ', critical
    print ' CPU time spent by normal programs and daemons'

# Gathers info from the servers and gathers data
print 'usage.value '+snmpget(servername,snmpid)