#!/usr/bin/perl -w # Munin Cisco CPU fetcher # Espen Holm Nilsen (http://www.gho.no/) 20081021 # Making the community the file name sounded like a bad idea # So if you have a lot of communities, this can be a real pain, I am sorry! # To install, just put this script in /usr/share/munin/plugins # chmod +x /usr/share/munin/plugins/cisco_cpu_ # ln -s /usr/share/munin/plugins/cisco_cpu_ /etc/munin/plugins/cisco_cpu_10.0.0.1 my $community = "public"; if ($ARGV[0] and $ARGV[0] =~ /^\s*autoconf\s*$/i) { print "yes\n"; exit 0; } $0 =~ /cisco_cpu_(.+)*$/; unless ($name = $1) { exit 2; } if ($ARGV[0] and $ARGV[0] =~ /^\s*config\s*$/i) { if(int($name)) { print "graph_title CPU Usage for $name\n"; } else { print "graph_title $name CPU usage\n"; } print "graph_args --base 1000 -l 0\n"; print "graph_vlabel Percent\n"; print "graph_category Cisco CPU\n"; print "cpu.label CPU Usage\n"; exit 0; } $cpupercentage = `/usr/bin/snmpget -v1 -c $community $name 1.3.6.1.4.1.9.2.1.56.0`; chomp($cpupercentage); $cpupercentage =~ s/SNMPv2-SMI::enterprises.9.2.1.56.0\s=\sINTEGER:\s//g; print "cpu.value $cpupercentage\n";