mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-24 09:57:09 +00:00
Put order in SNMP plugins by moving all of them together in snmp/
This makes it easier to find what should be used for SNMP monitoring.
This commit is contained in:
parent
2fc9c2400b
commit
7da1b039c2
45 changed files with 0 additions and 0 deletions
63
plugins/snmp/snmp___bri_se_
Executable file
63
plugins/snmp/snmp___bri_se_
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Munin plugin snmp__bri_se_
|
||||
#
|
||||
# Version: 0.2, released on 30/02/2009, tested on Debian GNU/Linux 4.0 (etch)
|
||||
# using Cisco 5350 gateways.
|
||||
#
|
||||
# This plugin reports the number of BRI channels currently in use on SE/foo
|
||||
# using SNMP community bar.
|
||||
#
|
||||
# Requirements: bash, snmpget, rev, cut, which
|
||||
#
|
||||
# Copyright (c) 2009 by Kees Meijs <kees@kumina.nl> for Kumina bv.
|
||||
#
|
||||
# This work is licensed under the Creative Commons Attribution-Share Alike 3.0
|
||||
# Unported license. In short: you are free to share and to make derivatives of
|
||||
# this work under the conditions that you appropriately attribute it, and that
|
||||
# you only distribute it under the same, similar or a compatible license. Any
|
||||
# of the above conditions can be waived if you get permission from the copyright
|
||||
# holder.
|
||||
|
||||
# HOW TO?
|
||||
#
|
||||
# Symlink snmp___bri_se_ to /etc/munin/plugins/snmp_HOSTNAME_COMMUNITY_bri_se_SEOFGATEWAY
|
||||
# For example: snmp_1.2.3.4_public_bri_se_3 to check community "public" on host "1.2.3.4"
|
||||
# using SE #3.
|
||||
|
||||
# More strict checking
|
||||
set -e
|
||||
|
||||
# Check for snmpget
|
||||
SNMPGET=$(which snmpget)
|
||||
|
||||
# Catch command line arguments
|
||||
JOB=$1
|
||||
|
||||
# Set variables
|
||||
HOSTNAME=$(echo $0 | rev | cut -d '_' -f 5 | rev)
|
||||
COMMUNITY=$(echo $0 | rev | cut -d '_' -f 4 | rev)
|
||||
SE=$(echo $0 | rev | cut -d '_' -f 1 | rev)
|
||||
|
||||
# Configure Munin
|
||||
case "$1" in
|
||||
"config")
|
||||
echo "host_name $HOSTNAME"
|
||||
echo "graph_title BRI usage on SE-$SE"
|
||||
echo "graph_vlabel Number of used BRI channels"
|
||||
echo "graph_scale no"
|
||||
echo "graph_category network"
|
||||
for CHANNEL in $(seq 0 7); do
|
||||
echo "chan_$CHANNEL.label SE-$SE/$CHANNEL used channels"
|
||||
done
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
# Return fetched SNMP values
|
||||
for CHANNEL in $(seq 0 7); do
|
||||
echo -n "chan_$CHANNEL.value "
|
||||
$SNMPGET -v 1 -c $COMMUNITY $HOSTNAME 1.3.6.1.4.1.9.10.19.1.1.9.1.3.$SE.$CHANNEL | rev | cut -d ' ' -f 1 | rev
|
||||
done
|
||||
|
||||
# Exit cleanly
|
||||
exit 0
|
292
plugins/snmp/snmp__areca_
Executable file
292
plugins/snmp/snmp__areca_
Executable file
|
@ -0,0 +1,292 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2009 - 2012 Andreas Thienemann <andreas@bawue.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Library General Public License as published by
|
||||
# the Free Software Foundation; version 2 only
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
"""
|
||||
=head1 NAME
|
||||
|
||||
snmp__areca_ - Munin plugin to get temperature, voltage or fan speed values
|
||||
from Areca network enabled RAID controllers via SNMP.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
All machines with a SNMP capable ARECA raid controller.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
Make sure your Areca controller is accessible via SNMP from the munin host:
|
||||
snmpwalk -v 1 -c snmp_community ip.add.re.ss
|
||||
|
||||
The plugin is a wildcard plugin and can thus be used to retrieve different
|
||||
values depending on the name of the file.
|
||||
|
||||
Linking it as snmp_10.8.1.230_areca_fan would retrieve the fan speed values from
|
||||
the Areca controller at 10.8.1.230.
|
||||
|
||||
Valid values are fan, temp and volt.
|
||||
|
||||
Add the following to your /etc/munin/plugin-conf.d/snmp__areca file:
|
||||
|
||||
[snmp_ip.add.re.ss_*]
|
||||
community private
|
||||
version 1
|
||||
|
||||
Then test the plugin by calling the following commands:
|
||||
|
||||
munin-run snmp_10.8.1.230_areca_temp config
|
||||
munin-run snmp_10.8.1.230_areca_temp
|
||||
|
||||
Both commands should output sensible data without failing.
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin shows the temperature in Celsius or the fanspeed in rotations per minute.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
0.0.1
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None known. If you know of any, please raise a ticket at https://trac.bawue.org/munin/wiki/areca__snmp_
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
"""
|
||||
|
||||
import pprint
|
||||
import time
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
from pysnmp import v1, v2c, role, asn1
|
||||
|
||||
request_conf = {
|
||||
"volt" : {
|
||||
"label" : "Voltages",
|
||||
"vlabel" : "Volt",
|
||||
"graph" : "--base 1000 --logarithmic",
|
||||
"oid" : ".1.3.6.1.4.1.18928.1.2.2.1.8"
|
||||
},
|
||||
"fan" : {
|
||||
"label" : "Fans",
|
||||
"vlabel" : "RPM",
|
||||
"graph" : "--base 1000 -l 0",
|
||||
"oid" : ".1.3.6.1.4.1.18928.1.2.2.1.9"
|
||||
},
|
||||
"temp" : {
|
||||
"label" : "Temperatures",
|
||||
"vlabel" : "Celsius",
|
||||
"graph" : "--base 1000 -l 0",
|
||||
"oid" : ".1.3.6.1.4.1.18928.1.2.2.1.10"
|
||||
}
|
||||
}
|
||||
|
||||
# Sanity check and parsing of the commandline
|
||||
host = None
|
||||
port = 161
|
||||
request = None
|
||||
try:
|
||||
match = re.search("^(?:|.*\/)snmp_([^_]+)_areca_(.+)$", sys.argv[0])
|
||||
host = match.group(1)
|
||||
request = match.group(2)
|
||||
match = re.search("^([^:]+):(\d+)$", host)
|
||||
if match is not None:
|
||||
host = match.group(1)
|
||||
port = match.group(2)
|
||||
except:
|
||||
pass
|
||||
|
||||
if host is None or request is None:
|
||||
print "# Error: Incorrect filename. Cannot parse host or request."
|
||||
sys.exit(1)
|
||||
|
||||
# Parse env variables
|
||||
if os.getenv("community") is not None:
|
||||
community = os.getenv("community")
|
||||
else:
|
||||
community = "public"
|
||||
if os.getenv("version") is not None:
|
||||
version = os.getenv("version")
|
||||
else:
|
||||
version = "1"
|
||||
|
||||
|
||||
def get_data():
|
||||
# Fetch the data
|
||||
results = snmpwalk(request_conf[request]["oid"])
|
||||
|
||||
# parse data
|
||||
vals = []
|
||||
for i in range(0, len(results)):
|
||||
idx, res = results[i][0].split(request_conf[request]["oid"])[1].split(".")[1:], results[i][1]
|
||||
if idx[1] == '1':
|
||||
vals.append([])
|
||||
vals[int(idx[2])-1].append(res)
|
||||
if idx[1] == '2':
|
||||
vals[int(idx[2])-1].append(res)
|
||||
if idx[1] == '3':
|
||||
if request == "volt":
|
||||
res = float(res)/1000
|
||||
vals[int(idx[2])-1].append(res)
|
||||
|
||||
return vals
|
||||
|
||||
def snmpwalk(root):
|
||||
|
||||
# Create SNMP manager object
|
||||
client = role.manager((host, port))
|
||||
|
||||
# Create a SNMP request&response objects from protocol version
|
||||
# specific module.
|
||||
try:
|
||||
req = eval('v' + version).GETREQUEST()
|
||||
nextReq = eval('v' + version).GETNEXTREQUEST()
|
||||
rsp = eval('v' + version).GETRESPONSE()
|
||||
|
||||
except (NameError, AttributeError):
|
||||
print '# Unsupported SNMP protocol version: %s\n%s' % (version, usage)
|
||||
sys.exit(-1)
|
||||
|
||||
# Store tables headers
|
||||
head_oids = [root]
|
||||
|
||||
encoded_oids = map(asn1.OBJECTID().encode, head_oids)
|
||||
|
||||
result = [];
|
||||
|
||||
while 1:
|
||||
|
||||
# Encode OIDs, encode SNMP request message and try to send
|
||||
# it to SNMP agent and receive a response
|
||||
(answer, src) = client.send_and_receive(req.encode(community=community, encoded_oids=encoded_oids))
|
||||
|
||||
# Decode SNMP response
|
||||
rsp.decode(answer)
|
||||
|
||||
# Make sure response matches request (request IDs, communities, etc)
|
||||
if req != rsp:
|
||||
raise 'Unmatched response: %s vs %s' % (str(req), str(rsp))
|
||||
|
||||
# Decode BER encoded Object IDs.
|
||||
oids = map(lambda x: x[0], map(asn1.OBJECTID().decode, rsp['encoded_oids']))
|
||||
|
||||
# Decode BER encoded values associated with Object IDs.
|
||||
vals = map(lambda x: x[0](), map(asn1.decode, rsp['encoded_vals']))
|
||||
|
||||
# Check for remote SNMP agent failure
|
||||
if rsp['error_status']:
|
||||
# SNMP agent reports 'no such name' when walk is over
|
||||
if rsp['error_status'] == 2:
|
||||
# Switch over to GETNEXT req on error
|
||||
# XXX what if one of multiple vars fails?
|
||||
if not (req is nextReq):
|
||||
req = nextReq
|
||||
continue
|
||||
# One of the tables exceeded
|
||||
for l in oids, vals, head_oids:
|
||||
del l[rsp['error_index']-1]
|
||||
else:
|
||||
raise 'SNMP error #' + str(rsp['error_status']) + ' for OID #' + str(rsp['error_index'])
|
||||
|
||||
# Exclude completed OIDs
|
||||
while 1:
|
||||
for idx in range(len(head_oids)):
|
||||
if not asn1.OBJECTID(head_oids[idx]).isaprefix(oids[idx]):
|
||||
# One of the tables exceeded
|
||||
for l in oids, vals, head_oids:
|
||||
del l[idx]
|
||||
break
|
||||
else:
|
||||
break
|
||||
|
||||
if not head_oids:
|
||||
return result
|
||||
|
||||
# Print out results
|
||||
for (oid, val) in map(None, oids, vals):
|
||||
result.append((oid, str(val)))
|
||||
# print oid + ' ---> ' + str(val)
|
||||
|
||||
# BER encode next SNMP Object IDs to query
|
||||
encoded_oids = map(asn1.OBJECTID().encode, oids)
|
||||
|
||||
# Update request object
|
||||
req['request_id'] = req['request_id'] + 1
|
||||
|
||||
# Switch over GETNEXT PDU for if not done
|
||||
if not (req is nextReq):
|
||||
req = nextReq
|
||||
|
||||
raise "error"
|
||||
|
||||
|
||||
def print_config():
|
||||
print "graph_title " + request_conf[request]["label"]
|
||||
print "graph_vlabel " + request_conf[request]["vlabel"]
|
||||
print "graph_args " + request_conf[request]["graph"]
|
||||
print "graph_category sensors"
|
||||
print "host_name", host
|
||||
for dataset in get_data():
|
||||
if request == "volt":
|
||||
if dataset[1] == "Battery Status":
|
||||
continue
|
||||
else:
|
||||
print request + dataset[0] + ".label", dataset[1]
|
||||
ref_val = float(dataset[1].split()[-1][:-1])
|
||||
print request + dataset[0] + ".warning", str(ref_val * 0.95) + ":" + str(ref_val * 1.05)
|
||||
print request + dataset[0] + ".critical", str(ref_val * 0.80) + ":" + str(ref_val * 1.20)
|
||||
if request == "temp":
|
||||
print request + dataset[0] + ".label", dataset[1]
|
||||
if dataset[1].startswith("CPU"):
|
||||
print request + dataset[0] + ".warning", 55
|
||||
print request + dataset[0] + ".critical", 60
|
||||
if dataset[1].startswith("System"):
|
||||
print request + dataset[0] + ".warning", 40
|
||||
print request + dataset[0] + ".critical", 45
|
||||
if request == "fan":
|
||||
print request + dataset[0] + ".label", dataset[1]
|
||||
print request + dataset[0] + ".warning", 2400
|
||||
print request + dataset[0] + ".critical", 2000
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if "config" in sys.argv[1:]:
|
||||
print_config()
|
||||
elif "snmpconf" in sys.argv[1:]:
|
||||
print "require 1.3.6.1.4.1.18928.1.2.2.1.8.1.1"
|
||||
sys.exit(0)
|
||||
else:
|
||||
for dataset in get_data():
|
||||
# Filter Battery Status (255 == Not installed)
|
||||
if request == "volt" and dataset[1] == "Battery Status":
|
||||
continue
|
||||
print request + dataset[0] + ".value", dataset[2]
|
||||
sys.exit(0)
|
88
plugins/snmp/snmp__brocade_temp_module_
Executable file
88
plugins/snmp/snmp__brocade_temp_module_
Executable file
|
@ -0,0 +1,88 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use Munin::Plugin;
|
||||
use Munin::Plugin::SNMP;
|
||||
|
||||
my $DEBUG=$ENV{'MUNIN_DEBUG'};
|
||||
|
||||
# This is the snmpwalk:
|
||||
# snAgentTempSensorDescr.1.1 = STRING: "Line module 1, sensor 1 temperature"
|
||||
# snAgentTempSensorDescr.1.2 = STRING: "Line module 1, sensor 2 temperature"
|
||||
# snAgentTempSensorDescr.1.3 = STRING: "Line module 1, sensor 3 temperature"
|
||||
# snAgentTempSensorDescr.1.4 = STRING: "Line module 1, sensor 4 temperature"
|
||||
# snAgentTempSensorDescr.2.1 = STRING: "Line module 2, sensor 1 temperature"
|
||||
# snAgentTempSensorDescr.2.2 = STRING: "Line module 2, sensor 2 temperature"
|
||||
# snAgentTempSensorDescr.2.3 = STRING: "Line module 2, sensor 3 temperature"
|
||||
# snAgentTempSensorDescr.2.4 = STRING: "Line module 2, sensor 4 temperature"
|
||||
# snAgentTempSensorDescr.3.1 = STRING: "Active management module temperature"
|
||||
# snAgentTempSensorDescr.3.2 = STRING: "Active management module temperature"
|
||||
# snAgentTempValue.1.1 = INTEGER: 100
|
||||
# snAgentTempValue.1.2 = INTEGER: 106
|
||||
# snAgentTempValue.1.3 = INTEGER: 82
|
||||
# snAgentTempValue.1.4 = INTEGER: 72
|
||||
# snAgentTempValue.2.1 = INTEGER: 74
|
||||
# snAgentTempValue.2.2 = INTEGER: 102
|
||||
# snAgentTempValue.2.3 = INTEGER: 70
|
||||
# snAgentTempValue.2.4 = INTEGER: 74
|
||||
# snAgentTempValue.3.1 = INTEGER: 78
|
||||
# snAgentTempValue.3.2 = INTEGER: 84
|
||||
|
||||
my $brcdIp = '1.3.6.1.4.1.1991';
|
||||
my $snAgentTempTable = "$brcdIp.1.1.2.13.1";
|
||||
my $snAgentTempSensorDescr = "$snAgentTempTable.1.3";
|
||||
my $snAgentTempValue = "$snAgentTempTable.1.4";
|
||||
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
|
||||
print "index $snAgentTempTable.1.3.\n";
|
||||
print "require $snAgentTempSensorDescr. [1-9]\n";
|
||||
print "require $snAgentTempValue. [1-9]\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $module = 0;
|
||||
|
||||
if ($Munin::Plugin::me =~ /_module_(\d+)$/) {
|
||||
$module = $1;
|
||||
} else {
|
||||
die "Could not determine module number from ".$Munin::Plugin::me."\n";
|
||||
}
|
||||
|
||||
my ($session,$error);
|
||||
|
||||
$session = Munin::Plugin::SNMP->session(-translate => [ -nosuchinstance => undef ]);
|
||||
|
||||
my $sensor = 1;
|
||||
if ($ARGV[0] and $ARGV[0] eq "config") {
|
||||
my ($host,undef,$version) = Munin::Plugin::SNMP->config_session();
|
||||
|
||||
print "host_name $host\n" unless $host eq 'localhost';
|
||||
print "graph_title Module $module
|
||||
graph_args --base 1000 --lower-limit 0
|
||||
graph_vlabel °C
|
||||
graph_category system
|
||||
graph_scale no\n";
|
||||
|
||||
my $descr = undef;
|
||||
while (defined ($descr = $session->get_single("$snAgentTempSensorDescr.$module.$sensor"))) {
|
||||
print "sensor$sensor.label $descr\n";
|
||||
$sensor ++;
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $value = undef;
|
||||
while (defined ($value = $session->get_single("$snAgentTempValue.$module.$sensor"))) {
|
||||
$value /= 2;
|
||||
print "sensor$sensor.value $value\n";
|
||||
$sensor++;
|
||||
}
|
||||
# vim:ft=perl
|
107
plugins/snmp/snmp__cpu
Executable file
107
plugins/snmp/snmp__cpu
Executable file
|
@ -0,0 +1,107 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2006 Lars Strand
|
||||
#
|
||||
# Munin plugin to monitor CPU-load by use of SNMP.
|
||||
# Based on snmp__df plugin.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
#
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "index 1.3.6.1.2.1.25.3.3.1.2.\n";
|
||||
print "require 1.3.6.1.2.1.25.3.3.1.2.1\n"; # CPU #1
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_cpu$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
# CPUs
|
||||
my $hrProcessorLoad = "1.3.6.1.2.1.25.3.3.1.2.";
|
||||
$response = $session->get_table($hrProcessorLoad);
|
||||
|
||||
if (!defined ($response))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
print "graph_title CPU usage (in %)
|
||||
graph_category system
|
||||
graph_args --upper-limit 100 -l 0
|
||||
graph_vlabel %
|
||||
graph_info This graph shows the CPU load on the system.
|
||||
";
|
||||
foreach my $cpuoid (keys %$response) {
|
||||
my @oid = split(/\./, $cpuoid);
|
||||
my $cpu = pop @oid;
|
||||
print "cpu$cpu.label CPU $cpu\n";
|
||||
print "cpu$cpu.info CPU load on CPU $cpu\n";
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# the values
|
||||
while (my ($cpuoid, $load) = each(%$response)) {
|
||||
my @oid = split(/\./, $cpuoid);
|
||||
my $cpu = pop @oid;
|
||||
print "cpu$cpu.value $load\n";
|
||||
}
|
||||
|
175
plugins/snmp/snmp__cpu_usage
Executable file
175
plugins/snmp/snmp__cpu_usage
Executable file
|
@ -0,0 +1,175 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2004 Jimmy Olsen
|
||||
# Copyright (C) 2009 Xavier Montagutelli
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
# $Log: snmp__cpu_usage,v $
|
||||
# Revision 1.1 2009/09/21 06:59:33 root
|
||||
# Initial revision
|
||||
#
|
||||
# Revision 1.1 2009/09/17 13:43:35 root
|
||||
# Initial revision
|
||||
#
|
||||
# Revision 1.11 2004/12/10 18:51:43 jimmyo
|
||||
# linux/apt* has been forced to LANG=C, to get predictable output.
|
||||
#
|
||||
# Revision 1.10 2004/12/10 10:47:47 jimmyo
|
||||
# Change name from ${scale} to ${graph_period}, to be more consistent.
|
||||
#
|
||||
# Revision 1.9 2004/12/09 22:12:55 jimmyo
|
||||
# Added "graph_period" option, to make "graph_sums" usable.
|
||||
#
|
||||
# Revision 1.8 2004/11/21 00:16:56 jimmyo
|
||||
# Changed a lot of plugins so they use DERIVE instead of COUNTER.
|
||||
#
|
||||
# Revision 1.7 2004/11/16 20:08:26 jimmyo
|
||||
# License cleanups.
|
||||
#
|
||||
# Revision 1.6 2004/11/12 20:28:03 ilmari
|
||||
# No debugging info by default
|
||||
#
|
||||
# Revision 1.5 2004/09/08 15:25:33 ilmari
|
||||
# Use /usr/bin/perl in all perl shebang lines.
|
||||
#
|
||||
# Revision 1.4 2004/09/07 13:19:22 ilmari
|
||||
# SNMP plugins now honour the "host" environment variable if they can't deduce the hostname from zsh.
|
||||
#
|
||||
# Revision 1.3 2004/09/05 12:00:18 jimmyo
|
||||
# Set family and capabilities.
|
||||
#
|
||||
# Revision 1.2 2004/09/04 21:58:28 jimmyo
|
||||
# Set category and info fields.
|
||||
#
|
||||
# Revision 1.1 2004/04/30 22:22:07 jimmyo
|
||||
# Added to SNMP based fibre-channel plugins: fc_if and fc_if_err.
|
||||
#
|
||||
# Revision 1.4 2004/04/30 16:58:14 jimmyo
|
||||
# Added max.
|
||||
#
|
||||
# Revision 1.3 2004/02/22 20:17:58 jimmyo
|
||||
# Typo fix
|
||||
#
|
||||
# Revision 1.2 2004/02/18 21:54:56 jimmyo
|
||||
# Did a bit of work on the snmp-thingie.
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.1 2003/12/19 20:53:45 jimmyo
|
||||
# Created by jo
|
||||
#
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Munin::Plugin::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $iface = $ENV{interface} || undef;
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "number 1.3.6.1.4.1.2021.11.9\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_cpu_usage$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1 -- $2\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $cpuUser = "1.3.6.1.4.1.2021.11.9";
|
||||
my $cpuSystem = "1.3.6.1.4.1.2021.11.10";
|
||||
my $cpuIdle = "1.3.6.1.4.1.2021.11.11";
|
||||
|
||||
my $cpu = 0;
|
||||
|
||||
my %cpuCounters = (
|
||||
cpuUser => "1.3.6.1.4.1.2021.11.9.$cpu", # The percentage of CPU time spent processing user-level code, calculated over the last minute
|
||||
cpuSystem => "1.3.6.1.4.1.2021.11.10.$cpu", # The percentage of CPU time spent processing system-level code, calculated over the last minute
|
||||
cpuIdle => "1.3.6.1.4.1.2021.11.11.$cpu", # The percentage of processor time spent idle, calculated over the last minute
|
||||
);
|
||||
|
||||
my $session = Munin::Plugin::SNMP->session(-translate =>
|
||||
[ -timeticks => 0x0 ]);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: could not establish SNMP object";
|
||||
}
|
||||
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
my $warn = undef;
|
||||
print "graph_title CPU Usage on $host\n";
|
||||
print "graph_args --base 1000 --lower-limit 0\n";
|
||||
print "graph_vlabel Percentage on one minute\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_info This graph shows the CPU usage on one minute\n";
|
||||
|
||||
my $firstCounter = 1;
|
||||
foreach my $c (keys %cpuCounters) {
|
||||
print $c . ".label $c\n";
|
||||
print $c . ".type GAUGE\n";
|
||||
if ($firstCounter) {
|
||||
print $c . ".draw AREA\n";
|
||||
$firstCounter = 0;
|
||||
} else {
|
||||
print $c . ".draw STACK\n";
|
||||
}
|
||||
print $c . ".min 0\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
foreach my $c (keys %cpuCounters) {
|
||||
if (defined ($response = $session->get_request($cpuCounters{$c})) && $response->{$cpuCounters{$c}} =~ /^[0-9]*$/) {
|
||||
print $c . ".value ", $response->{$cpuCounters{$c}}, "\n";
|
||||
} else {
|
||||
print $c . ".value U\n";
|
||||
}
|
||||
}
|
||||
|
184
plugins/snmp/snmp__fn/snmp__fn
Executable file
184
plugins/snmp/snmp__fn/snmp__fn
Executable file
|
@ -0,0 +1,184 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# File: snmp__fn
|
||||
# Description: SNMP plugin to monitor open sessions, sslvpn, CPU and Memory on a
|
||||
# Fortinet Fortigate firewall.
|
||||
#
|
||||
# Author: Thom Diener <munin@tmd.ch>
|
||||
# License: This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated
|
||||
# June, 1991.
|
||||
#
|
||||
# Version: v1.00 30.10.2011 First draft of the fortigate plugin
|
||||
# v1.01 19.01.2012 OID to MIB changed, plugins gets faster
|
||||
# v1.02 25.01.2012 MIB file availability check added
|
||||
# v1.03 01.04.2012 Update to work with Firmware v4.00MR3Patch6
|
||||
#
|
||||
# Parameters: config (required)
|
||||
# autoconf (optional)
|
||||
#
|
||||
# Usage: place in /etc/munin/plugins/ (or link it there using ln -s)
|
||||
# (Example: ln -s /usr/share/munin/plugins/snmp__fn \
|
||||
# /etc/munin/plugins/snmp_foo.example.com_fn)
|
||||
#
|
||||
# Add global community string
|
||||
# vi /etc/munin/plugin-conf.d/munin-node
|
||||
# [snmp_*]
|
||||
# env.community private
|
||||
# timeout 45 # In case low latency or timeout
|
||||
#
|
||||
# Fortigate Activate snmp on your Fortigate firewall.
|
||||
# Fortigate documentation at https://support.fortinet.com
|
||||
#
|
||||
# MIB Download and copy the original Fortigate MIB defintion files to:
|
||||
# /usr/share/snmp/mibs/FORTINET-CORE-MIB.mib.txt
|
||||
# /usr/share/snmp/mibs/FORTINET-FORTIGATE-MIB.mib
|
||||
#
|
||||
# Testing This plugin has been tested with the following OS/software:
|
||||
#
|
||||
# Appliance/Firmware:
|
||||
# Fortigate-50B 3.00-b0662(MR6 Patch 1) work with v1.00-1.02
|
||||
# Fortigate-50B 3.00-b0678(MR6 Patch 6) work with v1.00-1.02
|
||||
# Fortigate-50B 4.00-b0178(MR1 Patch 1) work with v1.00-1.02
|
||||
# Fortigate-50B 4.00-b0217(MR1 Patch 10) work with v1.00-1.02
|
||||
# Fortigate-50B 4.00-b0217(MR2 Patch 4) work with v1.00-1.02
|
||||
# Fortigate-50B 4.00-b0521(MR3 Patch 6) work with v1.03
|
||||
#
|
||||
# Munin-Version:
|
||||
# Munin 1.4.4 (1.4.4-1ubuntu1)
|
||||
# OS-Version:
|
||||
# Ubuntu 10.04.3 LTS (lucid) x86_32/64
|
||||
#
|
||||
#%# family=manual
|
||||
#
|
||||
#set -x
|
||||
|
||||
### Constants ------------------------------------------------------------------
|
||||
SNMPCLIENT=`basename $0 | sed 's/^snmp_//g' | cut -d "_" -f1`
|
||||
MIBFILE="/usr/share/snmp/mibs/FORTINET-FORTIGATE-MIB.mib"
|
||||
FNTYPE=`echo $MIBFILE | cut -d "." -f1 | cut -d "/" -f6`
|
||||
if [ -r $MIBFILE ]; then
|
||||
SNMPGET="/usr/bin/snmpget -m $MIBFILE -c $community -v 2c $SNMPCLIENT"
|
||||
else
|
||||
echo No, MIB definition file not available or readable.
|
||||
exit 1
|
||||
fi
|
||||
UNIT="Fortinet Fortigate Unit"
|
||||
|
||||
|
||||
### Variables ------------------------------------------------------------------
|
||||
FGTcpu="$FNTYPE::fgSysCpuUsage.0"
|
||||
fnSysMemUsage="$FNTYPE::fgSysMemUsage.0"
|
||||
fnSysSesCount="$FNTYPE::fgSysSesCount.0"
|
||||
fnVPNSslStatsLoginUsers="$FNTYPE::fgVpnSslStatsLoginUsers.1"
|
||||
fnVPNSslStatsActiveWebSessions="$FNTYPE::fgVpnSslStatsActiveWebSessions.1"
|
||||
fnVPNSslStatsActiveTunnels="$FNTYPE::fgVpnSslStatsActiveTunnels.1"
|
||||
|
||||
SCPU=`$SNMPGET $FGTcpu | cut -d ":" -f4 | cut -d " " -f2`
|
||||
SMEM=`$SNMPGET $fnSysMemUsage | cut -d ":" -f4 | cut -d " " -f2`
|
||||
SCNT=`$SNMPGET $fnSysSesCount | cut -d ":" -f4 | cut -d " " -f2`
|
||||
USER=`$SNMPGET $fnVPNSslStatsLoginUsers | cut -d ":" -f4 | cut -d " " -f2`
|
||||
WEBS=`$SNMPGET $fnVPNSslStatsActiveWebSessions | cut -d ":" -f4 | cut -d " " -f2`
|
||||
ATUN=`$SNMPGET $fnVPNSslStatsActiveTunnels | cut -d ":" -f4 | cut -d " " -f2`
|
||||
|
||||
|
||||
### Functions ------------------------------------------------------------------
|
||||
|
||||
autoconf()
|
||||
{
|
||||
if [ $SCPU ]; then
|
||||
echo yes, OID $FGTcpu can be readed.
|
||||
else
|
||||
echo no, one or multiple OID can not be readed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $SMEM ]; then
|
||||
echo yes, OID $fnSysMemUsage can be readed.
|
||||
else
|
||||
echo no, one or multiple OID can not be readed.
|
||||
exit 1
|
||||
fi
|
||||
if [ $SCNT ]; then
|
||||
echo yes, OID $fnSysSesCount can be readed.
|
||||
else
|
||||
echo no, one or multiple OID can not be read.
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
config()
|
||||
{
|
||||
echo "multigraph fn_cpu"
|
||||
echo "host_name $SNMPCLIENT"
|
||||
echo "graph_title $UNIT - CPU usage"
|
||||
echo 'graph_category system'
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_info This graph shows current CPU usage.'
|
||||
echo 'graph_args --base 1000 -r --lower-limit 0 --upper-limit 100'
|
||||
echo 'forticpu.label CPU'
|
||||
echo 'forticpu.info CPU usage'
|
||||
echo 'forticpu.draw AREA'
|
||||
echo ''
|
||||
echo "multigraph fn_memory"
|
||||
echo "host_name $SNMPCLIENT"
|
||||
echo "graph_title $UNIT - Memory usage"
|
||||
echo 'graph_category system'
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_info This graph shows current memory usage.'
|
||||
echo 'graph_args --base 1000 -r --lower-limit 0 --upper-limit 100'
|
||||
echo 'fortimemory.label Memory'
|
||||
echo 'fortimemory.info Memory usage'
|
||||
echo 'fortimemory.draw AREA'
|
||||
echo ''
|
||||
echo "multigraph fn_sessions"
|
||||
echo "host_name $SNMPCLIENT"
|
||||
echo "graph_title $UNIT - Sessions"
|
||||
echo 'graph_category Other'
|
||||
echo 'graph_vlabel Active Sessions'
|
||||
echo 'graph_info Active session count on the Fortigate firewall'
|
||||
echo 'fortisessions.label Sessions'
|
||||
echo 'fortisessions.info Active session count'
|
||||
echo 'fortisessions.draw AREA'
|
||||
echo ''
|
||||
echo "multigraph fn_vpnsessions"
|
||||
echo "host_name $SNMPCLIENT"
|
||||
echo "graph_title $UNIT - SSLvpn Sessions"
|
||||
echo 'graph_category Other'
|
||||
echo 'graph_vlabel Sessions/Users'
|
||||
echo 'graph_info Loged in users with SSLvpn (WebSession or Tunnel-Mode)'
|
||||
echo 'fortiuser.label Users'
|
||||
echo 'fortiuser.info Loged in SSLvpn users'
|
||||
echo 'fortiwebs.label WebSessions'
|
||||
echo 'fortiwebs.info Active SSLvpn WebSessions'
|
||||
echo 'fortiatun.label ActiveTunnels'
|
||||
echo 'fortiatun.info Active SSLvpn Tunnels'
|
||||
exit 0
|
||||
}
|
||||
|
||||
values()
|
||||
{
|
||||
echo "multigraph fn_cpu"
|
||||
echo "forticpu.value $SCPU"
|
||||
echo ""
|
||||
echo "multigraph fn_memory"
|
||||
echo "fortimemory.value $SMEM"
|
||||
echo ""
|
||||
echo "multigraph fn_sessions"
|
||||
echo "fortisessions.value $SCNT"
|
||||
echo ""
|
||||
echo "multigraph fn_vpnsessions"
|
||||
echo "fortiuser.value $USER"
|
||||
echo "fortiwebs.value $WEBS"
|
||||
echo "fortiatun.value $ATUN"
|
||||
}
|
||||
|
||||
### Main -----------------------------------------------------------------------
|
||||
|
||||
if [ "$1" = "autoconf" ]; then autoconf
|
||||
fi
|
||||
if [ "$1" = "config" ]; then config
|
||||
fi
|
||||
values
|
BIN
plugins/snmp/snmp__fn/snmp__fn-cpu.png
Executable file
BIN
plugins/snmp/snmp__fn/snmp__fn-cpu.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
plugins/snmp/snmp__fn/snmp__fn-memory.png
Executable file
BIN
plugins/snmp/snmp__fn/snmp__fn-memory.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
plugins/snmp/snmp__fn/snmp__fn-sessions.png
Executable file
BIN
plugins/snmp/snmp__fn/snmp__fn-sessions.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
plugins/snmp/snmp__fn/snmp__fn-vpnsessions.png
Executable file
BIN
plugins/snmp/snmp__fn/snmp__fn-vpnsessions.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
181
plugins/snmp/snmp__gwia_bytes_
Executable file
181
plugins/snmp/snmp__gwia_bytes_
Executable file
|
@ -0,0 +1,181 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# File: snmp__gwia_bytes__
|
||||
# Copyright (C) 2007 Gabriele Pohl
|
||||
#
|
||||
# Derived from plugin snmp__load
|
||||
# Copyright (C) 2004 Jimmy Olsen, Dagfinn Ilmari Mannsaaker
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ------------------------------------------------------------
|
||||
# Plugin to monitor Novell Groupwise Internet Agent (GWIA)
|
||||
# ------------------------------------------------------------
|
||||
#
|
||||
# Management Information Base (MIB) GWIAMIB
|
||||
#
|
||||
# Naming Tree: 1.3.6.1.4.1.23
|
||||
# iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) novell(23)
|
||||
#
|
||||
# To see all values available for your GWIA, type
|
||||
# snmpwalk -v1 -c public -m GWIAMIB <HOST> gwia
|
||||
#
|
||||
# This plugin fetches:
|
||||
#
|
||||
# * gwiaGatewayName - 1.3.6.1.4.1.23.2.70.1.1.
|
||||
# * gwiaStatBytesIn - 1.3.6.1.4.1.23.2.70.1.6.
|
||||
# * gwiaStatBytesOut - 1.3.6.1.4.1.23.2.70.1.5.
|
||||
#
|
||||
# Usage:
|
||||
# --------------
|
||||
# Link this file snmp__gwia_bytes_ to your nodes servicedir [/etc/munin/plugins]
|
||||
#
|
||||
# as:
|
||||
# snmp_<host>_gwia_bytes_<pos>
|
||||
#
|
||||
# with:
|
||||
# <host> = Name or IP-Number of host
|
||||
# <pos> = table index of the GWIA Object
|
||||
#
|
||||
# E.g.
|
||||
# ln -s /usr/share/munin/plugins/snmp__gwia_bytes_ \
|
||||
# /etc/munin/plugins/snmp_foo.example.com_gwia_bytes_0
|
||||
# ...will monitor a single GWIA object on host foo.example.com.
|
||||
#
|
||||
# Parameters
|
||||
# community - Specify wich community string to use (Default: public)
|
||||
# port - Specify which port to read from (Default: 161)
|
||||
# host - Specify which host to monitor (Default: Read from link in servicedir)
|
||||
# pos - Specify which table Object to read (Default: Read from link in servicedir,
|
||||
#
|
||||
# You may adjust settings to your need via configuration in plugin-conf.d/munin-node:
|
||||
# [snmp_*_gwia_bytes_*]
|
||||
# env.port <your_port_number>
|
||||
# env.community <your SNMP community string>
|
||||
# env.pos <your objects table position. Values: 0,1,2,..>
|
||||
# env.host <name or IP of your host>
|
||||
#
|
||||
# Parameters can also be specified on a per GWIA basis, eg:
|
||||
# [snmp_example.com_gwia_bytes_1]
|
||||
# env.port 166
|
||||
# env.community example
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.0 2007/09/06 16:49 gap
|
||||
# Created by gap
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $pos = $ENV{pos} || 0;
|
||||
|
||||
my $response;
|
||||
|
||||
my $GRAPH_CATEGORY = "Groupwise";
|
||||
my $GRAPH_PERIOD = "minute";
|
||||
my $GRAPH_VLABEL = "bytes per $GRAPH_PERIOD in(-) / out(+)";
|
||||
my $BYTES_LABEL='Bytes';
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.1. [.*]\n"; # gwiaGatewayName
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.6. [\\d*]\n"; # gwiaStatBytesIn
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.5. [\\d*]\n"; # gwiaStatBytesOut
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_gwia_bytes_(\d+)*$/)
|
||||
{
|
||||
$host = $1;
|
||||
$pos = $2;
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
|
||||
# get name of Internet Agent
|
||||
my $gwname = &get_single ($session, "1.3.6.1.4.1.23.2.70.1.1.$pos"); # gwiaGatewayName
|
||||
# output to munin
|
||||
print "host_name $host
|
||||
graph_category $GRAPH_CATEGORY
|
||||
graph_args --base 1000
|
||||
graph_period $GRAPH_PERIOD
|
||||
graph_title GWIA byte load ($gwname)
|
||||
graph_info Shows per minute activity of the Groupwise Internet Agent (GWIA), here: $gwname.<br />Outgoing data will be reported as positive value, incoming as negative value.<br />The plugin fetches the following values (GWIAMIB):<br />gwiaStatBytesOut - Size of outgoing messages in bytes.<br />gwiaStatBytesIn - Size of incoming messages in bytes.
|
||||
graph_vlabel $GRAPH_VLABEL
|
||||
bytes_in.label $BYTES_LABEL
|
||||
bytes_in.info gwiaStatBytesIn (1.3.6.1.4.1.23.2.70.1.6.)
|
||||
bytes_in.type DERIVE
|
||||
bytes_in.min 0
|
||||
bytes_in.draw AREA
|
||||
bytes_in.graph no
|
||||
bytes_out.label $BYTES_LABEL
|
||||
bytes_out.info gwiaStatBytesOut (1.3.1.4.1.23.2.70.1.5.)
|
||||
bytes_out.type DERIVE
|
||||
bytes_out.min 0
|
||||
bytes_out.draw AREA
|
||||
bytes_out.negative bytes_in";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
# fetch the data and print
|
||||
print "bytes_in.value ", &get_single ($session, "1.3.6.1.4.1.23.2.70.1.6.$pos"), "\n"; # gwiaStatBytesIn
|
||||
print "bytes_out.value ", &get_single ($session, "1.3.6.1.4.1.23.2.70.1.5.$pos"), "\n"; # gwiaStatBytesOut
|
||||
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my $handle = shift;
|
||||
my $oid = shift;
|
||||
|
||||
print "# Getting single $oid...\n" if $DEBUG;
|
||||
|
||||
$response = $handle->get_request ($oid);
|
||||
|
||||
if (!defined $response->{$oid})
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $response->{$oid};
|
||||
}
|
||||
}
|
||||
|
226
plugins/snmp/snmp__gwia_msgs_
Executable file
226
plugins/snmp/snmp__gwia_msgs_
Executable file
|
@ -0,0 +1,226 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# File: snmp__gwia_msgs__
|
||||
# Copyright (C) 2007 Gabriele Pohl (contact@dipohl.de)
|
||||
#
|
||||
# Derived from plugin snmp__load
|
||||
# Copyright (C) 2004 Jimmy Olsen, Dagfinn Ilmari Mannsaaker
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ------------------------------------------------------------
|
||||
# Plugin to monitor Novell Groupwise Internet Agent (GWIA)
|
||||
# ------------------------------------------------------------
|
||||
#
|
||||
# Management Information Base (MIB) GWIAMIB
|
||||
#
|
||||
# Naming Tree: 1.3.6.1.4.1.23
|
||||
# iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) novell(23)
|
||||
#
|
||||
# To see all values available for your GWIA, type
|
||||
# snmpwalk -v1 -c public -m GWIAMIB <HOST> gwia
|
||||
#
|
||||
# This plugin fetches:
|
||||
#
|
||||
# * gwiaGatewayName - 1.3.6.1.4.1.23.2.70.1.1.
|
||||
# * gwiaStatMsgsOut - 1.3.6.1.4.1.23.2.70.1.7.
|
||||
# * gwiaStatMsgsIn - 1.3.6.1.4.1.23.2.70.1.8.
|
||||
# * gwiaStatStatusesOut - 1.3.6.1.4.1.23.2.70.1.9.
|
||||
# * gwiaStatStatusesIn - 1.3.6.1.4.1.23.2.70.1.10.
|
||||
# * gwiaStatErrorsOut - 1.3.6.1.4.1.23.2.70.1.11.
|
||||
# * gwiaStatErrorsIn - 1.3.6.1.4.1.23.2.70.1.12.
|
||||
#
|
||||
# Usage:
|
||||
# --------------
|
||||
# Link this file snmp__gwia_msgs_ to your nodes servicedir [/etc/munin/plugins]
|
||||
#
|
||||
# as:
|
||||
# snmp_<host>_gwia_msgs_<pos>
|
||||
#
|
||||
# with:
|
||||
# <host> = Name or IP-Number of host
|
||||
# <pos> = table index of the GWIA Object
|
||||
#
|
||||
# E.g.
|
||||
# ln -s /usr/share/munin/plugins/snmp__gwia_msgs_ \
|
||||
# /etc/munin/plugins/snmp_foo.example.com_gwia_msgs_0
|
||||
# ...will monitor a single GWIA object on host foo.example.com.
|
||||
#
|
||||
# Parameters
|
||||
# community - Specify wich community string to use (Default: public)
|
||||
# port - Specify which port to read from (Default: 161)
|
||||
# host - Specify which host to monitor (Default: Read from link in servicedir)
|
||||
# pos - Specify which table Object to read (Default: Read from link in servicedir,
|
||||
#
|
||||
# You may adjust settings to your need via configuration in plugin-conf.d/munin-node:
|
||||
# [snmp_*_gwia_msgs_*]
|
||||
# env.port <your_port_number>
|
||||
# env.community <your SNMP community string>
|
||||
# env.pos <your objects table position. Values: 0,1,2,..>
|
||||
# env.host <name or IP of your host>
|
||||
#
|
||||
# Parameters can also be specified on a per GWIA basis, eg:
|
||||
# [snmp_foo.example.com_gwia_msgs_1]
|
||||
# env.port 166
|
||||
# env.community example
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.0 2007/09/08 16:08 gap
|
||||
# Created by gap
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $pos = $ENV{pos} || 0;
|
||||
|
||||
my $response;
|
||||
|
||||
# fix values
|
||||
my $GRAPH_CATEGORY = "Groupwise";
|
||||
my $GRAPH_PERIOD = "minute";
|
||||
my $GRAPH_VLABEL = "messages per $GRAPH_PERIOD in(-) / out(+)";
|
||||
my $MSGS_LABEL='Messages';
|
||||
my $STATS_LABEL='Status-Msgs';
|
||||
my $ERRORS_LABEL='Errors';
|
||||
my $ERRORS_CRITICAL=10;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.1. [.*]\n"; # gwiaGatewayName
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.7. [\\d*]\n"; # gwiaStatMsgsOut
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.8. [\\d*]\n"; # gwiaStatMsgsIn
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.11. [\\d*]\n"; # gwiaStatErrorsOut
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.12. [\\d*]\n"; # gwiaStatErrorsIn
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.9. [\\d*]\n"; # gwiaStatStatusesOut
|
||||
print "require 1.3.6.1.4.1.23.2.70.1.10. [\\d*]\n"; # gwiaStatStatusesIn
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_gwia_msgs_(\d+)*$/)
|
||||
{
|
||||
$host = $1;
|
||||
$pos = $2;
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
|
||||
# get name of Internet Agent
|
||||
my $gwname = &get_single ($session, "1.3.6.1.4.1.23.2.70.1.1.$pos"); # gwiaGatewayName
|
||||
|
||||
# output to munin
|
||||
print "host_name $host
|
||||
graph_category Groupwise
|
||||
graph_args --base 1000
|
||||
graph_period $GRAPH_PERIOD
|
||||
graph_title GWIA msg load ($gwname)
|
||||
graph_info Shows per minute activity of the Groupwise Internet Agent (GWIA), here: $gwname.<br />Outgoing data will be reported as positive value, incoming as negative value.
|
||||
graph_vlabel $GRAPH_VLABEL
|
||||
msgs_in.label $MSGS_LABEL
|
||||
msgs_in.info gwiaStatMsgsIn (1.3.6.1.4.1.23.2.70.1.8.)
|
||||
msgs_in.type DERIVE
|
||||
msgs_in.min 0
|
||||
msgs_in.draw AREA
|
||||
msgs_in.graph no
|
||||
msgs_out.label $MSGS_LABEL
|
||||
msgs_out.info gwiaStatMsgsOut (1.3.6.1.4.1.23.2.70.1.7.)
|
||||
msgs_out.type DERIVE
|
||||
msgs_out.min 0
|
||||
msgs_out.draw AREA
|
||||
msgs_out.negative msgs_in
|
||||
msgs_out.graph yes
|
||||
stats_in.label $STATS_LABEL
|
||||
stats_in.info gwiaStatStatusesIn (1.3.6.1.4.1.23.2.70.1.10.)
|
||||
stats_in.type DERIVE
|
||||
stats_in.min 0
|
||||
stats_in.draw LINE1
|
||||
stats_in.graph no
|
||||
stats_out.label $STATS_LABEL
|
||||
stats_out.info gwiaStatStatusesOut (1.3.6.1.4.1.23.2.70.1.9.)
|
||||
stats_out.type DERIVE
|
||||
stats_out.min 0
|
||||
stats_out.draw LINE1
|
||||
stats_out.negative stats_in
|
||||
stats_out.graph yes
|
||||
errors_in.label $ERRORS_LABEL
|
||||
errors_in.info gwiaStatErrorsIn (1.3.6.1.4.1.23.2.70.1.12.)
|
||||
errors_in.critical $ERRORS_CRITICAL
|
||||
errors_in.type DERIVE
|
||||
errors_in.min 0
|
||||
errors_in.draw LINE1
|
||||
errors_in.graph no
|
||||
errors_out.label $ERRORS_LABEL
|
||||
errors_out.info gwiaStatErrorsOut (1.3.6.1.4.1.23.2.70.1.11.)
|
||||
errors_out.critical $ERRORS_CRITICAL
|
||||
errors_out.type DERIVE
|
||||
errors_out.negative errors_in
|
||||
errors_out.min 0
|
||||
errors_out.draw LINE1
|
||||
errors_out.graph yes";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
# fetch the data and print
|
||||
print "msgs_in.value ", &get_single ($session, "1.3.6.1.4.1.23.2.70.1.8.$pos"), "\n"; # gwiaStatMsgsIn
|
||||
print "msgs_out.value ", &get_single ($session, "1.3.6.1.4.1.23.2.70.1.7.$pos"), "\n"; # gwiaStatMsgsOut
|
||||
print "stats_in.value ", &get_single ($session, "1.3.6.1.4.1.23.2.70.1.10.$pos"), "\n"; # gwiaStatStatusesIn
|
||||
print "stats_out.value ", &get_single ($session, "1.3.6.1.4.1.23.2.70.1.9.$pos"), "\n"; # gwiaStatStatusesOut
|
||||
print "errors_in.value ", &get_single ($session, "1.3.6.1.4.1.23.2.70.1.12.$pos"), "\n"; # gwiaStatErrorsIn
|
||||
print "errors_out.value ", &get_single ($session, "1.3.6.1.4.1.23.2.70.1.11.$pos"), "\n"; # gwiaStatErrorsOut
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my $handle = shift;
|
||||
my $oid = shift;
|
||||
|
||||
print "# Getting single $oid...\n" if $DEBUG;
|
||||
|
||||
$response = $handle->get_request ($oid);
|
||||
|
||||
if (!defined $response->{$oid})
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $response->{$oid};
|
||||
}
|
||||
}
|
||||
|
200
plugins/snmp/snmp__gwmta_msgs_
Executable file
200
plugins/snmp/snmp__gwmta_msgs_
Executable file
|
@ -0,0 +1,200 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# File: snmp__gwmta_msgs_
|
||||
# Copyright (C) 2007 Gabriele Pohl (contact@dipohl.de)
|
||||
#
|
||||
# Derived from plugin snmp__load
|
||||
# Copyright (C) 2004 Jimmy Olsen, Dagfinn Ilmari Mannsaaker
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ------------------------------------------------------------
|
||||
# Plugin to monitor Novell Groupwise MTA (GWMTA)
|
||||
# ------------------------------------------------------------
|
||||
#
|
||||
# Management Information Base (MIB) GWMTA-MIB
|
||||
#
|
||||
# Naming Tree: 1.3.6.1.4.1.23
|
||||
# iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) novell(23)
|
||||
#
|
||||
# To see all values available for your GWMTA, type
|
||||
# snmpwalk -v1 -c public -m GWMTA-MIB <HOST> gwmta
|
||||
#
|
||||
# This plugin fetches:
|
||||
#
|
||||
# * mtaDomainName 1.3.6.1.4.1.23.2.37.1.1.1.2.
|
||||
# * mtaTenMinuteRoutedMsgs - 1.3.6.1.4.1.23.2.37.1.1.1.10.
|
||||
# * mtaTenMinuteUndeliverableMsgs - 1.3.6.1.4.1.23.2.37.1.1.1.12.
|
||||
# * mtaTenMinuteErrorMsgs - 1.3.6.1.4.1.23.2.37.1.1.1.14.
|
||||
#
|
||||
# Usage:
|
||||
# --------------
|
||||
# Link this file snmp__gwmta_msgs_ to your nodes servicedir [/etc/munin/plugins]
|
||||
#
|
||||
# as:
|
||||
# snmp_<host>_gwmta_msgs_<pos>
|
||||
#
|
||||
# with:
|
||||
# <host> = Name or IP-Number of host
|
||||
# <pos> = table index of the GWMTA Object
|
||||
#
|
||||
# E.g.
|
||||
# ln -s /usr/share/munin/plugins/snmp__gwmta_msgs_ \
|
||||
# /etc/munin/plugins/snmp_foo.example.com_gwmta_msgs_0
|
||||
# ...will monitor a single GWMTA object on host foo.example.com.
|
||||
#
|
||||
# Parameters
|
||||
# community - Specify wich community string to use (Default: public)
|
||||
# port - Specify which port to read from (Default: 161)
|
||||
# host - Specify which host to monitor (Default: Read from link in servicedir)
|
||||
# pos - Specify which table Object to read (Default: Read from link in servicedir,
|
||||
#
|
||||
# You may adjust settings to your need via configuration in plugin-conf.d/munin-node:
|
||||
# [snmp_*_gwmta_msgs_*]
|
||||
# env.port <your_port_number>
|
||||
# env.community <your SNMP community string>
|
||||
# env.pos <your objects table position. Values: 0,1,2,..>
|
||||
# env.host <name or IP of your host>
|
||||
#
|
||||
# Parameters can also be specified on a per GWMTA basis, eg:
|
||||
# [snmp_example.com_gwmta_msgs_1]
|
||||
# env.port 166
|
||||
# env.community example
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.0 2007/09/08 19:44 gap
|
||||
# Created by gap
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $pos = $ENV{pos} || 1;
|
||||
|
||||
my $response;
|
||||
|
||||
# fix values
|
||||
my $GRAPH_CATEGORY = "Groupwise";
|
||||
my $GRAPH_PERIOD = "minute";
|
||||
my $GRAPH_VLABEL = "number of messages / 10 min";
|
||||
my $ROUTED_LABEL="Routed";
|
||||
my $ROUTED_CRITICAL=500;
|
||||
my $UNDELIVERED_LABEL="Undeliverable";
|
||||
my $UNDELIVERED_CRITICAL=10;
|
||||
my $ERRORS_LABEL="Errors";
|
||||
my $ERRORS_CRITICAL=10;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "index 1.3.6.1.4.1.23.2.37.1.1.1.1.\n"; # mtaIndex
|
||||
print "require 1.3.6.1.4.1.23.2.37.1.1.1.2. \n"; # mtaDomainName
|
||||
print "require 1.3.6.1.4.1.23.2.37.1.1.1.10. [\\d+]\n"; # mtaTenMinuteRoutedMsgs
|
||||
print "require 1.3.6.1.4.1.23.2.37.1.1.1.12. [\\d+]\n"; # mtaTenMinuteUndeliverableMsgs
|
||||
print "require 1.3.6.1.4.1.23.2.37.1.1.1.14. [\\d+]\n"; # mtaTenMinuteErrorMsgs
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_gwmta_msgs_(\d+)*$/)
|
||||
{
|
||||
$host = $1;
|
||||
$pos = $2;
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
# get name of domain
|
||||
my $domain = &get_single ($session, "1.3.6.1.4.1.23.2.37.1.1.1.2.$pos"); # mtaDomainName
|
||||
|
||||
# output to munin
|
||||
print "host_name $host
|
||||
graph_category Groupwise
|
||||
graph_args --base 1000
|
||||
graph_period $GRAPH_PERIOD
|
||||
graph_title GWMTA load ($domain)
|
||||
graph_info Monitors status of Groupwise MTA, here: $domain. It reports values for the last 10 minutes.
|
||||
graph_vlabel $GRAPH_VLABEL
|
||||
graph_args -l 0
|
||||
routed.label $ROUTED_LABEL
|
||||
routed.info mtaTenMinuteRoutedMsgs (1.3.6.1.4.1.23.2.37.1.1.1.10.)
|
||||
routed.critical $ROUTED_CRITICAL
|
||||
routed.type GAUGE
|
||||
routed.min 0
|
||||
routed.draw AREA
|
||||
routed.graph yes
|
||||
undelivered.label $UNDELIVERED_LABEL
|
||||
undelivered.info mtaTenMinuteUndeliverableMsgs (1.3.6.1.4.1.23.2.37.1.1.1.12.)
|
||||
undelivered.critical $UNDELIVERED_CRITICAL
|
||||
undelivered.type GAUGE
|
||||
undelivered.min 0
|
||||
undelivered.draw STACK
|
||||
undelivered.graph yes
|
||||
errors.label $ERRORS_LABEL
|
||||
errors.info mtaTenMinuteErrorMsgs (1.3.6.1.4.1.23.2.37.1.1.1.14.)
|
||||
errors.critical $ERRORS_CRITICAL
|
||||
errors.type GAUGE
|
||||
errors.min 0
|
||||
errors.draw STACK
|
||||
errors.graph yes";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
# fetch the data and print
|
||||
print "routed.value ", &get_single ($session, "1.3.6.1.4.1.23.2.37.1.1.1.10.$pos"), "\n"; # mtaTenMinuteRoutedMsgs
|
||||
print "undelivered.value ", &get_single ($session, "1.3.6.1.4.1.23.2.37.1.1.1.12.$pos"), "\n"; # mtaTenMinuteUndeliverableMsgs
|
||||
print "errors.value ", &get_single ($session, "1.3.6.1.4.1.23.2.37.1.1.1.14.$pos"), "\n"; # mtaTenMinuteErrorMsgs
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my $handle = shift;
|
||||
my $oid = shift;
|
||||
|
||||
print "# Getting single $oid...\n" if $DEBUG;
|
||||
|
||||
$response = $handle->get_request ($oid);
|
||||
|
||||
if (!defined $response->{$oid})
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $response->{$oid};
|
||||
}
|
||||
}
|
||||
|
213
plugins/snmp/snmp__gwpoa_
Executable file
213
plugins/snmp/snmp__gwpoa_
Executable file
|
@ -0,0 +1,213 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# File: snmp__gwpoa_
|
||||
# Copyright (C) 2007 Gabriele Pohl (contact@dipohl.de)
|
||||
#
|
||||
# Derived from plugin snmp__load
|
||||
# Copyright (C) 2004 Jimmy Olsen, Dagfinn Ilmari Mannsaaker
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# ------------------------------------------------------------
|
||||
# Plugin to monitor Novell Groupwise Post Office Agent (POA)
|
||||
# ------------------------------------------------------------
|
||||
#
|
||||
# Management Information Base (MIB) GWPOA
|
||||
#
|
||||
# Naming Tree: 1.3.6.1.4.1.23
|
||||
# iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) novell(23)
|
||||
#
|
||||
# To see all values available for your GWPOA, type
|
||||
# snmpwalk -v1 -c public -m GWPOA-MIB <HOST> gwpoa
|
||||
#
|
||||
# This plugin fetches:
|
||||
#
|
||||
# * poaPostOfficeName - 1.3.6.1.4.1.23.2.38.1.1.1.2.
|
||||
# * poaTotalMsgs - 1.3.6.1.4.1.23.2.38.1.1.1.3.
|
||||
# * poaUndeliverableMsgs - 1.3.6.1.4.1.23.2.38.1.1.1.8.
|
||||
# * poaProblemMsgs - 1.3.6.1.4.1.23.2.38.1.1.1.4.
|
||||
# * poaAdmErrorMsg - 1.3.6.1.4.1.23.2.38.1.1.1.27.
|
||||
#
|
||||
# Usage:
|
||||
# --------------
|
||||
# Plugin needs to be linked to your servicedir [/etc/munin/plugins]
|
||||
# with the hostname (host) and the table index (pos) of the POA-Object
|
||||
# defined in the linkage.
|
||||
#
|
||||
# snmp_<host>_gwpoa_<pos>
|
||||
#
|
||||
# with:
|
||||
# <host> = Name or IP-Number of host
|
||||
# <pos> = Table index of the POA Object
|
||||
#
|
||||
#
|
||||
# E.g.
|
||||
# ln -s /usr/share/munin/plugins/snmp__gwpoa_ \
|
||||
# /etc/munin/plugins/snmp_foo.example.com_gwpoa_1
|
||||
#
|
||||
# ...will monitor the first POA-Object on host foo.example.com.
|
||||
#
|
||||
#
|
||||
# Configuration:
|
||||
# --------------
|
||||
# Parameters
|
||||
# community - Specify wich community string to use (Default: public)
|
||||
# port - Specify which port to read from (Default: 161)
|
||||
# host - Specify which host to monitor (Default: Read from link in servicedir)
|
||||
# pos - Specify which table Object to read (Default: Read from link in servicedir,
|
||||
#
|
||||
# You may adjust settings via configuration in plugin-conf.d/munin-node:
|
||||
# [snmp_*_gwpoa_*]
|
||||
# env.port <your_port_number>
|
||||
# env.community <your SNMP community string>
|
||||
# env.pos <your table position. Values: 0,1,2,..>
|
||||
# env.host <name or IP of your host>
|
||||
#
|
||||
# Parameters can also be specified on a per POA basis, eg:
|
||||
# [snmp_foo.example.com_gwpoa_2]
|
||||
# env.port 166
|
||||
# env.community example
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.0 2007/09/02 11:27 gap
|
||||
# Created by gap
|
||||
#
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $pos = $ENV{pos} || 1;
|
||||
|
||||
my $response;
|
||||
|
||||
my $GRAPH_CATEGORY = "Groupwise";
|
||||
my $GRAPH_PERIOD = "minute";
|
||||
my $GRAPH_VLABEL = "messages per $GRAPH_PERIOD";
|
||||
my $TOTAL_LABEL = "TotalMsgs";
|
||||
my $UNDELIVERABLE_LABEL = "UndeliverableMsgs";
|
||||
my $PROBLEM_LABEL = "ProblemMsgs";
|
||||
my $ERRORS_LABEL = "AdmErrorMsgs";
|
||||
my $ERRORS_CRITICAL = 10;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "index 1.3.6.1.4.1.23.2.38.1.1.1.1.\n"; # gwpoa
|
||||
print "require 1.3.6.1.4.1.23.2.38.1.1.1.2. [.*]\n"; # poaPostOfficeName
|
||||
print "require 1.3.6.1.4.1.23.2.38.1.1.1.3. [\\d*]\n"; # poaTotalMsgs
|
||||
print "require 1.3.6.1.4.1.23.2.38.1.1.1.4. [\\d*]\n"; # poaProblemMsgs
|
||||
print "require 1.3.6.1.4.1.23.2.38.1.1.1.8. [\\d*]\n"; # poaUndeliverableMsgs
|
||||
print "require 1.3.6.1.4.1.23.2.38.1.1.1.27. [\\d*]\n"; # poaAdmErrorMsgs
|
||||
|
||||
exit 0;
|
||||
}
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_gwpoa_(\d+)*$/)
|
||||
{
|
||||
$host = $1;
|
||||
# take default value for pos if not set in link
|
||||
if (defined($2)) { $pos = $2; }
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
|
||||
# get Post Office Name
|
||||
my $poname = &get_single ($session, "1.3.6.1.4.1.23.2.38.1.1.1.2.$pos"); # poaPostOfficeName
|
||||
|
||||
# output to munin
|
||||
print "host_name $host
|
||||
graph_category $GRAPH_CATEGORY
|
||||
graph_args --base 1000
|
||||
graph_period $GRAPH_PERIOD
|
||||
graph_title GWPOA load ($poname)
|
||||
graph_info Shows per minute activity of the Groupwise PostOfficeAgent (GWPOA), here: $poname.<br />
|
||||
graph_vlabel $GRAPH_VLABEL
|
||||
total_msgs.label $TOTAL_LABEL
|
||||
total_msgs.info poaTotalMsgs
|
||||
total_msgs.type DERIVE
|
||||
total_msgs.min 0
|
||||
total_msgs.draw LINE2
|
||||
total_msgs.graph yes
|
||||
problem_msgs.label $PROBLEM_LABEL
|
||||
problem_msgs.info poaProblemMsgs
|
||||
problem_msgs.type DERIVE
|
||||
problem_msgs.min 0
|
||||
problem_msgs.draw LINE2
|
||||
problem_msgs.graph yes
|
||||
undeliverable_msgs.label $UNDELIVERABLE_LABEL
|
||||
undeliverable_msgs.info poaUndeliverableMsgs
|
||||
undeliverable_msgs.type DERIVE
|
||||
undeliverable_msgs.min 0
|
||||
undeliverable_msgs.draw LINE2
|
||||
undeliverable_msgs.graph yes
|
||||
errors.label $ERRORS_LABEL
|
||||
errors.info poaAdmErrorMsgs
|
||||
errors.critical $ERRORS_CRITICAL
|
||||
errors.type DERIVE
|
||||
errors.min 0
|
||||
errors.draw LINE2
|
||||
errors_out.graph yes";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
# fetch the data and print
|
||||
print "total_msgs.value ", &get_single ($session, "1.3.6.1.4.1.23.2.38.1.1.1.3.$pos"), "\n"; # poaTotalMsgs
|
||||
print "problem_msgs.value ", &get_single ($session, "1.3.6.1.4.1.23.2.38.1.1.1.4.$pos"), "\n"; # poaProblemMsgs
|
||||
print "undeliverable_msgs.value ", &get_single ($session, "1.3.6.1.4.1.23.2.38.1.1.1.8.$pos"), "\n"; # poaUndeliverableMsgs
|
||||
print "errors.value ", &get_single ($session, "1.3.6.1.4.1.23.2.38.1.1.1.27.$pos"), "\n"; # poaAdmErrorMsgs
|
||||
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my $handle = shift;
|
||||
my $oid = shift;
|
||||
|
||||
print "# Getting single $oid...\n" if $DEBUG;
|
||||
|
||||
$response = $handle->get_request ($oid);
|
||||
|
||||
if (!defined $response->{$oid})
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $response->{$oid};
|
||||
}
|
||||
}
|
||||
|
138
plugins/snmp/snmp__hp_temp
Executable file
138
plugins/snmp/snmp__hp_temp
Executable file
|
@ -0,0 +1,138 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2006 Lars Strand
|
||||
#
|
||||
# Munin-plugin to monitor temperature on HP-servers.
|
||||
# Uses SNMP, and needs hpasmd.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
#
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
my $MAXLABEL = 20;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
# Taken from CPQHLTH-MIB.mib
|
||||
my %locations = (
|
||||
1 => "other",
|
||||
2 => "unknown",
|
||||
3 => "system",
|
||||
4 => "systemBoard",
|
||||
5 => "ioBoard",
|
||||
6 => "cpu",
|
||||
7 => "memory",
|
||||
8 => "storage",
|
||||
9 => "removableMedia",
|
||||
10 => "powerSupply",
|
||||
11 => "ambient",
|
||||
12 => "chassis",
|
||||
13 => "bridgeCard"
|
||||
);
|
||||
|
||||
#my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "index 1.3.6.1.4.1.232.6.2.6.8.1.\n";
|
||||
print "require 1.3.6.1.4.1.232.6.2.6.8.1.4.1.1. [1-4]\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_HP_temp$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
# Sensor locations
|
||||
my $cpqHeTemperatureLocale = "1.3.6.1.4.1.232.6.2.6.8.1.3.1.";
|
||||
|
||||
# Temperatures
|
||||
my $cpqHeTemperatureCelsius = "1.3.6.1.4.1.232.6.2.6.8.1.4.1.";
|
||||
|
||||
# Temperatures thresholds
|
||||
my $cpqHeTemperatureThreshold = "1.3.6.1.4.1.232.6.2.6.8.1.5.1.";
|
||||
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session)) {
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
# Fetch the values.
|
||||
my $temp_locales = $session->get_table($cpqHeTemperatureLocale);
|
||||
|
||||
if (!defined ($temp_locales)) {
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
my @i = ();
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
#print "host_name $host\n";
|
||||
print "graph_title Temperature (in C)\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_args --upper-limit 100 -l 0\n";
|
||||
print "graph_vlabel C\n";
|
||||
print "graph_info This graph shows the temperatures on a HP server.\n";
|
||||
|
||||
while (my ($oid, $loc_id) = each (%$temp_locales)) {
|
||||
@i = split(/\./, $oid);
|
||||
my $t = $session->get_request($cpqHeTemperatureThreshold . $i[-1]);
|
||||
while (my ($ooid, $threshold) = each(%$t)) {
|
||||
print "$locations{$loc_id}$i[-1].label $locations{$loc_id}\n";
|
||||
print "$locations{$loc_id}$i[-1].info Temperature sensor on $locations{$loc_id}\n";
|
||||
print "$locations{$loc_id}$i[-1].critical $threshold\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Fetch values
|
||||
while (my ($oid, $loc_id) = each (%$temp_locales)) {
|
||||
@i = split(/\./, $oid);
|
||||
my $t = $session->get_request($cpqHeTemperatureCelsius . $i[-1]);
|
||||
while (my ($ooid, $temperature) = each(%$t)) {
|
||||
print "$locations{$loc_id}$i[-1].value $temperature\n";
|
||||
}
|
||||
}
|
||||
|
170
plugins/snmp/snmp__if_
Executable file
170
plugins/snmp/snmp__if_
Executable file
|
@ -0,0 +1,170 @@
|
|||
#!/usr/bin/perl -w
|
||||
##
|
||||
## Copyright (C) 2007 OZ
|
||||
##
|
||||
## interface-traffic including warnlevels, based on snmp__if_.
|
||||
##
|
||||
## supports entries for maximum bitrates in
|
||||
## /etc/munin/plugin-conf.d/munin-node like:
|
||||
## [snmp_<hostname>_if_*]
|
||||
## env.levelwarn 800000
|
||||
## env.levelcrit 1000000
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU General Public License
|
||||
## as published by the Free Software Foundation; version 2 dated June,
|
||||
## 1991.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
|
||||
## Revision 0.1 2007/01/18 15:00:00 oz
|
||||
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $iface = $ENV{interface} || undef;
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "number 1.3.6.1.2.1.2.1.0\n";
|
||||
print "index 1.3.6.1.2.1.2.2.1.1.\n";
|
||||
print "require 1.3.6.1.2.1.2.2.1.3. ^(6|23)\$\n"; # Type
|
||||
print "require 1.3.6.1.2.1.2.2.1.5. [1-9]\n"; # Speed
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_if_(.+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$iface = $2;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1 -- $2\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $ifEntryDescr = "1.3.6.1.2.1.2.2.1.2.$iface";
|
||||
my $ifEntrySpeed = "1.3.6.1.2.1.2.2.1.5.$iface";
|
||||
my $ifEntryStatus = "1.3.6.1.2.1.2.2.1.8.$iface";
|
||||
my $ifEntryInOctets = "1.3.6.1.2.1.2.2.1.10.$iface";
|
||||
my $ifEntryOutOctets = "1.3.6.1.2.1.2.2.1.16.$iface";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
if (!defined ($response = $session->get_request($ifEntryDescr)))
|
||||
{
|
||||
die "Croaking: " . $session->error();
|
||||
}
|
||||
my $name = $response->{$ifEntryDescr};
|
||||
$name =~ s/[^\w\s]//g;
|
||||
my $warn = undef;
|
||||
if (defined ($response = $session->get_request($ifEntrySpeed)))
|
||||
{
|
||||
$warn = $response->{$ifEntrySpeed}/8;
|
||||
}
|
||||
my $levelwarn=undef;
|
||||
$levelwarn=$ENV{levelwarn} if defined($ENV{levelwarn});
|
||||
my $levelcrit=undef;
|
||||
$levelcrit=$ENV{levelcrit} if defined($ENV{levelcrit});
|
||||
if (length ($name) > 15)
|
||||
{
|
||||
print "graph_title Interface $iface traffic\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "graph_title Interface $name traffic\n";
|
||||
}
|
||||
print "graph_order recv send\n";
|
||||
print "graph_args --base 1000\n";
|
||||
print "graph_vlabel bits in (-) / out (+) per \${graph_period}\n";
|
||||
print "graph_category network\n";
|
||||
print "graph_info This graph shows traffic for the \"$name\" network interface.\n";
|
||||
print "send.info Bits sent/received by this interface.\n";
|
||||
print "recv.label recv\n";
|
||||
print "recv.type DERIVE\n";
|
||||
print "recv.graph no\n";
|
||||
print "recv.cdef recv,8,*\n";
|
||||
print "recv.max 2000000000\n";
|
||||
print "recv.min 0\n";
|
||||
print "recv.warn ", (-$warn), "\n" if defined $warn;
|
||||
print "recv.warning $levelwarn\n" if defined $levelwarn;
|
||||
print "recv.critical $levelcrit\n" if defined $levelcrit;
|
||||
print "send.label bps\n";
|
||||
print "send.type DERIVE\n";
|
||||
print "send.negative recv\n";
|
||||
print "send.cdef send,8,*\n";
|
||||
print "send.max 2000000000\n";
|
||||
print "send.min 0\n";
|
||||
print "send.warn $warn\n" if defined $warn;
|
||||
print "send.warning $levelwarn\n" if defined $levelwarn;
|
||||
print "send.critical $levelcrit\n" if defined $levelcrit;
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $status = 1;
|
||||
if (defined ($response = $session->get_request($ifEntryStatus)))
|
||||
{
|
||||
$status = $response->{$ifEntryStatus};
|
||||
}
|
||||
|
||||
if ($status == 2)
|
||||
{
|
||||
print "recv.value U\n";
|
||||
print "send.value U\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($ifEntryInOctets)))
|
||||
{
|
||||
print "recv.value ", $response->{$ifEntryInOctets}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "recv.value U\n";
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($ifEntryOutOctets)))
|
||||
{
|
||||
print "send.value ", $response->{$ifEntryOutOctets}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "send.value U\n";
|
||||
}
|
164
plugins/snmp/snmp__ifx_
Executable file
164
plugins/snmp/snmp__ifx_
Executable file
|
@ -0,0 +1,164 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2008 François Borlet-Hote
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
# Based on snmp_if from the Revision 1.18 2004/12/10 18:51:43 by jimmyo
|
||||
#
|
||||
# Revision 1.0 2008/05/29 16:10:00 fbh
|
||||
# Created by fbh
|
||||
#
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $iface = $ENV{interface} || undef;
|
||||
my $version = $ENV{version} || "2c";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "number 1.3.6.1.2.1.2.1.0\n";
|
||||
print "index 1.3.6.1.2.1.2.2.1.1.\n";
|
||||
print "require 1.3.6.1.2.1.2.2.1.3. ^(6|23)\$\n"; # Type
|
||||
print "require 1.3.6.1.2.1.2.2.1.5. [1-9]\n"; # Speed
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_ifX_(.+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$iface = $2;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1 -- $2\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $ifEntryDescr = "1.3.6.1.2.1.2.2.1.2.$iface";
|
||||
my $ifEntrySpeed = "1.3.6.1.2.1.2.2.1.5.$iface";
|
||||
my $ifEntryStatus = "1.3.6.1.2.1.2.2.1.8.$iface";
|
||||
my $ifEntryInOctets = "1.3.6.1.2.1.31.1.1.1.6.$iface";
|
||||
my $ifEntryOutOctets = "1.3.6.1.2.1.31.1.1.1.10.$iface";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port,
|
||||
-version => $version
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
if (!defined ($response = $session->get_request($ifEntryDescr)))
|
||||
{
|
||||
die "Croaking: " . $session->error();
|
||||
}
|
||||
my $name = $response->{$ifEntryDescr};
|
||||
$name =~ s/[^\w\s]//g;
|
||||
my $warn = undef;
|
||||
my $max = 1000000000;
|
||||
if (defined ($response = $session->get_request($ifEntrySpeed)))
|
||||
{
|
||||
$max = $response->{$ifEntrySpeed};
|
||||
$warn = $response->{$ifEntrySpeed}*0.8;
|
||||
}
|
||||
if (length ($name) > 15)
|
||||
{
|
||||
print "graph_title Interface $iface traffic\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "graph_title Interface $name traffic\n";
|
||||
}
|
||||
|
||||
print "graph_order recv send\n";
|
||||
print "graph_args --base 1000\n";
|
||||
print "graph_vlabel bits in (-) / out (+) per \${graph_period}\n";
|
||||
print "graph_category network\n";
|
||||
print "graph_info This graph shows traffic for the \"$name\" network interface.\n";
|
||||
print "send.info Bits sent/received by this interface.\n";
|
||||
print "recv.label recv\n";
|
||||
print "recv.type DERIVE\n";
|
||||
print "recv.graph no\n";
|
||||
print "recv.cdef recv,8,*\n";
|
||||
print "recv.max ",$max,"\n";
|
||||
print "recv.min 0\n";
|
||||
print "recv.warn ", (-$warn), "\n" if defined $warn;
|
||||
print "send.label bps\n";
|
||||
print "send.type DERIVE\n";
|
||||
print "send.negative recv\n";
|
||||
print "send.cdef send,8,*\n";
|
||||
print "send.max ",$max,"\n";
|
||||
print "send.min 0\n";
|
||||
print "send.warn $warn\n" if defined $warn;
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $status = 1;
|
||||
if (defined ($response = $session->get_request($ifEntryStatus)))
|
||||
{
|
||||
$status = $response->{$ifEntryStatus};
|
||||
}
|
||||
|
||||
if ($status == 2)
|
||||
{
|
||||
print "recv.value U\n";
|
||||
print "send.value U\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($ifEntryInOctets)))
|
||||
{
|
||||
print "recv.value ", $response->{$ifEntryInOctets}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "recv.value U\n";
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($ifEntryOutOctets)))
|
||||
{
|
||||
print "send.value ", $response->{$ifEntryOutOctets}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "send.value U\n";
|
||||
}
|
445
plugins/snmp/snmp__ipoman_
Executable file
445
plugins/snmp/snmp__ipoman_
Executable file
|
@ -0,0 +1,445 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# What is snmp__ipoman_
|
||||
# ----------------------
|
||||
# snmp__ipoman is a munin plugin written for the Ingrasys IpomanII 1202
|
||||
# Power Distribution Unit. It should work on any PDU conforming to
|
||||
# the IPOMANII-MIB.
|
||||
#
|
||||
# How do I use it
|
||||
# ---------------
|
||||
# You can use this plugin on a system with a working munin-node. Here's
|
||||
# how:
|
||||
#
|
||||
# 1. Copy snmp__ipoman_ to the directory where all your munin plugins
|
||||
# reside, for example /usr/share/munin/plugins.
|
||||
#
|
||||
# 2. Make the following symlinks to snmp__ipoman_ in that same directory
|
||||
#
|
||||
# snmp__ipoman_inletcurrent_
|
||||
# snmp__ipoman_inletpower_
|
||||
# snmp__ipoman_inletvoltage_
|
||||
# snmp__ipoman_outletpower_
|
||||
# snmp__ipoman_outletcurrent_
|
||||
#
|
||||
# (If you wonder why. I did not manage to make a plugin which has both
|
||||
# the 'snmpconf' and the 'suggest' capabilities. So either I had to make
|
||||
# separate plugins for all graph types, or I would have to make
|
||||
# assumptions on the number of ports and the address of the ipoman in
|
||||
# the script.)
|
||||
#
|
||||
# 3. Change to the directory where the links to munin plugins reside
|
||||
# that are to be run by munin-node, for example /etc/munin/plugins/
|
||||
#
|
||||
# 4. Run munin-node-configure-snmp:
|
||||
#
|
||||
# $ munin-node-configure-snmp --snmpversion=1 <hostname> | sh -x
|
||||
#
|
||||
# where <hostname> is the hostname or ip address of your ipoman. This
|
||||
# will create and print a bunch of symlinks to snmp__ipoman_ which will
|
||||
# output current and power usage for all available outlets of the
|
||||
# ipoman, and current, power usage and voltage/frequency on all inlets
|
||||
# of the ipoman.
|
||||
#
|
||||
# 5. Restart munin-node
|
||||
#
|
||||
# 6. Make an entry in your munin server's munin.conf:
|
||||
#
|
||||
# [<hostname of ipoman as entered in 4.>]
|
||||
# address <address of munin-node>
|
||||
# use_node_name no
|
||||
#
|
||||
# 7. Done.
|
||||
#
|
||||
# Copyright (C) 2009 Rien Broekstra <rien@rename-it.nl>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# Munin plugin to monitor power consumption and current of the sockets of an
|
||||
# Ingrasys IpomanII 1202 Power Distribution Unit, or any power distribution
|
||||
# unit that conforms to IPOMANII-MIB via SNMP.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config
|
||||
# snmpconf
|
||||
#
|
||||
# Relevant OID's under .iso.org.dod.internet.private.enterprises.ingrasys.product.pduAgent.iPoManII
|
||||
# .ipmObjects.ipmDevice.ipmDeviceOutlet.ipmDeviceOutletNumber.0
|
||||
# .ipmObjects.ipmDevice.ipmDeviceOutlet.ipmDeviceOutletStatusTable.ipmDeviceOutletStatusEntry.outletStatusIndex.1
|
||||
# .ipmObjects.ipmDevice.ipmDeviceOutlet.ipmDeviceOutletStatusTable.ipmDeviceOutletStatusEntry.outletStatusCurrent.1
|
||||
# .ipmObjects.ipmDevice.ipmDeviceOutlet.ipmDeviceOutletStatusTable.ipmDeviceOutletStatusEntry.outletStatusKwatt.1
|
||||
# .ipmObjects.ipmDevice.ipmDeviceOutlet.ipmDeviceOutletStatusTable.ipmDeviceOutletStatusEntry.outletStatusWH.1
|
||||
#
|
||||
# Version 0.1, Aug 4, 2009
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# MAGIC MARKERS:
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $iface = $ENV{interface} || undef;
|
||||
|
||||
my $socketnumber;
|
||||
my $response;
|
||||
my $graphtype;
|
||||
|
||||
#
|
||||
# Infer host, inlet/socketnumber and graphtype from the symlink name to this plugin.
|
||||
#
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]*)_ipoman_([^_]*)_(.*)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$graphtype = $2;
|
||||
$socketnumber = $3;
|
||||
if ($host =~ /^([^:]+):(\d+)$/) {
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined($graphtype)) {
|
||||
die "# Error: couldn't understand what quantity I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
#
|
||||
# The relevant OID's on the IPOMAN
|
||||
#
|
||||
my $oid_inletnumber = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.1.0";
|
||||
my $oid_inletindextable = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.2.1.1.";
|
||||
my $oid_inletvoltage = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.2.";
|
||||
my $oid_inletcurrent = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.3.";
|
||||
my $oid_inletfrequency = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.4.";
|
||||
my $oid_inletenergy = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.5.";
|
||||
|
||||
my $oid_outletnumber = ".1.3.6.1.4.1.2468.1.4.2.1.3.2.1.0";
|
||||
my $oid_outletindextable = ".1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.1.";
|
||||
my $oid_outletdescription = ".1.3.6.1.4.1.2468.1.4.2.1.3.2.2.1.2.";
|
||||
my $oid_outletcurrent = ".1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.3.";
|
||||
my $oid_outletenergy = ".1.3.6.1.4.1.2468.1.4.2.1.3.2.3.1.4.";
|
||||
# FIXME: The voltage is not defined per outlet. For now we just assume that all sockets have the voltage on inlet 1.
|
||||
my $oid_outletvoltage = ".1.3.6.1.4.1.2468.1.4.2.1.3.1.3.1.2.1";
|
||||
|
||||
#
|
||||
# The snmpconf section prints out what oid's we need for the quantity we want to monitor, and where we find out how many ports the device has.
|
||||
#
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
|
||||
if ($graphtype eq "inletvoltage") {
|
||||
print "number $oid_inletnumber\n";
|
||||
print "index $oid_inletindextable\n";
|
||||
print "require $oid_inletvoltage [0-9]+\n";
|
||||
print "require $oid_inletfrequency [0-9]+\n";
|
||||
}
|
||||
elsif ($graphtype eq "inletcurrent") {
|
||||
print "number $oid_inletnumber\n";
|
||||
print "index $oid_inletindextable\n";
|
||||
print "require $oid_inletcurrent [0-9]+\n";
|
||||
}
|
||||
elsif ($graphtype eq "inletpower") {
|
||||
print "number $oid_inletnumber\n";
|
||||
print "index $oid_inletindextable\n";
|
||||
print "require $oid_inletvoltage [0-9]+\n";
|
||||
print "require $oid_inletcurrent [0-9]+\n";
|
||||
}
|
||||
elsif ($graphtype eq "outletcurrent") {
|
||||
print "number $oid_outletnumber\n";
|
||||
print "index $oid_outletindextable\n";
|
||||
print "require $oid_outletcurrent [0-9]+\n";
|
||||
}
|
||||
elsif ($graphtype eq "outletpower") {
|
||||
print "number $oid_outletnumber\n";
|
||||
print "index $oid_outletindextable\n";
|
||||
print "require $oid_outletvoltage [0-9]+\n";
|
||||
print "require $oid_outletcurrent [0-9]+\n";
|
||||
}
|
||||
else {
|
||||
print "require dont.graph.anything [0-9]+\n"
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
#
|
||||
# For all other options we need to connect to the host in our $0. if we cannot, bail out.
|
||||
#
|
||||
if (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1 -- $2\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
#
|
||||
# Output graph configuration depending on what quantity we want to plot
|
||||
#
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
print "host_name $host\n";
|
||||
if ($graphtype eq "inletvoltage") {
|
||||
|
||||
print "graph_title Inlet $socketnumber voltage/frequency\n";
|
||||
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_info This graph shows the tension and frequency to inlet $socketnumber on the Power Distribution Unit\n";
|
||||
|
||||
print "voltage.label Tension (V)\n";
|
||||
print "voltage.draw LINE2\n";
|
||||
print "voltage.type GAUGE\n";
|
||||
|
||||
print "frequency.label Frequency (Hz)\n";
|
||||
print "frequency.draw LINE2\n";
|
||||
print "frequency.type GAUGE\n";
|
||||
|
||||
}
|
||||
elsif ($graphtype eq "inletcurrent") {
|
||||
print "graph_title Inlet $socketnumber current\n";
|
||||
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_info This graph shows the delivered current to inlet $socketnumber on the Power Distribution Unit\n";
|
||||
|
||||
print "current.label Current (A)\n";
|
||||
print "current.draw AREA\n";
|
||||
print "current.type GAUGE\n";
|
||||
|
||||
}
|
||||
elsif ($graphtype eq "inletpower") {
|
||||
print "graph_title Inlet $socketnumber power\n";
|
||||
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_info This graph shows the delivered apparent and real power to inlet $socketnumber of the Power Distribution Unit\n";
|
||||
|
||||
print "apparentpower.label Apparent power (kVA)\n";
|
||||
print "apparentpower.draw LINE3\n";
|
||||
print "apparentpower.type GAUGE\n";
|
||||
|
||||
print "realpower.label Real power (kW)\n";
|
||||
print "realpower.draw AREA\n";
|
||||
print "realpower.type COUNTER\n";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
elsif ($graphtype eq "outletcurrent") {
|
||||
print "graph_title Outlet $socketnumber current\n";
|
||||
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_info This graph shows the delivered current to outlet $socketnumber of the Power Distribution Unit\n";
|
||||
|
||||
print "current.label Delivered current (A)\n";
|
||||
print "current.draw AREA\n";
|
||||
print "current.type GAUGE\n";
|
||||
}
|
||||
elsif ($graphtype eq "outletpower") {
|
||||
print "graph_title Outlet $socketnumber power\n";
|
||||
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_info This graph shows the delivered apparent and real power to outlet $socketnumber of the Power Distribution Unit\n";
|
||||
|
||||
print "apparentpower.label Apparent power (kVA)\n";
|
||||
print "apparentpower.draw LINE3\n";
|
||||
print "apparentpower.type GAUGE\n";
|
||||
|
||||
print "realpower.label Real power (kW)\n";
|
||||
print "realpower.draw AREA\n";
|
||||
print "realpower.type COUNTER\n";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($graphtype eq "inletvoltage") {
|
||||
my ($voltage, $frequency);
|
||||
|
||||
if (defined ($response = $session->get_request($oid_inletvoltage.$socketnumber))) {
|
||||
$voltage = $response->{$oid_inletvoltage.$socketnumber};
|
||||
}
|
||||
else {
|
||||
$voltage = 'U';
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($oid_inletfrequency.$socketnumber))) {
|
||||
$frequency = $response->{$oid_inletfrequency.$socketnumber};
|
||||
}
|
||||
else {
|
||||
$frequency = 'U';
|
||||
}
|
||||
|
||||
# The IPOMAN returns tension in 0.1V units.
|
||||
# Convert to V
|
||||
if ($voltage ne 'U') {
|
||||
$voltage = $voltage/10;
|
||||
}
|
||||
|
||||
# The IPOMAN returns frequency in 0.1Hz units.
|
||||
# Convert to Hz
|
||||
if ($frequency ne 'U') {
|
||||
$frequency = $frequency/10;
|
||||
}
|
||||
|
||||
print "voltage.value ", $voltage, "\n";
|
||||
print "frequency.value ", $frequency, "\n";
|
||||
}
|
||||
elsif ($graphtype eq "inletcurrent") {
|
||||
my $current;
|
||||
|
||||
if (defined ($response = $session->get_request($oid_inletcurrent.$socketnumber))) {
|
||||
$current = $response->{$oid_inletcurrent.$socketnumber};
|
||||
}
|
||||
else {
|
||||
$current = 'U';
|
||||
}
|
||||
|
||||
# The IPOMAN returns power in mA.
|
||||
# Convert to A:
|
||||
#
|
||||
if ($current ne 'U') {
|
||||
$current = $current/1000;
|
||||
}
|
||||
|
||||
print "current.value ", $current, "\n";
|
||||
}
|
||||
elsif ($graphtype eq "inletpower") {
|
||||
my ($current, $energy, $voltage, $apparentpower);
|
||||
|
||||
if (defined ($response = $session->get_request($oid_inletcurrent.$socketnumber))) {
|
||||
$current = $response->{$oid_inletcurrent.$socketnumber};
|
||||
}
|
||||
else {
|
||||
$current = 'U';
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($oid_inletenergy.$socketnumber))) {
|
||||
$energy = $response->{$oid_inletenergy.$socketnumber};
|
||||
}
|
||||
else {
|
||||
$energy = 'U';
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($oid_inletvoltage.$socketnumber))) {
|
||||
$voltage = $response->{$oid_inletvoltage.$socketnumber};
|
||||
}
|
||||
else {
|
||||
$voltage = 'U';
|
||||
}
|
||||
|
||||
# Calculate results
|
||||
# Apparent power (VA)= Voltage (V)* Current(A).
|
||||
# IPOMAN delivers voltage in units of 0.1V. and current in units of mA:
|
||||
if ($current ne 'U' && $voltage ne 'U') {
|
||||
$apparentpower = ($current/1000)*($voltage/10);
|
||||
}
|
||||
|
||||
#
|
||||
# The IPOMAN returns consumed energy in Wh. We want it in J (= Ws), in order for munin to graph in W.
|
||||
#
|
||||
if ($energy ne 'U') {
|
||||
$energy = $energy*3600;
|
||||
}
|
||||
|
||||
print "realpower.value ", $energy, "\n";
|
||||
print "apparentpower.value ", $apparentpower, "\n";
|
||||
}
|
||||
elsif ($graphtype eq "outletcurrent") {
|
||||
my $current;
|
||||
|
||||
if (defined ($response = $session->get_request($oid_outletcurrent.$socketnumber))) {
|
||||
$current = $response->{$oid_outletcurrent.$socketnumber};
|
||||
}
|
||||
else {
|
||||
$current = 'U';
|
||||
}
|
||||
|
||||
# The IPOMAN returns power in mA.
|
||||
# Convert to A:
|
||||
#
|
||||
if ($current ne 'U') {
|
||||
$current = $current/1000;
|
||||
}
|
||||
|
||||
print "current.value ", $current, "\n";
|
||||
}
|
||||
elsif ($graphtype eq "outletpower") {
|
||||
my ($current, $energy, $voltage, $apparentpower);
|
||||
|
||||
if (defined ($response = $session->get_request($oid_outletcurrent.$socketnumber))) {
|
||||
$current = $response->{$oid_outletcurrent.$socketnumber};
|
||||
}
|
||||
else {
|
||||
$current = 'U';
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($oid_outletenergy.$socketnumber))) {
|
||||
$energy = $response->{$oid_outletenergy.$socketnumber};
|
||||
}
|
||||
else {
|
||||
$energy = 'U';
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($oid_outletvoltage))) {
|
||||
$voltage = $response->{$oid_outletvoltage};
|
||||
}
|
||||
else {
|
||||
$voltage = 'U';
|
||||
}
|
||||
|
||||
#
|
||||
# Calculate results
|
||||
# Apparent power (VA)= Voltage (V)* Current(A).
|
||||
# IPOMAN delivers voltage in units of 0.1V. and current in units of mA:
|
||||
if ($current ne 'U' && $voltage ne 'U') {
|
||||
$apparentpower = ($current/1000)*($voltage/10);
|
||||
}
|
||||
|
||||
#
|
||||
# The IPOMAN returns consumed energy in Wh. We want it in J (= Ws), in order for munin to graph in W.
|
||||
#
|
||||
if ($energy ne 'U') {
|
||||
$energy = $energy*3600;
|
||||
}
|
||||
|
||||
print "realpower.value ", $energy, "\n";
|
||||
print "apparentpower.value ", $apparentpower, "\n";
|
||||
}
|
||||
exit 0;
|
114
plugins/snmp/snmp__linksys_poe
Executable file
114
plugins/snmp/snmp__linksys_poe
Executable file
|
@ -0,0 +1,114 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
"
|
||||
=head1 NAME
|
||||
|
||||
snmp__linksys_poe - Munin plugin to monitor the current supplied by Linksys PoE
|
||||
switches.
|
||||
|
||||
Requires ruby and the ruby SNMP library.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
I wrote this to query SRW2008MP switches and determined the OIDs by trial and
|
||||
error. There may be other Linksys devices that this will also work for.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
This plugin defaults to SNMP version 2c and a community string of 'public'. The
|
||||
defaults can be overridden in the usual way:
|
||||
|
||||
[snmp_*]
|
||||
env.version 1
|
||||
env.community private
|
||||
|
||||
SNMP version 3 is not supported.
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin simply reports the current being supplied on each of the device's
|
||||
PoE ports.
|
||||
|
||||
=head1 MIB INFORMATION
|
||||
|
||||
Information is gathered from Linksys' private MIB space, so it's probably only
|
||||
applicable to Linksys devices. I have been unable to get an actual copy of
|
||||
the appropriate MIB, so I don't know the actual names of the values I'm
|
||||
retrieving.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=snmpauto contrib
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.0
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None known.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Written by Phil Gold <phil_g@pobox.com>.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
|
||||
|
||||
To the extent possible under law, all copyright and related or neighboring
|
||||
rights to this plugin are waived. Do with it as you wish.
|
||||
|
||||
=cut
|
||||
"
|
||||
|
||||
require 'snmp'
|
||||
|
||||
idx_oid = "enterprises.3955.89.108.1.1.2"
|
||||
max_oid = "enterprises.3955.89.108.1.1.6"
|
||||
cur_oid = "enterprises.3955.89.108.1.1.5"
|
||||
|
||||
community = ENV['community'] || "public"
|
||||
version = ENV['version'] == '1' ? :SNMPv1 : :SNMPv2c
|
||||
|
||||
case ARGV[0]
|
||||
when "autoconf"
|
||||
puts "no"
|
||||
exit 1
|
||||
when "snmpconf"
|
||||
puts "require 1.3.6.1.4.1.3955.89.108.1.1.2.1. [0-9]"
|
||||
puts "require 1.3.6.1.4.1.3955.89.108.1.1.5.1. [0-9]"
|
||||
puts "require 1.3.6.1.4.1.3955.89.108.1.1.6.1. [0-9]"
|
||||
exit 0;
|
||||
when "config"
|
||||
host = $0.match('^(?:|.*\/)snmp_([^_]+)')[1]
|
||||
puts "host_name #{host}"
|
||||
puts "graph_title PoE Power Usage"
|
||||
puts "graph_vlabel Watts"
|
||||
puts "graph_category sensors"
|
||||
max_current = 0
|
||||
SNMP::Manager.open(:Host => host,
|
||||
:Community => community,
|
||||
:Version => version) do |manager|
|
||||
manager.walk([idx_oid, max_oid]) do |row|
|
||||
puts "iface_#{row[0].value}.label Port #{row[0].value}"
|
||||
puts "iface_#{row[0].value}.cdef iface_#{row[0].value},1000,/"
|
||||
puts "iface_#{row[0].value}.line #{row[1].value.to_f / 1000}"
|
||||
if row[1].value > max_current
|
||||
max_current = row[1].value
|
||||
end
|
||||
end
|
||||
end
|
||||
puts "graph_args --upper-limit #{max_current.to_f / 1000}"
|
||||
exit 0
|
||||
else
|
||||
host = $0.match('^(?:|.*\/)snmp_([^_]+)')[1]
|
||||
SNMP::Manager.open(:Host => host,
|
||||
:Community => community,
|
||||
:Version => version) do |manager|
|
||||
manager.walk([idx_oid, cur_oid]) do |row|
|
||||
puts "iface_#{row[0].value}.value #{row[1].value}"
|
||||
end
|
||||
end
|
||||
end
|
109
plugins/snmp/snmp__memory_openwrt
Executable file
109
plugins/snmp/snmp__memory_openwrt
Executable file
|
@ -0,0 +1,109 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2008 J.M.Roth
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
# Inspired by snmp__processes
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $iface = $ENV{interface} || undef;
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.2.1.25.2.3.1.5.2\n"; # Number
|
||||
print "require 1.3.6.1.2.1.25.2.3.1.6.2\n"; # Number
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my @split_result = split(/_/, $0);
|
||||
$host = $split_result[1];
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
if ($host eq '' || !defined $host)
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
print "graph_title Memory usage
|
||||
graph_args --base 1000 -l 0
|
||||
graph_vlabel kB
|
||||
graph_category system
|
||||
graph_info This graph shows total and used memory on the host.
|
||||
memsize.label total
|
||||
memused.label used
|
||||
memsize.info The total memory.
|
||||
memused.info The memory in use.
|
||||
memsize.draw LINE1
|
||||
memused.draw LINE2
|
||||
";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
print "memsize.value ", &get_single ($session, "1.3.6.1.2.1.25.2.3.1.5.2"), "\n";
|
||||
print "memused.value ", &get_single ($session, "1.3.6.1.2.1.25.2.3.1.6.2"), "\n";
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my $handle = shift;
|
||||
my $oid = shift;
|
||||
|
||||
print "# Getting single $oid...\n" if $DEBUG;
|
||||
|
||||
$response = $handle->get_request ($oid);
|
||||
|
||||
if (!defined $response->{$oid})
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $response->{$oid};
|
||||
}
|
||||
}
|
266
plugins/snmp/snmp__memory_win
Executable file
266
plugins/snmp/snmp__memory_win
Executable file
|
@ -0,0 +1,266 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2004 Jimmy Olsen
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.10 2004/11/16 20:08:26 jimmyo
|
||||
# License cleanups.
|
||||
#
|
||||
# Revision 1.9 2004/09/08 15:25:33 ilmari
|
||||
# Use /usr/bin/perl in all perl shebang lines.
|
||||
#
|
||||
# Revision 1.8 2004/09/07 13:19:22 ilmari
|
||||
# SNMP plugins now honour the "host" environment variable if they can't deduce the hostname from zsh.
|
||||
#
|
||||
# Revision 1.7 2004/09/07 12:58:41 ilmari
|
||||
# SNMP plugin "df" properly strips the label and serial number fromWindows drive labels.
|
||||
#
|
||||
# Revision 1.6 2004/09/05 12:00:18 jimmyo
|
||||
# Set family and capabilities.
|
||||
#
|
||||
# Revision 1.5 2004/09/04 21:58:28 jimmyo
|
||||
# Set category and info fields.
|
||||
#
|
||||
# Revision 1.4 2004/09/04 21:33:12 jimmyo
|
||||
# Handle strange characters better.
|
||||
#
|
||||
# Revision 1.3 2004/09/04 21:08:16 jimmyo
|
||||
# SNMP df plugin now talks Windowese.
|
||||
#
|
||||
# Revision 1.2 2004/09/03 22:56:51 jimmyo
|
||||
# Added support for SNMP probing.
|
||||
#
|
||||
# Revision 1.1 2004/04/29 22:29:57 jimmyo
|
||||
# New SNMP plugin for disk usage.
|
||||
#
|
||||
# Revision 1.3 2004/02/22 20:17:58 jimmyo
|
||||
# Typo fix
|
||||
#
|
||||
# Revision 1.2 2004/02/18 21:54:56 jimmyo
|
||||
# Did a bit of work on the snmp-thingie.
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.1 2003/12/19 20:53:45 jimmyo
|
||||
# Created by jo
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
my $MAXLABEL = 20;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $iface = $ENV{interface} || undef;
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "index 1.3.6.1.2.1.25.2.3.1.1.\n";
|
||||
print "index 1.3.6.1.2.1.25.5.1.1.2.\n";
|
||||
print "require 1.3.6.1.2.1.25.5.1.1.2. [1-9]\n";
|
||||
print "require 1.3.6.1.2.1.25.2.2.0\n"; # memsize
|
||||
print "require 1.3.6.1.2.1.25.2.3.1.2. 1.3.6.1.2.1.25.2.1.(2|3)\n"; # Type=fixed disk
|
||||
print "require 1.3.6.1.2.1.25.2.3.1.5. [1-9]\n"; # Size > 0
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_memory_win$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
# Disk level
|
||||
my $hrDeviceType = "1.3.6.1.2.1.25.3.2.1.2."; # Should be iso.3.6.1.2.1.25.3.1.6 (DiskStorage)
|
||||
my $hrDiskStorageRemoveble = "1.3.6.1.2.1.25.3.6.1.3."; # Should be false (2).
|
||||
# Windows reports 0.
|
||||
my $hrDiskStorageCapacity = "1.3.6.1.2.1.25.3.6.1.4."; # Should be more than 0
|
||||
|
||||
# Partition level
|
||||
my $hrPartitionFSIndex = "1.3.6.1.2.1.25.3.7.1.5."; # Should be more than 0
|
||||
my $hrFSMountPoint = "1.3.6.1.2.1.25.3.8.1.2."; # Used to look up filesystem
|
||||
|
||||
# Filesystem level
|
||||
my $hrStorageType = "1.3.6.1.2.1.25.2.3.1.2."; # Backup for hrFS*
|
||||
my $hrStorageDesc = "1.3.6.1.2.1.25.2.3.1.3."; # Used as key from partitions
|
||||
my $hrStorageSize = "1.3.6.1.2.1.25.2.3.1.5."; # Data point 1
|
||||
my $hrStorageUnit = "1.3.6.1.2.1.25.2.3.1.4."; # Data point 3
|
||||
my $hrStorageUsed = "1.3.6.1.2.1.25.2.3.1.6."; # Data point 2
|
||||
|
||||
# Memory
|
||||
my $hrSWRunPerfMem = "1.3.6.1.2.1.25.5.1.1.2.";
|
||||
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
my %partitions;
|
||||
my $stor_id;
|
||||
$stor_id = get_by_regex ($session, $hrStorageType, "1.3.6.1.2.1.25.2.1.(3|2)");
|
||||
%partitions = ();
|
||||
|
||||
foreach my $id (keys %$stor_id)
|
||||
{
|
||||
my $part = get_single ($session, $hrStorageDesc . $id);
|
||||
$partitions{$part}{storage} = $id;
|
||||
$partitions{$part}{extinfo} = $part;
|
||||
$stor_id->{$id} = $part;
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
print "graph_title Windows memory usage\n";
|
||||
print "graph_args -l 0 --base 1024\n";
|
||||
print "graph_vlabel Bytes\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_info This graph shows Windows memory usage in bytes.\n";
|
||||
|
||||
foreach my $part (keys %partitions)
|
||||
{
|
||||
print (&get_name_by_mp ($part), ".label $part Usage\n");
|
||||
# print (&get_name_by_mp ($part), ".warning 92\n");
|
||||
# print (&get_name_by_mp ($part), ".critical 98\n");
|
||||
print (&get_name_by_mp ($part) . "_s", ".label $part Size\n");
|
||||
print (&get_name_by_mp ($part) . "_s", ".graph no\n");
|
||||
}
|
||||
print "pused.label In use by programs\n";
|
||||
print "pused.draw AREA\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
foreach my $storage (keys %$stor_id)
|
||||
{
|
||||
$partitions{$stor_id->{$storage}}{storage} = $storage;
|
||||
$partitions{$stor_id->{$storage}}{size} = get_single ($session, $hrStorageSize . $storage);
|
||||
$partitions{$stor_id->{$storage}}{unit} = get_single ($session, $hrStorageUnit . $storage);
|
||||
$partitions{$stor_id->{$storage}}{used} = get_single ($session, $hrStorageUsed . $storage);
|
||||
}
|
||||
|
||||
foreach my $part (keys %partitions)
|
||||
{
|
||||
print (&get_name_by_mp ($part), ".value ", $partitions{$part}{used}*$partitions{$part}{unit}, "\n");
|
||||
print (&get_name_by_mp ($part) . "_s", ".value ", $partitions{$part}{size}*$partitions{$part}{unit}, "\n");
|
||||
}
|
||||
my $memsize = &get_single($session, "1.3.6.1.2.1.25.2.2.0") * 1024;
|
||||
my $processes = get_by_regex($session, $hrSWRunPerfMem, "[1-9]");
|
||||
# the values
|
||||
my $memtotal = 0;
|
||||
while (my ($pid, $mem) = each(%$processes)) {
|
||||
$memtotal += $mem;
|
||||
}
|
||||
$memtotal*=1024;
|
||||
printf "pused.value $memtotal\n";
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my $handle = shift;
|
||||
my $oid = shift;
|
||||
|
||||
print "# Getting single $oid..." if $DEBUG;
|
||||
|
||||
$response = $handle->get_request ($oid);
|
||||
|
||||
if (!defined $response->{$oid})
|
||||
{
|
||||
print "undef\n" if $DEBUG;
|
||||
return undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "\"$response->{$oid}\"\n" if $DEBUG;
|
||||
return $response->{$oid};
|
||||
}
|
||||
}
|
||||
|
||||
sub get_by_regex
|
||||
{
|
||||
my $handle = shift;
|
||||
my $oid = shift;
|
||||
my $regex = shift;
|
||||
my $result = {};
|
||||
my $num = 0;
|
||||
my $ret = $oid . "0";
|
||||
my $response;
|
||||
|
||||
print "# Starting browse of $oid...\n" if $DEBUG;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if ($num == 0)
|
||||
{
|
||||
print "# Checking for $ret...\n" if $DEBUG;
|
||||
$response = $handle->get_request ($ret);
|
||||
}
|
||||
if ($num or !defined $response)
|
||||
{
|
||||
print "# Checking for sibling of $ret...\n" if $DEBUG;
|
||||
$response = $handle->get_next_request ($ret);
|
||||
}
|
||||
if (!$response)
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
my @keys = keys %$response;
|
||||
$ret = $keys[0];
|
||||
print "# Analyzing $ret (compared to $oid)...\n" if $DEBUG;
|
||||
last unless ($ret =~ /^$oid/);
|
||||
$num++;
|
||||
next unless ($response->{$ret} =~ /$regex/);
|
||||
@keys = split (/\./, $ret);
|
||||
$result->{$keys[-1]} = ($1) ? $1 : $response->{$ret};
|
||||
print "# Index $num: ", $keys[-1], " (", $response->{$ret}, ")\n" if $DEBUG;
|
||||
};
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub get_name_by_mp
|
||||
{
|
||||
my $mp = shift;
|
||||
$mp =~ s/[^a-z0-9_]/_/gi;
|
||||
$mp =~ tr/A-Z/a-z/;
|
||||
return "p" . $mp;
|
||||
}
|
182
plugins/snmp/snmp__netapp_nfs3calls
Executable file
182
plugins/snmp/snmp__netapp_nfs3calls
Executable file
|
@ -0,0 +1,182 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
=head1 NAME
|
||||
|
||||
snmp__netapp_nfs3calls - Munin plugin to retrieve NFSv3 calls types
|
||||
stats from NetApp storage appliances.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
NFSv3 calls stats should be reported by any NetApp storage appliance
|
||||
with SNMP agent daemon activated. See na_snmp(8) for details.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
|
||||
For this reason, this plugin will use SNMPv2 by default, which is
|
||||
insecure because it doesn't encrypt the community string.
|
||||
|
||||
The following parameters will help you get this plugin working :
|
||||
|
||||
[snmp_*]
|
||||
env.community MyCommunity
|
||||
|
||||
If your community name is 'public', you should really worry about
|
||||
security and immediately reconfigure your appliance.
|
||||
|
||||
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin reports various NFSv3 calls by type. This can help you
|
||||
determine what calls types are killing your appliance under heavy
|
||||
loads.
|
||||
|
||||
=head1 MIB INFORMATION
|
||||
|
||||
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
|
||||
Network Appliance. It reports the content of the v3Calls OID.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
v1.0 - 06/19/2009 18:36:02 CEST
|
||||
Initial revision
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
This plugin is copyright (c) 2009 by Guillaume Blairon.
|
||||
|
||||
NetApp is a registered trademark and Network Appliance is a trademark
|
||||
of Network Appliance, Inc. in the U.S. and other countries.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
This plugin wasn't tested on many hardware. If you encounter bugs,
|
||||
please report any to Guillaume Blairon E<lt>L<g@yom.be>E<gt>.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2 or (at your option) any later version.
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Munin::Plugin::SNMP;
|
||||
use vars qw($DEBUG);
|
||||
|
||||
$DEBUG = $ENV{'MUNIN_DEBUG'};
|
||||
|
||||
my @palette =
|
||||
#Better colours from munin 1.3.x
|
||||
#Greens Blues Oranges Dk yel Dk blu Purple Lime Reds Gray
|
||||
qw(00CC00 0066B3 FF8000 FFCC00 330099 990099 CCFF00 FF0000 808080
|
||||
008F00 00487D B35A00 B38F00 6B006B 8FB300 B30000 BEBEBE
|
||||
80FF80 80C9FF FFC080 FFE680 AA80FF EE00CC FF8080
|
||||
666600 FFBFFF 00FFCC CC6699 999900);
|
||||
|
||||
my %oids = (
|
||||
nulls => 'NFSPROC3_NULL (Do Nothing)',
|
||||
getattrs => 'NFSPROC3_GETATTR (Get File Attributes)',
|
||||
setattrs => 'NFSPROC3_SETATTR (Set File Attributes)',
|
||||
lookups => 'NFSPROC3_LOOKUP (Lookup Filename)',
|
||||
accesss => 'NFSPROC3_ACCESS (Check Access Permission)',
|
||||
readlinks => 'NFSPROC3_READLINK (Read from Symbolic Link)',
|
||||
reads => 'NFSPROC3_READ (Read from File)',
|
||||
writes => 'NFSPROC3_WRITE (Write to File)',
|
||||
creates => 'NFSPROC3_CREATE (Create a File)',
|
||||
mkdirs => 'NFSPROC3_MKDIR (Create a Directory)',
|
||||
symlinks => 'NFSPROC3_SYMLINK (Create a Symbolic Link)',
|
||||
mknods => 'NFSPROC3_MKNOD (Create a Special Device)',
|
||||
removes => 'NFSPROC3_REMOVE (Remove a File)',
|
||||
rmdirs => 'NFSPROC3_RMDIR (Remove a Directory)',
|
||||
renames => 'NFSPROC3_RENAME (Rename a File or Directory)',
|
||||
links => 'NFSPROC3_LINK (Create Link to an Object)',
|
||||
readdirs => 'NFSPROC3_READDIR (Read from Directory)',
|
||||
readdirpluss => 'NFSPROC3_READDIRPLUS (Extended Read from Directory)',
|
||||
fsstats => 'NFSPROC3_FSSTAT (Get Dynamic File System Information)',
|
||||
fsinfos => 'NFSPROC3_FSINFO (Get Static File System Information)',
|
||||
pathconfs => 'NFSPROC3_PATHCONF (Retrieve POSIX Information)',
|
||||
commits => 'NFSPROC3_COMMIT (Commit Cached Data on a Server to Stable Storage)',
|
||||
);
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
|
||||
print "require 1.3.6.1.4.1.789.1.3.1.2.4.1.1.0 [0-9]\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $session = Munin::Plugin::SNMP->session();
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
|
||||
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
|
||||
|
||||
print "host_name $host\n" unless $host eq 'localhost';
|
||||
print "graph_title $host NFSv3 calls\n";
|
||||
print "graph_args --base 1000\n";
|
||||
print "graph_vlabel calls / \${graph_period}\n";
|
||||
print "graph_category nfs\n";
|
||||
print "graph_info This graph shows NFSv3 calls for the $host NetApp equipment.\n";
|
||||
print "graph_order ";
|
||||
|
||||
foreach (sort keys %oids) { print "$_ "; }
|
||||
print "\n";
|
||||
|
||||
my $c = 0;
|
||||
foreach my $k (sort keys %oids) {
|
||||
my $i = $oids{$k};
|
||||
my $l = $k;
|
||||
$l =~ s/s$//g;
|
||||
print "$k.info The number of NFS Version 3 calls received for the $i procedure, since the last time the statistics were cleared.\n";
|
||||
print "$k.type DERIVE\n";
|
||||
print "$k.label $l\n";
|
||||
print "$k.min 0\n";
|
||||
print "$k.colour $palette[$c]\n";
|
||||
$c++;
|
||||
}
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $values = $session->get_hash(
|
||||
-baseoid => '1.3.6.1.4.1.789.1.3.1.2.4.1',
|
||||
-cols => {
|
||||
1 => 'nulls',
|
||||
2 => 'getattrs',
|
||||
3 => 'setattrs',
|
||||
4 => 'lookups',
|
||||
5 => 'accesss',
|
||||
6 => 'readlinks',
|
||||
7 => 'reads',
|
||||
8 => 'writes',
|
||||
9 => 'creates',
|
||||
10 => 'mkdirs',
|
||||
11 => 'symlinks',
|
||||
12 => 'mknods',
|
||||
13 => 'removes',
|
||||
14 => 'rmdirs',
|
||||
15 => 'renames',
|
||||
16 => 'links',
|
||||
17 => 'readdirs',
|
||||
18 => 'readdirpluss',
|
||||
19 => 'fsstats',
|
||||
20 => 'fsinfos',
|
||||
21 => 'pathconfs',
|
||||
22 => 'commits',
|
||||
},
|
||||
);
|
||||
|
||||
foreach my $k (keys %oids) {
|
||||
my $v = 'U';
|
||||
$v = $values->{0}->{$k} if (defined $values);
|
||||
print "$k.value $v\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
__END__
|
346
plugins/snmp/snmp__poseidon-sensors
Executable file
346
plugins/snmp/snmp__poseidon-sensors
Executable file
|
@ -0,0 +1,346 @@
|
|||
#!/bin/bash
|
||||
#==============================================================================#
|
||||
# #
|
||||
# check status of sensor of HW Group Poseidon 3268. For more info refer to: #
|
||||
# http://www.hw-group.com/products/poseidon/poseidon_3268_en.html #
|
||||
# 2012 by Florian Lechner #
|
||||
# #
|
||||
#==============================================================================#
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 2 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
#==============================================================================#
|
||||
|
||||
# Munin autoconf and snmpautoconf magic
|
||||
#%# family=auto snmpauto contrib
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
E_OK="0" # everything went allright
|
||||
E_UNKNOWN="1" # "catch all" for otherwise unhandled errors
|
||||
|
||||
E_ARG="81" # invalid argument
|
||||
E_USAGE="82" # wrong program name or arguments
|
||||
E_SNMPGET="83" # error while executing the 'snmpget' utility
|
||||
|
||||
E_COMMANDNOTFOUND="127" # unable to locate binary
|
||||
|
||||
#==============================================================================#
|
||||
# SNMP OIDs from the Poseidon MIB #
|
||||
#==============================================================================#
|
||||
|
||||
SYS_LOC_OID=".1.3.6.1.2.1.1.6.0" # SNMP-location
|
||||
SYS_NAME_OID=".1.3.6.1.2.1.1.5.0" # device name (string)
|
||||
SYS_DESCR_OID=".1.3.6.1.2.1.1.1" # text describing the device
|
||||
SYS_UPTIME_OID=".1.3.6.1.2.1.1.3.0" # time(in tens of milliseconds
|
||||
#+ since the last reboot
|
||||
IN_NAME_OID=".1.3.6.1.4.1.21796.3.3.1.1.3." # binary input name (string)
|
||||
IN_STATE_OID=".1.3.6.1.4.1.21796.3.3.1.1.2." # binary input states(integer)
|
||||
IN_ALARM_OID=".1.3.6.1.4.1.21796.3.3.1.1.4." # alarm for the binary input,
|
||||
#+ generated by the device
|
||||
#+ under defined conditions
|
||||
#+ 0=Invalid, 1=Normal,
|
||||
#+ 2=AlarmState, 3=Alarm
|
||||
SENS_NAME_OID=".1.3.6.1.4.1.21796.3.3.3.1.2." # sensor name (string)
|
||||
SENS_STATE_OID=".1.3.6.1.4.1.21796.3.3.3.1.4." # binary input states(integer)
|
||||
SENS_VALUE_OID=".1.3.6.1.4.1.21796.3.3.3.1.6." # integer (decimal * 10)
|
||||
SENS_ID_OID=".1.3.6.1.4.1.21796.3.3.99.1.2.1.4." # unique sensor ID (integer)
|
||||
#+ representation of the
|
||||
#+ temperature (integer)
|
||||
SENS_UNIT_OID=".1.3.6.1.4.1.21796.3.3.3.1.9." # 0=°C,1=°F,2=°K,3=%,4=V,5=mA,
|
||||
RTS_OUTPUT_OID=".1.3.6.1.4.1.21796.3.3.2.1.2." # binary input state (integer)
|
||||
#+ 6=unknown, 7=pulse, 8=switch
|
||||
|
||||
# define some Poseidon specific stuff:
|
||||
STATE_OK="1"
|
||||
STATE_WARN="2"
|
||||
STATE_CRIT="3"
|
||||
UNITS=("C" "F" "K" "%" "V" "mA" "unknown" "pulse" "switch")
|
||||
TYPES=("Temp" "Temp" "Temp" "Hum" "Volt" "Curr" "Unkn" "Pulse" "Switch")
|
||||
|
||||
declare -A sensorsOfType
|
||||
IFS="
|
||||
"
|
||||
|
||||
#==============================================================================#
|
||||
|
||||
# printMuninConfig ()
|
||||
# print output for munin auto configuration
|
||||
printMuninConfig () {
|
||||
if [ ! $hostAddr = 'localhost' ]; then
|
||||
cat <<- EOT
|
||||
host_name $hostAddr
|
||||
EOT
|
||||
fi
|
||||
|
||||
for ((_sensorType=0; _sensorType<=${#UNITS[*]};_sensorType++)); do
|
||||
# skip graphs without sensors
|
||||
if [ -z "${sensorsOfType[$_sensorType]}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
_firstSensor="1"
|
||||
# print specific config for each sensor
|
||||
for _sensorNr in ${sensorsOfType[$_sensorType]}; do
|
||||
getSensorData $_sensorNr
|
||||
getSystemInfo
|
||||
|
||||
if [ $_firstSensor = "1" ]; then
|
||||
# graph headers
|
||||
cat <<- EOT
|
||||
multigraph $sensorType
|
||||
graph_title $sensorLocation - $sensorType [$sensorUnit]
|
||||
graph_args --base 1000 -l 0
|
||||
graph_vlabel $sensorUnit
|
||||
graph_category environment
|
||||
graph_info This graph shows $sensorType history.
|
||||
EOT
|
||||
fi
|
||||
_firstSensor="0"
|
||||
cat <<- EOT
|
||||
$sensorType$_sensorNr.label $sensorName
|
||||
$sensorType$_sensorNr.info This graph shows $sensorType$_sensorNr history.
|
||||
$sensorType$_sensorNr.draw LINE2
|
||||
EOT
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# printMuninSnmpConfig ()
|
||||
# print output for munin snmp auto configuration
|
||||
printMuninSnmpConfig () {
|
||||
cat <<- EOT
|
||||
require $SENS_VALUE_OID$sensorNumber [0-9]
|
||||
require $SENS_STATE_OID$sensorNumber
|
||||
EOT
|
||||
return 0;
|
||||
}
|
||||
|
||||
# printMuninStatus ()
|
||||
# print status output for munin
|
||||
printMuninStatus () {
|
||||
for ((_sensorType=0; _sensorType<=${#UNITS[*]};_sensorType++)); do
|
||||
# skip graphs without sensors
|
||||
if [ -z "${sensorsOfType[$_sensorType]}" ]; then
|
||||
continue
|
||||
fi
|
||||
_firstSensor="1"
|
||||
|
||||
# print config section
|
||||
for _sensorNr in ${sensorsOfType[$_sensorType]}; do
|
||||
getSensorData $_sensorNr
|
||||
if [ $_firstSensor = "1" ]; then
|
||||
# graph headers
|
||||
cat <<- EOT
|
||||
multigraph $sensorType
|
||||
EOT
|
||||
fi
|
||||
_firstSensor="0"
|
||||
|
||||
# print graph details
|
||||
cat <<- EOT
|
||||
$sensorType$_sensorNr.value $(( $sensorValue / 10 ))
|
||||
EOT
|
||||
done
|
||||
echo ""
|
||||
done
|
||||
}
|
||||
|
||||
# getSensorData(sensorNr)
|
||||
# fetch state, value, name unit and sensor type for the sensor
|
||||
#+ with the number "sensorNr"
|
||||
getSensorData() {
|
||||
_sensorNr=$1
|
||||
sensorState=`snmpGet $hostAddr $SENS_STATE_OID$_sensorNr || err \
|
||||
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
|
||||
sensorValue=`snmpGet $hostAddr $SENS_VALUE_OID$_sensorNr || err \
|
||||
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
|
||||
sensorName=`snmpGet $hostAddr $SENS_NAME_OID$_sensorNr || err \
|
||||
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
|
||||
sensorUnit=`getSensorUnitString $_sensorNr`
|
||||
sensorType=`getSensorType $_sensorNr`
|
||||
}
|
||||
|
||||
# getSystemInfo()
|
||||
# fetch general information about the system
|
||||
getSystemInfo() {
|
||||
sensorLocation="`snmpGet $hostAddr $SYS_LOC_OID`"
|
||||
}
|
||||
|
||||
# snmpGet (hostAddr, OID)
|
||||
# use snmpget to fetch a given OID, using above configuration
|
||||
snmpGet () {
|
||||
_oid="$2"
|
||||
|
||||
_host="$1"
|
||||
_exit="0"
|
||||
|
||||
# fetch the requested OID
|
||||
_longValue="`snmpget -O v\
|
||||
-m $MIBS\
|
||||
-v $SNMPVERSION\
|
||||
-c $SNMPCOMMUNITY\
|
||||
$_host $_oid 2>/dev/null`"
|
||||
|
||||
_exitStatus="$?"
|
||||
|
||||
echo ${_longValue#*:} # remove the type from the answer
|
||||
return $_exitStatus
|
||||
}
|
||||
|
||||
# get unit (string)
|
||||
#+ find out the unit of the output of a given sensor. possible units are:
|
||||
#+ "C" "F" "K" "%" "V" "mA" "unknown" "pulse" "switch"
|
||||
getSensorUnitString () {
|
||||
_sensorNr=$1
|
||||
_sensorUnit=`snmpGet $hostAddr $SENS_UNIT_OID$_sensorNr || err \
|
||||
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
|
||||
echo ${UNITS[$_sensorUnit]}
|
||||
}
|
||||
|
||||
# get type (string)
|
||||
#+ find out what type of sensor we are dealing with. possible types are:
|
||||
#+ "Temp" "Hum" "Volt" "Curr" "Unkn" "Pulse" "Switch"
|
||||
getSensorType () {
|
||||
_sensorNr=$1
|
||||
_sensorUnit=`snmpGet $hostAddr $SENS_UNIT_OID$_sensorNr || err \
|
||||
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
|
||||
echo ${TYPES[$_sensorUnit]}
|
||||
}
|
||||
|
||||
# getAvailableSensorsByType ()
|
||||
# check what sensors are available and store them
|
||||
#+ in the array for the respective unit
|
||||
getAvailableSensorsByType () {
|
||||
_thisSensorNr="1"
|
||||
|
||||
# initial fetch
|
||||
_snmpget=`snmpGet $hostAddr $SENS_UNIT_OID$_thisSensorNr`
|
||||
_nextSensorExits=$?
|
||||
_unit=`echo "$_snmpget" | tr -d " "`
|
||||
|
||||
# add next sensor if it exists
|
||||
while [ true ]; do
|
||||
# add sensors of the same type to a list
|
||||
sensorsOfType[$_unit]="${sensorsOfType[$_unit]} $_thisSensorNr"
|
||||
|
||||
# fetch next sensor
|
||||
_thisSensorNr=$(($_thisSensorNr+1))
|
||||
_snmpget=`snmpGet $hostAddr $SENS_UNIT_OID$_thisSensorNr`
|
||||
_nextSensorExits=$?
|
||||
|
||||
# are we done?
|
||||
if [ $_nextSensorExits -ne 0 ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
_unit=`echo "$_snmpget" |cut -d" " -f 4`
|
||||
done
|
||||
}
|
||||
|
||||
# sanitize (<string>)
|
||||
# use bash builtin substitutions to sanitize string
|
||||
#+ allowed chars are: a-z,A-Z,0-9 and "."
|
||||
#+ if chars have been removed return 1, else return 0
|
||||
sanitize () {
|
||||
input="$1"
|
||||
sanitizedInput="${1//[^a-zA-Z0-9.]/}"
|
||||
echo "$sanitizedInput"
|
||||
if [ "$input" = "$sanitizedInput" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# usage ()
|
||||
# print usage
|
||||
usage () {
|
||||
echo "usage: snmp_<host>_poseidon-sensors [config|snmpconf]" 1>&2
|
||||
exit $E_USAGE
|
||||
}
|
||||
|
||||
# err (ErrorMsg, Exitcode)
|
||||
# basic error handling
|
||||
err () {
|
||||
if [ $# -eq 2 -a "$2" -lt 256 ]; then
|
||||
_errorMsg="$1"
|
||||
_exitCode="$2"
|
||||
else
|
||||
_errorMsg="Fatal: An unknown error occured! Exiting..."
|
||||
_exitCode="$E_UNKNOWN"
|
||||
|
||||
fi
|
||||
|
||||
# print error message to STDERR ...
|
||||
echo "$_errorMsg" >&2
|
||||
# ... and exit with error code.
|
||||
exit $_exitCode
|
||||
}
|
||||
|
||||
#==============================================================================#
|
||||
|
||||
# SNMP Config
|
||||
MIBS=":" # we don't use any configured MIBs so we don't
|
||||
#+ have to deal with errors in the MIBs
|
||||
if [ -z $SNMPVERSION ]; then
|
||||
SNMPVERSION="1" # as of firmware 3.1.5 only SNMPv1 is supported
|
||||
fi
|
||||
|
||||
if [ -z $SNMPCOMMUNITY ]; then
|
||||
SNMPCOMMUNITY="public" # SNMP community string to read from the device
|
||||
fi
|
||||
|
||||
# handle -h option
|
||||
while getopts ":h" opt; do
|
||||
case $opt in
|
||||
h) usage
|
||||
;;
|
||||
\?) echo "Invalid option: -$OPTARG" >&2
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# check for snmpget binary
|
||||
if [ ! -x `which snmpget` ]; then
|
||||
err "Fatal: unable to locate \'snmpget\'! Exiting..." $E_COMMANDNOTFOUND
|
||||
fi
|
||||
|
||||
# extract pluginname ...
|
||||
myName="`basename "$0" | cut -d "_" -f 1,3`"
|
||||
|
||||
# ...and hostname
|
||||
hostAddr="`basename "$0" | cut -d "_" -f 2`"
|
||||
|
||||
if [ "$myName" = "snmp_poseidon-sensors" ]; then
|
||||
hostAddr=`sanitize $hostAddr || err \
|
||||
"Fatal: Invalid argument \"$hostAddr\"! Exiting..." $E_ARG`
|
||||
if [ -z "$hostAddr" ]; then
|
||||
usage munin
|
||||
fi
|
||||
getAvailableSensorsByType
|
||||
if [ "$1" = "config" ]; then
|
||||
printMuninConfig
|
||||
exit $E_OK
|
||||
elif [ "$1" = "snmpconfig" ]; then
|
||||
printMuninSnmpConfig
|
||||
exit $E_OK
|
||||
else
|
||||
printMuninStatus
|
||||
exit $E_OK
|
||||
fi
|
||||
else
|
||||
usage
|
||||
fi
|
||||
|
112
plugins/snmp/snmp__sfsnmp_fan
Executable file
112
plugins/snmp/snmp__sfsnmp_fan
Executable file
|
@ -0,0 +1,112 @@
|
|||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
#
|
||||
# snmp__sfsnmp_fan - Munin plugin for measuring fan on a windowssystem running SpeedFan and sfsnmp
|
||||
# Copyright (C) 2010 Nils Henrik Tvetene
|
||||
#
|
||||
# Author: Nils Henrik Tvetene <nils@tvetene.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
=head1 NAME
|
||||
|
||||
snmp__sfsnmp_fan - Munin plugin for measuring fanspeed on a windowssystem running SpeedFan and sfsnmp
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Windows-system running SpeedFan and the sfsnmp extension
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
Example config:
|
||||
[snmp_twinspark_sfsnmp_*]
|
||||
env.fan1 CPU
|
||||
env.fan7.ignore true
|
||||
|
||||
Plugin is linked using hostname of monitored system:
|
||||
|
||||
ln -s /usr/share/munin/plugins/snmp__sfsnmp_fan /etc/munin/plugins/snmp_<hostname>_sfsnmp_fan
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Nils Henrik Tvetene <nils@tvetene.net>
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Munin::Plugin::SNMP;
|
||||
use vars qw($DEBUG);
|
||||
|
||||
$DEBUG = $ENV{'MUNIN_DEBUG'};
|
||||
|
||||
# OIDs used
|
||||
# 1.3.6.1.4.1.30503.1.1.2 number of fans
|
||||
# 1.3.6.1.4.1.30503.1.3.x where x is 1 => above number
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
|
||||
print "number 1.3.6.1.4.1.30503.1.1.2\n";
|
||||
print "index 1.3.6.1.4.1.30503.1.3.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $session = Munin::Plugin::SNMP->session();
|
||||
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
|
||||
my ($idx, $numFans, @fan, @label);
|
||||
|
||||
$numFans = $session->get_single('1.3.6.1.4.1.30503.1.1.2');
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
print "host_name $host\n" unless $host eq 'localhost';
|
||||
print "graph_title $host fan\n";
|
||||
print "graph_args --base 1000 --lower-limit 1000\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_printf %3.0lf\n";
|
||||
print "graph_vlabel fan RPM\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows the fans on host $host\n";
|
||||
foreach $idx ( 0..$numFans-1 ) {
|
||||
$label[$idx] = exists $ENV{"fan".($idx+1)} ? $ENV{"fan".($idx+1)} : "fan".($idx+1);
|
||||
print "fan".($idx+1).".info ".$label[$idx]." fan in RPM's.\n";
|
||||
|
||||
print "fan".($idx+1).".graph no\n" if exists $ENV{"fan".($idx+1).".ignore"};
|
||||
|
||||
print "fan".($idx+1).".type GAUGE\n";
|
||||
print "fan".($idx+1).".label $label[$idx]\n";
|
||||
print "fan".($idx+1).".min 1000\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
foreach $idx ( 0..$numFans-1 ) {
|
||||
$fan[$idx] = $session->get_single('1.3.6.1.4.1.30503.1.3.'.($idx+1));
|
||||
print "fan".($idx+1).".value $fan[$idx]\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
__END__
|
||||
|
111
plugins/snmp/snmp__sfsnmp_temp
Executable file
111
plugins/snmp/snmp__sfsnmp_temp
Executable file
|
@ -0,0 +1,111 @@
|
|||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
#
|
||||
# snmp__sfsnmp_temp - Munin plugin for measuring temperatures on a windowssystem running SpeedFan and sfsnmp
|
||||
# Copyright (C) 2010 Nils Henrik Tvetene
|
||||
#
|
||||
# Author: Nils Henrik Tvetene <nils@tvetene.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
=head1 NAME
|
||||
|
||||
snmp__sfsnmp_temp - Munin plugin for measuring temperatures on a windowssystem running SpeedFan and sfsnmp
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Windows-system running SpeedFan and the sfsnmp extension
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
Example config:
|
||||
[snmp_twinspark_sfsnmp_temp]
|
||||
env.temp1 System
|
||||
env.temp7.ignore true
|
||||
|
||||
Plugin is linked using hostname of monitored system:
|
||||
|
||||
ln -s /usr/share/munin/plugins/snmp__sfsnmp_temp /etc/munin/plugins/snmp_<hostname>_sfsnmp_temp
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Nils Henrik Tvetene <nils@tvetene.net>
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Munin::Plugin::SNMP;
|
||||
use vars qw($DEBUG);
|
||||
|
||||
$DEBUG = $ENV{'MUNIN_DEBUG'};
|
||||
|
||||
# OIDs used
|
||||
# 1.3.6.1.4.1.30503.1.1.1 number of temperatures
|
||||
# 1.3.6.1.4.1.30503.1.2.x where x is 1 => above number
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
|
||||
print "number 1.3.6.1.4.1.30503.1.1.1\n";
|
||||
print "index 1.3.6.1.4.1.30503.1.2.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $session = Munin::Plugin::SNMP->session();
|
||||
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
|
||||
my ($idx, $numTemps, @temp, @label);
|
||||
|
||||
$numTemps = $session->get_single('1.3.6.1.4.1.30503.1.1.1');
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
print "host_name $host\n" unless $host eq 'localhost';
|
||||
print "graph_title $host temperatures\n";
|
||||
print "graph_args --base 1000 --lower-limit 30\n";
|
||||
print "graph_vlabel degrees Celcius\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows the temperatures on host $host\n";
|
||||
foreach $idx ( 0..$numTemps-1 ) {
|
||||
$label[$idx] = exists $ENV{"temp".($idx+1)} ? $ENV{"temp".($idx+1)} : "temp".($idx+1);
|
||||
print "temp".($idx+1).".info ".$label[$idx]." temperature in Celsius.\n";
|
||||
|
||||
print "temp".($idx+1).".graph no\n" if exists $ENV{"temp".($idx+1).".ignore"};
|
||||
|
||||
print "temp".($idx+1).".type GAUGE\n";
|
||||
print "temp".($idx+1).".label $label[$idx]\n";
|
||||
print "temp".($idx+1).".cdef temp".($idx+1).",100,/\n";
|
||||
print "temp".($idx+1).".min 30\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
foreach $idx ( 0..$numTemps-1 ) {
|
||||
$temp[$idx] = $session->get_single('1.3.6.1.4.1.30503.1.2.'.($idx+1));
|
||||
print "temp".($idx+1).".value $temp[$idx]\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
__END__
|
||||
|
112
plugins/snmp/snmp__sfsnmp_volt
Executable file
112
plugins/snmp/snmp__sfsnmp_volt
Executable file
|
@ -0,0 +1,112 @@
|
|||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
#
|
||||
# snmp__sfsnmp_volt - Munin plugin for measuring volt on a windowssystem running SpeedFan and sfsnmp
|
||||
# Copyright (C) 2010 Nils Henrik Tvetene
|
||||
#
|
||||
# Author: Nils Henrik Tvetene <nils@tvetene.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
=head1 NAME
|
||||
|
||||
snmp__sfsnmp_volt - Munin plugin for measuring volts on a windowssystem running SpeedFan and sfsnmp
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Windows-system running SpeedFan and the sfsnmp extension
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
Example config:
|
||||
[snmp_twinspark_sfsnmp_*]
|
||||
env.volt1 Vcore
|
||||
env.volt3.ignore true
|
||||
|
||||
Plugin is linked using hostname of monitored system:
|
||||
|
||||
ln -s /usr/share/munin/plugins/snmp__sfsnmp_volt /etc/munin/plugins/snmp_<hostname>_sfsnmp_volt
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Nils Henrik Tvetene <nils@tvetene.net>
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Munin::Plugin::SNMP;
|
||||
use vars qw($DEBUG);
|
||||
|
||||
$DEBUG = $ENV{'MUNIN_DEBUG'};
|
||||
|
||||
# OIDs used
|
||||
# 1.3.6.1.4.1.30503.1.1.3 number of voltages
|
||||
# 1.3.6.1.4.1.30503.1.4.x where x is 1 => above number
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
|
||||
print "number 1.3.6.1.4.1.30503.1.1.3\n";
|
||||
print "index 1.3.6.1.4.1.30503.1.4.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $session = Munin::Plugin::SNMP->session();
|
||||
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
|
||||
my ($idx, $numVolts, @volt, @label);
|
||||
|
||||
$numVolts = $session->get_single('1.3.6.1.4.1.30503.1.1.3');
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
print "host_name $host\n" unless $host eq 'localhost';
|
||||
print "graph_title $host volt\n";
|
||||
print "graph_args --base 1000 --lower-limit 0 --upper-limit 13\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_vlabel Volt\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows the volt on host $host\n";
|
||||
foreach $idx ( 0..$numVolts-1 ) {
|
||||
$label[$idx] = exists $ENV{"volt".($idx+1)} ? $ENV{"volt".($idx+1)} : "volt".($idx+1);
|
||||
print "volt".($idx+1).".info ".$label[$idx]." volt in Celsius.\n";
|
||||
|
||||
print "volt".($idx+1).".graph no\n" if exists $ENV{"volt".($idx+1).".ignore"};
|
||||
|
||||
print "volt".($idx+1).".type GAUGE\n";
|
||||
print "volt".($idx+1).".label $label[$idx]\n";
|
||||
print "volt".($idx+1).".cdef volt".($idx+1).",100,/\n";
|
||||
print "volt".($idx+1).".min 30\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
foreach $idx ( 0..$numVolts-1 ) {
|
||||
$volt[$idx] = $session->get_single('1.3.6.1.4.1.30503.1.4.'.($idx+1));
|
||||
print "volt".($idx+1).".value $volt[$idx]\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
__END__
|
||||
|
104
plugins/snmp/snmp__thecus_fans
Executable file
104
plugins/snmp/snmp__thecus_fans
Executable file
|
@ -0,0 +1,104 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- cperl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
||||
snmp__thecus_fans - Munin plugin to retrive fanspeed readings from a Thecus
|
||||
NAS device running SNMP.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
All Thecus NAS devices which have the third party NETSNMPD module installed.
|
||||
This is available at http://www.fajo.de/main/thecus/modules/netsnmpd
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
As a rule SNMP plugins need site specific configuration. The default
|
||||
configuration (shown here) will only work on insecure sites/devices.
|
||||
|
||||
[snmp_*]
|
||||
env.version 2
|
||||
env.community public
|
||||
|
||||
In general SNMP is not very secure at all unless you use SNMP version
|
||||
3 which supports authentication and privacy (encryption). But in any
|
||||
case the community string for your devices should not be "public".
|
||||
|
||||
Please see 'perldoc Munin::Plugin::SNMP' for further configuration
|
||||
information.
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin reports the current fan speed readings as reported by the thecusIO
|
||||
module.
|
||||
|
||||
=head1 MIB INFORMATION
|
||||
|
||||
Private MIB
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
0.0.20120307
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None known.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (C) 2011 - 2012 Andreas Thienemann <andreas@bawue.net>
|
||||
|
||||
Based on the snmp__uptime plugin as a template.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2 or (at your option) any later version.
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use Munin::Plugin::SNMP;
|
||||
use vars qw($DEBUG);
|
||||
|
||||
$DEBUG = $ENV{'MUNIN_DEBUG'};
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
|
||||
print "index 1.3.6.1.4.1.14822.101.21.\n";
|
||||
print "require 1.3.6.1.4.1.14822.101.21.5200.1.1.0 [0-9]\n";
|
||||
print "require 1.3.6.1.4.1.14822.101.21.5200.1.2.0 [0-9]\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
my ($host) = Munin::Plugin::SNMP->config_session();
|
||||
print "host_name $host\n" unless $host eq 'localhost';
|
||||
print "graph_title Thecus Fans
|
||||
graph_args --base 1000 -l 0
|
||||
graph_vlabel RPM
|
||||
graph_info This graph shows the RPMs of the fans as reported by the ThecusIO module.
|
||||
graph_category sensors
|
||||
fan1.label Fan 1
|
||||
fan1.info Thecus CPU Fan
|
||||
fan2.label Fan 2
|
||||
fan2.info Thecus System Fan
|
||||
";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $session = Munin::Plugin::SNMP->session(-translate =>
|
||||
[ -timeticks => 0x0 ]);
|
||||
|
||||
my $fan1 = $session->get_single ("1.3.6.1.4.1.14822.101.21.5200.1.1.0") || 'U';
|
||||
my $fan2 = $session->get_single ("1.3.6.1.4.1.14822.101.21.5200.1.2.0") || 'U';
|
||||
|
||||
#print "Retrived uptime is '$uptime'\n" if $DEBUG;
|
||||
|
||||
print "fan1.value ", $fan1, "\n";
|
||||
print "fan2.value ", $fan2, "\n";
|
167
plugins/snmp/snmp__ups2_
Executable file
167
plugins/snmp/snmp__ups2_
Executable file
|
@ -0,0 +1,167 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Jean-Samuel Reynaud <js.reynaud@free.fr>
|
||||
# base on snmp__if_ from Jimmy Olsen, Dagfinn Ilmari Mannsaaker
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
# Usage:
|
||||
# ln -s /usr/share/munin/node/plugins-auto/snmp__ups2_ /etc/munin/node.d/snmp_ups.address.loc_mode
|
||||
# with mode : batteryVoltage, batteryTemperature,inputVoltage,inputCurrent,inputFrequency,outputVoltage,outputCurrent,outputPower,outputPercentLoad,ChargeRemaining
|
||||
#
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $mode = $ENV{mode} || undef;
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require .1.3.6.1.2.1.33.1.2.7 [0-9]\n"; # Bat temp
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_ups2_(.+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$mode = $2;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1 -- $2\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $graphs = {
|
||||
'batteryVoltage' => { 'title' => 'Battery Voltage',
|
||||
'category' => 'network',
|
||||
'unit' => 'Volt',
|
||||
'value' => '.1.3.6.1.2.1.33.1.2.5'},
|
||||
'batteryTemperature' => { 'title' => 'Battery Temperature',
|
||||
'category' => 'network',
|
||||
'unit' => 'DegC',
|
||||
'value' => '.1.3.6.1.2.1.33.1.2.7'},
|
||||
'inputVoltage' => { 'title' => 'Input Voltage',
|
||||
'category' => 'network',
|
||||
'unit' => 'Volt',
|
||||
'list' => '.1.3.6.1.2.1.33.1.3.2',
|
||||
'value' => '.1.3.6.1.2.1.33.1.3.3.1.3'},
|
||||
'inputCurrent' => { 'title' => 'Input Current',
|
||||
'category' => 'network',
|
||||
'unit' => 'Watt',
|
||||
'list' => '.1.3.6.1.2.1.33.1.3.2',
|
||||
'value' => '.1.3.6.1.2.1.33.1.3.3.1.4'},
|
||||
'inputFrequency' => { 'title' => 'Input Frequency',
|
||||
'category' => 'network',
|
||||
'list' => '.1.3.6.1.2.1.33.1.3.2',
|
||||
'unit' => 'Hz',
|
||||
'value' => '.1.3.6.1.2.1.33.1.3.3.1.2'},
|
||||
|
||||
'outputVoltage' => { 'title' => 'Output Voltage',
|
||||
'category' => 'network',
|
||||
'list' => '.1.3.6.1.2.1.33.1.4.3',
|
||||
'unit' => 'Hz',
|
||||
'value' => '.1.3.6.1.2.1.33.1.4.4.1.2'},
|
||||
'outputCurrent' => { 'title' => 'Output Current',
|
||||
'category' => 'network',
|
||||
'list' => '.1.3.6.1.2.1.33.1.4.3',
|
||||
'value' => '.1.3.6.1.2.1.33.1.4.4.1.3'},
|
||||
'outputPower' => { 'title' => 'Output Power',
|
||||
'category' => 'network',
|
||||
'list' => '.1.3.6.1.2.1.33.1.4.3',
|
||||
'unit' => 'Hz',
|
||||
'value' => '.1.3.6.1.2.1.33.1.4.4.1.4'},
|
||||
|
||||
'outputPercentLoad' => { 'title' => 'Output PercentLoad',
|
||||
'category' => 'network',
|
||||
'list' => '.1.3.6.1.2.1.33.1.4.3',
|
||||
'unit' => '%',
|
||||
'value' => '.1.3.6.1.2.1.33.1.4.4.1.5'},
|
||||
|
||||
'ChargeRemaining' => { 'title' => 'Charge remaining',
|
||||
'unit' => 'Seconds',
|
||||
'category' => 'network',
|
||||
'value' => '.1.3.6.1.2.1.33.1.2.4'}
|
||||
};
|
||||
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
my $count_data = 1;
|
||||
if (defined $graphs->{$mode}->{'list'} &&
|
||||
defined ($response = $session->get_request($graphs->{$mode}->{'list'} . ".0"))) {
|
||||
$count_data = $response->{$graphs->{$mode}->{'list'} . ".0"};
|
||||
|
||||
}
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
printf "graph_title %s \n",$graphs->{$mode}->{'title'};
|
||||
# print "graph_args --base 1000\n";
|
||||
print "graph_category network\n";
|
||||
|
||||
|
||||
for(my $i=0;$i<$count_data;$i++) {
|
||||
printf "line%u.label Line %u\n",$i+1,$i+1;
|
||||
printf "line%u.type GAUGE\n",$i+1;
|
||||
# printf "line%u.cdef recv,8,*\n",$i+1;
|
||||
printf "line%u.info %s\n",$i+1,$graphs->{$mode}->{'unit'};
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
for(my $i=0;$i<$count_data;$i++) {
|
||||
my $l_current = $i+1;
|
||||
if ($count_data == 1) {
|
||||
$l_current = 0;
|
||||
}
|
||||
if (defined ($response = $session->get_request($graphs->{$mode}->{'value'} . sprintf(".%u",$l_current)))) {
|
||||
printf "line%u.value %u\n",$i+1,$response->{$graphs->{$mode}->{'value'} . sprintf(".%u",$l_current)};
|
||||
} else {
|
||||
printf "line%u.value U\n",$i+1;
|
||||
}
|
||||
|
||||
}
|
350
plugins/snmp/snmp__ups_
Executable file
350
plugins/snmp/snmp__ups_
Executable file
|
@ -0,0 +1,350 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright (C) 2008 Gorlow Maxim [Sheridan]
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
# ups_host_volt - IO voltage (volt)
|
||||
# ups_host_freq - IO frequency (hz)
|
||||
# ups_host_status - UPS status (online, off....)
|
||||
# ups_host_temp - Temperature (c)
|
||||
# ups_host_battcap - Battery capacity (%)
|
||||
# ups_host_load - UPS load (%)
|
||||
# ups_host_curr - Current (ampers)
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#
|
||||
|
||||
use strict;
|
||||
use SNMP '5.0.2.pre1' || die("Cannot load module\n");
|
||||
$ENV{'MIBS'}="ALL";
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $community = $ENV{community} || "public";
|
||||
my $type = "volt";
|
||||
my $response;
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_ups_(.+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$type = $2;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$type = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host)) {
|
||||
die "# Error: couldn't understand what I'm supposed to monitor."; }
|
||||
|
||||
|
||||
my $session = new SNMP::Session (
|
||||
DestHost => $host,
|
||||
Community => $community,
|
||||
Version => 1
|
||||
);
|
||||
my $oidsList;
|
||||
my $modelList = new SNMP::VarList(['upsBasicIdentModel'],['upsAdvIdentSerialNumber']);
|
||||
if ($type eq "volt")
|
||||
{
|
||||
$oidsList = new SNMP::VarList (
|
||||
['upsAdvOutputVoltage'],
|
||||
['upsAdvInputLineVoltage'],
|
||||
['upsAdvInputMaxLineVoltage'],
|
||||
['upsAdvInputMinLineVoltage']
|
||||
);
|
||||
}
|
||||
elsif ($type eq "freq")
|
||||
{
|
||||
$oidsList = new SNMP::VarList (
|
||||
['upsAdvOutputFrequency'],
|
||||
['upsAdvInputFrequency']
|
||||
);
|
||||
}
|
||||
elsif ($type eq "status")
|
||||
{
|
||||
$oidsList = new SNMP::VarList (
|
||||
['upsBasicOutputStatus']
|
||||
);
|
||||
}
|
||||
elsif ($type eq "temp")
|
||||
{
|
||||
$oidsList = new SNMP::VarList (
|
||||
['upsAdvBatteryTemperature']
|
||||
);
|
||||
}
|
||||
elsif ($type eq "battcap")
|
||||
{
|
||||
$oidsList = new SNMP::VarList (
|
||||
['upsAdvBatteryCapacity']
|
||||
);
|
||||
}
|
||||
elsif ($type eq "load")
|
||||
{
|
||||
$oidsList = new SNMP::VarList (
|
||||
['upsAdvOutputLoad']
|
||||
);
|
||||
}
|
||||
elsif ($type eq "curr")
|
||||
{
|
||||
$oidsList = new SNMP::VarList (
|
||||
['upsAdvOutputCurrent']
|
||||
);
|
||||
}
|
||||
#if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
#{}
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
|
||||
my $model;
|
||||
my $vLabel;
|
||||
my $hLabel;
|
||||
if ($type eq "volt")
|
||||
{
|
||||
$vLabel = "Voltage";
|
||||
$hLabel = "IO Voltage";
|
||||
}
|
||||
elsif ($type eq "freq")
|
||||
{
|
||||
$vLabel = "Frequency";
|
||||
$hLabel = "IO Frequency";
|
||||
}
|
||||
elsif ($type eq "status")
|
||||
{
|
||||
$vLabel = "Status";
|
||||
$hLabel = "Status";
|
||||
}
|
||||
elsif ($type eq "temp")
|
||||
{
|
||||
$vLabel = "Temperature, C";
|
||||
$hLabel = "Temperature";
|
||||
}
|
||||
elsif ($type eq "battcap")
|
||||
{
|
||||
$vLabel = "Percent";
|
||||
$hLabel = "Batt. capacity";
|
||||
}
|
||||
elsif ($type eq "load")
|
||||
{
|
||||
$vLabel = "Percent";
|
||||
$hLabel = "UPS load";
|
||||
}
|
||||
elsif ($type eq "curr")
|
||||
{
|
||||
$vLabel = "Ampers";
|
||||
$hLabel = "Current";
|
||||
}
|
||||
print "host_name $host\n" unless $host eq 'localhost';
|
||||
my @response = $session->getnext($modelList);
|
||||
$response[0] =~ s/[\" ]//g; # Ditch the quotes.
|
||||
$response[1] =~ s/[\" ]//g;
|
||||
$model = "$response[0] [$response[1]]";
|
||||
print "graph_title $hLabel, $model\n";
|
||||
print "graph_args --base 1000\n";
|
||||
print "graph_vlabel $vLabel\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_info This graph shows the $hLabel ($vLabel) of $model\n";
|
||||
if ($type eq "volt")
|
||||
{
|
||||
print "graph_order in out inmax inmin\n";
|
||||
print "in.label Input\n";
|
||||
print "in.type GAUGE\n";
|
||||
print "in.info Input voltage.\n";
|
||||
print "in.colour FFCC99\n";
|
||||
print "in.draw AREA\n";
|
||||
print "out.label Output\n";
|
||||
print "out.type GAUGE\n";
|
||||
print "out.info Output voltage.\n";
|
||||
print "out.colour 009BCC\n";
|
||||
print "out.draw AREA\n";
|
||||
print "inmax.label Input max\n";
|
||||
print "inmax.type GAUGE\n";
|
||||
print "inmax.info Input voltage maximum.\n";
|
||||
print "inmax.colour FF0033\n";
|
||||
print "inmax.draw LINE1\n";
|
||||
print "inmin.label Input min\n";
|
||||
print "inmin.type GAUGE\n";
|
||||
print "inmin.info Input voltage minimum.\n";
|
||||
print "inmin.colour 66FF00\n";
|
||||
print "inmin.draw LINE1\n";
|
||||
|
||||
}
|
||||
elsif ($type eq "freq")
|
||||
{
|
||||
print "graph_order in out\n";
|
||||
print "out.label Output\n";
|
||||
print "out.type GAUGE\n";
|
||||
print "out.info Output frequency.\n";
|
||||
print "out.draw LINE2\n";
|
||||
print "in.label Input\n";
|
||||
print "in.type GAUGE\n";
|
||||
print "in.info Input frequency.\n";
|
||||
print "in.draw LINE2\n";
|
||||
}
|
||||
elsif ($type eq "status")
|
||||
{
|
||||
print "state.label Status\n";
|
||||
print "state.type GAUGE\n";
|
||||
print "state.draw AREA\n";
|
||||
print "state.min 1\n";
|
||||
print "state.max 12\n";
|
||||
print "unknown.label Unknown\n";
|
||||
print "unknown.type GAUGE\n";
|
||||
print "unknown.draw LINE3\n";
|
||||
print "onLine.label Online\n";
|
||||
print "onLine.type GAUGE\n";
|
||||
print "onLine.draw LINE3\n";
|
||||
print "onBattery.label On Battery\n";
|
||||
print "onBattery.type GAUGE\n";
|
||||
print "onBattery.draw LINE3\n";
|
||||
print "onSmartBoost.label On Smart Boost\n";
|
||||
print "onSmartBoost.type GAUGE\n";
|
||||
print "onSmartBoost.draw LINE3\n";
|
||||
print "timedSleeping.label Timed Sleeping\n";
|
||||
print "timedSleeping.type GAUGE\n";
|
||||
print "timedSleeping.draw LINE3\n";
|
||||
print "softwareBypass.label Software Bypass\n";
|
||||
print "softwareBypass.type GAUGE\n";
|
||||
print "softwareBypass.draw LINE3\n";
|
||||
print "off.label Off\n";
|
||||
print "off.type GAUGE\n";
|
||||
print "off.draw LINE3\n";
|
||||
print "rebooting.label Rebooting\n";
|
||||
print "rebooting.type GAUGE\n";
|
||||
print "rebooting.draw LINE3\n";
|
||||
print "switchedBypass.label Switched Bypass\n";
|
||||
print "switchedBypass.type GAUGE\n";
|
||||
print "switchedBypass.draw LINE3\n";
|
||||
print "hardwareFailureBypass.label HW Failure Bypass\n";
|
||||
print "hardwareFailureBypass.type GAUGE\n";
|
||||
print "hardwareFailureBypass.draw LINE3\n";
|
||||
print "sleepingUntilPowerReturn.label Sleep Until Power Return\n";
|
||||
print "sleepingUntilPowerReturn.type GAUGE\n";
|
||||
print "sleepingUntilPowerReturn.draw LINE3\n";
|
||||
print "onSmartTrim.label On Smart Trim\n";
|
||||
print "onSmartTrim.type GAUGE\n";
|
||||
print "onSmartTrim.draw LINE3\n";
|
||||
}
|
||||
elsif ($type eq "temp")
|
||||
{
|
||||
print "batt.label Battery temperature\n";
|
||||
print "batt.type GAUGE\n";
|
||||
print "batt.info Battery temperature.\n";
|
||||
print "batt.draw LINE2\n";
|
||||
}
|
||||
elsif ($type eq "battcap")
|
||||
{
|
||||
print "bcap.label Battery capacity\n";
|
||||
print "bcap.type GAUGE\n";
|
||||
print "bcap.info Battery capacity.\n";
|
||||
print "bcap.draw AREA\n";
|
||||
print "bcap.warning 30\n";
|
||||
print "bcap.critical 15\n";
|
||||
}
|
||||
elsif ($type eq "load")
|
||||
{
|
||||
print "load.label UPS load\n";
|
||||
print "load.type GAUGE\n";
|
||||
print "load.info UPS load.\n";
|
||||
print "load.draw AREA\n";
|
||||
print "load.warning 95\n";
|
||||
print "load.critical 100\n";
|
||||
}
|
||||
elsif ($type eq "curr")
|
||||
{
|
||||
print "out.label Output\n";
|
||||
print "out.type GAUGE\n";
|
||||
print "out.info Output current\n";
|
||||
print "out.draw LINE2\n";
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
my @response = $session->getnext($oidsList);
|
||||
if ($type eq "volt")
|
||||
{
|
||||
print "out.value $response[0]\n";
|
||||
print "in.value $response[1]\n";
|
||||
print "inmax.value $response[2]\n";
|
||||
print "inmin.value $response[3]\n";
|
||||
}
|
||||
elsif ($type eq "freq")
|
||||
{
|
||||
print "out.value $response[0]\n";
|
||||
print "in.value $response[1]\n";
|
||||
}
|
||||
elsif ($type eq "status")
|
||||
{
|
||||
my $unknown = $response[0]==1 || "U";
|
||||
my $onLine = $response[0]==2 || "U";
|
||||
my $onBattery = $response[0]==3 || "U";
|
||||
my $onSmartBoost = $response[0]==4 || "U";
|
||||
my $timedSleeping = $response[0]==5 || "U";
|
||||
my $softwareBypass = $response[0]==6 || "U";
|
||||
my $off = $response[0]==7 || "U";
|
||||
my $rebooting = $response[0]==8 || "U";
|
||||
my $switchedBypass = $response[0]==9 || "U";
|
||||
my $hardwareFailureBypass = $response[0]==10 || "U";
|
||||
my $sleepingUntilPowerReturn = $response[0]==11 || "U";
|
||||
my $onSmartTrim = $response[0]==12 || "U";
|
||||
|
||||
print "state.value $response[0]\n";
|
||||
print "unknown.value $unknown\n";
|
||||
print "onLine.value $onLine\n";
|
||||
print "onBattery.value $onBattery\n";
|
||||
print "onSmartBoost.value $onSmartBoost\n";
|
||||
print "timedSleeping.value $timedSleeping\n";
|
||||
print "softwareBypass.value $softwareBypass\n";
|
||||
print "off.value $off\n";
|
||||
print "rebooting.value $rebooting\n";
|
||||
print "switchedBypass.value $switchedBypass\n";
|
||||
print "hardwareFailureBypass.value $hardwareFailureBypass\n";
|
||||
print "sleepingUntilPowerReturn.value $sleepingUntilPowerReturn\n";
|
||||
print "onSmartTrim.value $onSmartTrim\n";
|
||||
}
|
||||
elsif ($type eq "temp")
|
||||
{
|
||||
print "batt.value $response[0]\n";
|
||||
}
|
||||
elsif ($type eq "battcap")
|
||||
{
|
||||
print "bcap.value $response[0]\n";
|
||||
}
|
||||
elsif ($type eq "load")
|
||||
{
|
||||
print "load.value $response[0]\n";
|
||||
}
|
||||
elsif ($type eq "curr")
|
||||
{
|
||||
print "out.value $response[0]\n";
|
||||
}
|
||||
|
||||
__END__
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "number 1.3.6.1.2.1.2.1.0\n";
|
||||
print "index 1.3.6.1.2.1.2.2.1.1.\n";
|
||||
print "require 1.3.6.1.2.1.2.2.1.3. ^(6|23)\$\n"; # Type
|
||||
print "require 1.3.6.1.2.1.2.2.1.5. [1-9]\n"; # Speed
|
||||
exit 0;
|
||||
}
|
36
plugins/snmp/snmp__ups_battery
Executable file
36
plugins/snmp/snmp__ups_battery
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor battery from UPS APC 9619
|
||||
# 2009/04/10 12:27:02 radar AT aol DOT pl
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/snmp__ups_battery /etc/munin/plugins/snmp_UPS.IP_ups_battery
|
||||
#
|
||||
# Magic markers (optional - only used by munin-config and some installation scripts):
|
||||
#%# family=contrib
|
||||
|
||||
UPSHOST=$(basename $0 | awk -F'_|_' '{print $2}')
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
UPSMODEL=$(snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.1.1.1.0 | awk -F'"|"' '{print $2}')
|
||||
echo "graph_title $UPSMODEL - Battery"
|
||||
echo "graph_args --base 1000 -l 0 -u 100"
|
||||
echo "graph_vlabel %"
|
||||
echo "graph_scale no"
|
||||
echo "graph_category sensors"
|
||||
echo "graph_info This graph shows the battery capacity/load read from $UPSMODEL"
|
||||
echo "batterycapacity.label Battery Capacity"
|
||||
echo "batterycapacity.type GAUGE"
|
||||
echo "batterycapacity.draw LINE3"
|
||||
echo "batterycapacity.info Battery Capacity"
|
||||
echo "batterycapacity.colour ff0000"
|
||||
echo "batteryload.label Battery Load"
|
||||
echo "batteryload.type GAUGE"
|
||||
echo "batteryload.draw AREA"
|
||||
echo "batteryload.info Battery Load"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "batterycapacity.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.2.2.1.0 | awk '{print $NF}'
|
||||
echo -n "batteryload.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.4.2.3.0 | awk '{print $NF}'
|
29
plugins/snmp/snmp__ups_temp
Executable file
29
plugins/snmp/snmp__ups_temp
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor temperature from UPS APC 9619
|
||||
# 2009/04/10 12:27:02 radar AT aol DOT pl
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/snmp__ups_temp /etc/munin/plugins/snmp_UPS.IP_ups_temp
|
||||
#
|
||||
# Magic markers (optional - only used by munin-config and some installation scripts):
|
||||
#%# family=contrib
|
||||
|
||||
UPSHOST=$(basename $0 | awk -F'_|_' '{print $2}')
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
UPSMODEL=$(snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.1.1.1.0 | awk -F'"|"' '{print $2}')
|
||||
echo "graph_title $UPSMODEL- Temperature"
|
||||
echo "graph_args --base 1000 -l 0 "
|
||||
echo "graph_vlabel degrees C"
|
||||
echo "graph_category sensors"
|
||||
echo "graph_info This graph shows the temperature read from $UPSMODEL"
|
||||
echo "temperature.label sensor UPS"
|
||||
echo "temperature.type GAUGE"
|
||||
echo "temperature.info Temperature from sensor UPS."
|
||||
echo "temperature.warning 25"
|
||||
echo "temperature.critical 30"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "temperature.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1 | awk '{print $NF}'
|
34
plugins/snmp/snmp__ups_voltage
Executable file
34
plugins/snmp/snmp__ups_voltage
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor voltage from UPS APC 9619
|
||||
# 2009/04/10 12:27:02 radar AT aol DOT pl
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/snmp__ups_voltage /etc/munin/plugins/snmp_UPS.IP_ups_voltage
|
||||
#
|
||||
# Magic markers (optional - only used by munin-config and some installation scripts):
|
||||
#%# family=contrib
|
||||
|
||||
UPSHOST=$(basename $0 | awk -F'_|_' '{print $2}')
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
UPSMODEL=$(snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.1.1.1.0 | awk -F'"|"' '{print $2}')
|
||||
echo "graph_title $UPSMODEL - Voltage"
|
||||
echo "graph_args --base 1000"
|
||||
echo "graph_vlabel Voltage in (-) / out (+)"
|
||||
echo "graph_category sensors"
|
||||
echo "graph_info This graph shows the voltage read from $UPSMODEL"
|
||||
echo "voltagein.label V"
|
||||
echo "voltagein.type GAUGE"
|
||||
echo "voltagein.info Voltage."
|
||||
echo "voltagein.graph no"
|
||||
echo "voltageout.label V"
|
||||
echo "voltageout.type GAUGE"
|
||||
echo "voltageout.info Voltage."
|
||||
echo "voltageout.negative voltagein"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "voltagein.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.3.2.1.0 | awk '{print $NF}'
|
||||
echo -n "voltageout.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.4.2.1.0 | awk '{print $NF}'
|
92
plugins/snmp/snmp__webthermometer
Executable file
92
plugins/snmp/snmp__webthermometer
Executable file
|
@ -0,0 +1,92 @@
|
|||
#!/bin/sh
|
||||
|
||||
# snmp plugin for Wiesemann und Thies WebThermometer
|
||||
# (C) Michael Renner <michael.renner@gmx.de>
|
||||
# 10.07.2007
|
||||
# Version 0.2
|
||||
|
||||
# to find out which values your device use type
|
||||
# snmpwalk -v1 -c public <IP> 1.3.6.1.4.1.5040
|
||||
|
||||
COMMUNITY="public"
|
||||
MIB=/usr/share/snmp/mibs/an2graph_mib_125.mib
|
||||
graph_period="second"
|
||||
SNMPCLIENT=`basename $0 | sed 's/^snmp_//g' | cut -d "_" -f1`
|
||||
SNMPGET="/usr/bin/snmpget -m $MIB -v1 -c $COMMUNITY $SNMPCLIENT"
|
||||
BROADCAST="255.255.255.255"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "suggest" ]; then
|
||||
# This part does not work well
|
||||
# the pinf command must support broadcasts
|
||||
# echo | nc -u -w 1 192.168.5.0 8513
|
||||
#
|
||||
# 1.) find all network devices
|
||||
# 2.) find out if it reacts to a UDP package at port 8513
|
||||
# 3.) find out if it is a W & T WebGraph
|
||||
IPS=`ping -b -c2 $BROADCAST | grep icmp 2> /dev/null | sed s/.*from//g | cut -f1 -d":"`
|
||||
for IP in $IPS ; do
|
||||
unset RETURN
|
||||
RETURN=`echo "-" | nc -u -w 1 $IP 8513`
|
||||
RETURN=foo
|
||||
if [ "$RETURN" ] ; then
|
||||
/usr/bin/snmpget -m $MIB -v1 -c $COMMUNITY $IP WebGraph-2xThermometer-MIB::wtWebioAn2GraphSensors.0 > /dev/null 2>&1
|
||||
RC=$?
|
||||
RC=0
|
||||
if [ ! "$RC" != "0" ] ; then
|
||||
FILE=`basename $0`
|
||||
DIR=`dirname $0`
|
||||
HOSTNAME=`host $IP | sed s/.*pointer//\ `
|
||||
HOSTNAME=`echo $HOSTNAME | sed -e 's/\.$//'`
|
||||
LINKDIR="/etc/munin/plugins/"
|
||||
LINKFILE=`echo $FILE | sed s/__/_$HOSTNAME_/`
|
||||
echo file $FILE dir $DIR hostname $HOSTNAME linkdir $LINKDIR linkfile $LINKFILE
|
||||
#echo "ln -s $DIR/$FILE $LINKNAME"
|
||||
fi
|
||||
|
||||
unset SNMPCLIENT
|
||||
fi
|
||||
done
|
||||
exit
|
||||
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
# some fix values
|
||||
echo "host_name $SNMPCLIENT"
|
||||
echo 'graph_category Other'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
|
||||
# some variables, fetched from the device
|
||||
GRAPH_TITLE=`$SNMPGET WebGraph-2xThermometer-MIB::wtWebioAn2GraphDeviceName.0 | sed s/.*STRING:// | sed s/\"//g`
|
||||
GRAPH_INFO=`$SNMPGET WebGraph-2xThermometer-MIB::wtWebioAn2GraphDeviceText.0 | sed s/.*STRING:// | sed s/\"//g`
|
||||
GRAPH_VLABEL=`$SNMPGET WebGraph-2xThermometer-MIB::wtWebioAn2GraphDeviceLocation.0 | sed s/.*STRING:// | sed s/\"//g`
|
||||
SENSOR_1_LABEL=`$SNMPGET WebGraph-2xThermometer-MIB::wtWebioAn2GraphPortName.1 | sed s/.*STRING:// | sed s/\"//g`
|
||||
SENSOR_2_LABEL=`$SNMPGET WebGraph-2xThermometer-MIB::wtWebioAn2GraphPortName.2 | sed s/.*STRING:// | sed s/\"//g`
|
||||
SENSOR_1_CRITICAL=`$SNMPGET WebGraph-2xThermometer-MIB::wtWebioAn2GraphAlarmMax.1 | sed s/.*STRING:// | sed s/\"//g`
|
||||
SENSOR_2_CRITICAL=`$SNMPGET WebGraph-2xThermometer-MIB::wtWebioAn2GraphAlarmMax.2 | sed s/.*STRING:// | sed s/\"//g`
|
||||
|
||||
# echo the result to munin
|
||||
echo "graph_title $GRAPH_TITLE"
|
||||
echo "graph_info $GRAPH_INFO"
|
||||
echo "graph_vlabel $GRAPH_VLABEL"
|
||||
echo "Sensor_1.label $SENSOR_1_LABEL"
|
||||
echo "Sensor_2.label $SENSOR_2_LABEL"
|
||||
echo "Sensor_1.critical $SENSOR_1_CRITICAL"
|
||||
echo "Sensor_2.critical $SENSOR_2_CRITICAL"
|
||||
echo 'Sensor_1.min 0'
|
||||
echo 'Sensor_2.min 0'
|
||||
echo 'Sensor_1.graph yes'
|
||||
echo 'Sensor_2.graph yes'
|
||||
else
|
||||
|
||||
Sensor_1=`$SNMPGET WebGraph-2xThermometer-MIB::wtWebioAn2GraphTempValue.1 | sed s/.*STRING:// | sed s/\"//g | sed s/,/./`
|
||||
Sensor_2=`$SNMPGET WebGraph-2xThermometer-MIB::wtWebioAn2GraphTempValue.2 | sed s/.*STRING:// | sed s/\"//g | sed s/,/./`
|
||||
echo Sensor_1.value $Sensor_1
|
||||
echo Sensor_2.value $Sensor_2
|
||||
fi
|
59
plugins/snmp/snmp_hplj2015
Executable file
59
plugins/snmp/snmp_hplj2015
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
|
||||
HOST=${host:-"127.0.0.1"}
|
||||
|
||||
: << =cut
|
||||
|
||||
=head1 NAME
|
||||
|
||||
snmp_HPLJ2015 - Consumables level on HP LaserJet 2015n reported over SNMP
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
HOST
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Oleksiy Kochkin
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
As is.
|
||||
|
||||
=back
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=cut
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
|
||||
echo "graph_title Consumables level @ $HOST"
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_category printers'
|
||||
echo 'graph_scale no'
|
||||
echo 'black.label Black toner level'
|
||||
echo 'black.draw LINE2'
|
||||
echo 'black.type GAUGE'
|
||||
echo 'black.colour 000000'
|
||||
echo 'black.warning 5:'
|
||||
echo 'black.critical 1:'
|
||||
echo 'black.min 0'
|
||||
echo 'black.max 100'
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
BLACK_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.1"
|
||||
BLACK_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.1"
|
||||
|
||||
BLACK_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_MAX_OID`
|
||||
BLACK_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_LVL_OID`
|
||||
BLACK_LVL_PERCENTS=$(($BLACK_LVL*100/$BLACK_MAX))
|
||||
|
||||
echo -n "black.value "
|
||||
echo $BLACK_LVL_PERCENTS
|
59
plugins/snmp/snmp_hplj4xxx
Executable file
59
plugins/snmp/snmp_hplj4xxx
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
|
||||
HOST=${host:-"127.0.0.1"}
|
||||
|
||||
: << =cut
|
||||
|
||||
=head1 NAME
|
||||
|
||||
snmp_HPLJ2015 - Consumables level on HP LaserJet 2015n reported over SNMP
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
HOST
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Oleksiy Kochkin
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
As is.
|
||||
|
||||
=back
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=cut
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
|
||||
echo "graph_title Consumables level @ $HOST"
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_category printers'
|
||||
echo 'graph_scale no'
|
||||
echo 'black.label Black toner level'
|
||||
echo 'black.draw LINE2'
|
||||
echo 'black.type GAUGE'
|
||||
echo 'black.colour 000000'
|
||||
echo 'black.warning 5:'
|
||||
echo 'black.critical 1:'
|
||||
echo 'black.min 0'
|
||||
echo 'black.max 100'
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
BLACK_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.1"
|
||||
BLACK_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.1"
|
||||
|
||||
BLACK_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_MAX_OID`
|
||||
BLACK_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_LVL_OID`
|
||||
BLACK_LVL_PERCENTS=$(($BLACK_LVL*100/$BLACK_MAX))
|
||||
|
||||
echo -n "black.value "
|
||||
echo $BLACK_LVL_PERCENTS
|
174
plugins/snmp/snmp_memory
Executable file
174
plugins/snmp/snmp_memory
Executable file
|
@ -0,0 +1,174 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2006 Lars Strand
|
||||
#
|
||||
# Munin plugin to monitor memory usage by use of SNMP.
|
||||
# Based on snmp__df plugin.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "index 1.3.6.1.2.1.25.5.1.1.2.\n";
|
||||
print "require 1.3.6.1.2.1.25.5.1.1.2. [1-9]\n";
|
||||
print "require 1.3.6.1.2.1.25.2.2.0\n"; # memsize
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_memory$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
# memory usage pr. process
|
||||
my $hrSWRunPerfMem = "1.3.6.1.2.1.25.5.1.1.2.";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
# total memory
|
||||
my $memsize = &get_single($session, "1.3.6.1.2.1.25.2.2.0") * 1024;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
print "graph_title Memory usage\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_vlabel Bytes\n";
|
||||
print "graph_info This grap shows memory usage.\n";
|
||||
|
||||
# some devices reports negative memtotal value
|
||||
print "# Total memsize reported $memsize..." if $DEBUG;
|
||||
|
||||
if ($memsize > 0)
|
||||
{
|
||||
print "graph_args --base 1024 -l 0 --upper-limit $memsize\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "graph_args --base 1024 -l 0\n";
|
||||
}
|
||||
|
||||
print "memory.draw AREA\n";
|
||||
print "memory.label memory\n";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $processes = get_by_regex($session, $hrSWRunPerfMem, "[1-9]");
|
||||
|
||||
# the values
|
||||
my $memtotal = 0;
|
||||
while (my ($pid, $mem) = each(%$processes)) {
|
||||
$memtotal += $mem;
|
||||
}
|
||||
$memtotal*=1024;
|
||||
printf "memory.value $memtotal\n";
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my $handle = shift;
|
||||
my $oid = shift;
|
||||
|
||||
print "# Getting single $oid..." if $DEBUG;
|
||||
|
||||
$response = $handle->get_request ($oid);
|
||||
|
||||
if (!defined $response->{$oid})
|
||||
{
|
||||
print "undef\n" if $DEBUG;
|
||||
return undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "\"$response->{$oid}\"\n" if $DEBUG;
|
||||
return $response->{$oid};
|
||||
}
|
||||
}
|
||||
|
||||
sub get_by_regex
|
||||
{
|
||||
my $handle = shift;
|
||||
my $oid = shift;
|
||||
my $regex = shift;
|
||||
my $result = {};
|
||||
my $num = 0;
|
||||
my $ret = $oid . "0";
|
||||
my $response;
|
||||
|
||||
print "# Starting browse of $oid...\n" if $DEBUG;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if ($num == 0)
|
||||
{
|
||||
print "# Checking for $ret...\n" if $DEBUG;
|
||||
$response = $handle->get_request ($ret);
|
||||
}
|
||||
if ($num or !defined $response)
|
||||
{
|
||||
print "# Checking for sibling of $ret...\n" if $DEBUG;
|
||||
$response = $handle->get_next_request ($ret);
|
||||
}
|
||||
if (!$response)
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
my @keys = keys %$response;
|
||||
$ret = $keys[0];
|
||||
print "# Analyzing $ret (compared to $oid)...\n" if $DEBUG;
|
||||
last unless ($ret =~ /^$oid/);
|
||||
$num++;
|
||||
next unless ($response->{$ret} =~ /$regex/);
|
||||
@keys = split (/\./, $ret);
|
||||
$result->{$keys[-1]} = $response->{$ret};;
|
||||
print "# Index $num: ", $keys[-1], " (", $response->{$ret}, ")\n" if $DEBUG;
|
||||
};
|
||||
return $result;
|
||||
}
|
59
plugins/snmp/snmp_xerox3xxx
Executable file
59
plugins/snmp/snmp_xerox3xxx
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
|
||||
HOST=${host:-"127.0.0.1"}
|
||||
|
||||
: << =cut
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Xerox-WC3220 - Plugin to monitor consumables level on Xerox WorkCentre 3xxx series
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
HOST
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Oleksiy Kochkin
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
As is.
|
||||
|
||||
=back
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=cut
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
|
||||
echo "graph_title Consumables level @ $HOST"
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_category printers'
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_scale no'
|
||||
echo 'black.label Black toner level'
|
||||
echo 'black.draw LINE2'
|
||||
echo 'black.type GAUGE'
|
||||
echo 'black.colour 000000'
|
||||
echo 'black.warning 5:'
|
||||
echo 'black.critical 1:'
|
||||
echo 'black.min 0'
|
||||
echo 'black.max 100'
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
BLACK_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.1"
|
||||
BLACK_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.1"
|
||||
|
||||
BLACK_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_MAX_OID`
|
||||
BLACK_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_LVL_OID`
|
||||
BLACK_LVL_PERCENTS=$(($BLACK_LVL*100/$BLACK_MAX))
|
||||
|
||||
echo -n "black.value "
|
||||
echo $BLACK_LVL_PERCENTS
|
127
plugins/snmp/snmp_xerox_wc-7x32
Executable file
127
plugins/snmp/snmp_xerox_wc-7x32
Executable file
|
@ -0,0 +1,127 @@
|
|||
#!/bin/bash
|
||||
|
||||
HOST=${host:-"127.0.0.1"}
|
||||
|
||||
: << =cut
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Xerox-WC7x32-consumables - Plugin to monitor consumables level on Xerox WorkCentre 7x32 series printers
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
host
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Oleksiy Kochkin
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
As is.
|
||||
|
||||
=back
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=cut
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
|
||||
echo "graph_title Consumables level @ $HOST"
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_category printers'
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_scale no'
|
||||
echo 'cyan.label Cyan toner level'
|
||||
echo 'cyan.draw LINE2'
|
||||
echo 'cyan.type GAUGE'
|
||||
echo 'cyan.colour 1921B1'
|
||||
echo 'cyan.warning 5:'
|
||||
echo 'cyan.critical 1:'
|
||||
echo 'cyan.min 0'
|
||||
echo 'cyan.max 100'
|
||||
echo 'magenta.label Magenta toner level'
|
||||
echo 'magenta.draw LINE2'
|
||||
echo 'magenta.type GAUGE'
|
||||
echo 'magenta.colour C00086'
|
||||
echo 'magenta.warning 5:'
|
||||
echo 'magenta.critical 1:'
|
||||
echo 'magenta.min 0'
|
||||
echo 'magenta.max 100'
|
||||
echo 'yellow.label Yellow toner level'
|
||||
echo 'yellow.draw LINE2'
|
||||
echo 'yellow.type GAUGE'
|
||||
echo 'yellow.colour FECD00'
|
||||
echo 'yellow.warning 5:'
|
||||
echo 'yellow.critical 1:'
|
||||
echo 'yellow.min 0'
|
||||
echo 'yellow.max 100'
|
||||
echo 'black.label Black toner level'
|
||||
echo 'black.draw LINE2'
|
||||
echo 'black.type GAUGE'
|
||||
echo 'black.colour 000000'
|
||||
echo 'black.warning 5:'
|
||||
echo 'black.critical 1:'
|
||||
echo 'black.min 0'
|
||||
echo 'black.max 100'
|
||||
echo 'drum.label Drum unit resource left'
|
||||
echo 'drum.draw LINE2'
|
||||
echo 'drum.type GAUGE'
|
||||
echo 'drum.colour 00C12B'
|
||||
echo 'drum.warning 5:'
|
||||
echo 'drum.critical 1:'
|
||||
echo 'drum.min 0'
|
||||
echo 'drum.max 100'
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
BLACK_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.1"
|
||||
BLACK_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.1"
|
||||
YELLOW_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.2"
|
||||
YELLOW_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.2"
|
||||
MAGENTA_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.3"
|
||||
MAGENTA_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.3"
|
||||
CYAN_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.4"
|
||||
CYAN_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.4"
|
||||
DRUM_MAX_OID=".1.3.6.1.2.1.43.11.1.1.8.1.24"
|
||||
DRUM_LVL_OID=".1.3.6.1.2.1.43.11.1.1.9.1.24"
|
||||
|
||||
BLACK_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_MAX_OID`
|
||||
BLACK_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $BLACK_LVL_OID`
|
||||
BLACK_LVL_PERCENTS=$(($BLACK_LVL*100/$BLACK_MAX))
|
||||
|
||||
YELLOW_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $YELLOW_MAX_OID`
|
||||
YELLOW_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $YELLOW_LVL_OID`
|
||||
YELLOW_LVL_PERCENTS=$(($YELLOW_LVL*100/$YELLOW_MAX))
|
||||
|
||||
MAGENTA_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $MAGENTA_MAX_OID`
|
||||
MAGENTA_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $MAGENTA_LVL_OID`
|
||||
MAGENTA_LVL_PERCENTS=$(($MAGENTA_LVL*100/$MAGENTA_MAX))
|
||||
|
||||
CYAN_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $CYAN_MAX_OID`
|
||||
CYAN_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $CYAN_LVL_OID`
|
||||
CYAN_LVL_PERCENTS=$(($CYAN_LVL*100/$CYAN_MAX))
|
||||
|
||||
DRUM_MAX=`snmpget -v 1 -c public -Ov -Oq $HOST $DRUM_MAX_OID`
|
||||
DRUM_LVL=`snmpget -v 1 -c public -Ov -Oq $HOST $DRUM_LVL_OID`
|
||||
DRUM_LVL_PERCENTS=$(($DRUM_LVL*100/$DRUM_MAX))
|
||||
|
||||
echo -n "cyan.value "
|
||||
echo $CYAN_LVL_PERCENTS
|
||||
|
||||
echo -n "magenta.value "
|
||||
echo $MAGENTA_LVL_PERCENTS
|
||||
|
||||
echo -n "yellow.value "
|
||||
echo $YELLOW_LVL_PERCENTS
|
||||
|
||||
echo -n "black.value "
|
||||
echo $BLACK_LVL_PERCENTS
|
||||
|
||||
echo -n "drum.value "
|
||||
echo $DRUM_LVL_PERCENTS
|
139
plugins/snmp/snmp_zyxel_usg__cpu
Executable file
139
plugins/snmp/snmp_zyxel_usg__cpu
Executable file
|
@ -0,0 +1,139 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2009 Branislav Bozgai
|
||||
#
|
||||
# Munin plugin to monitor ZyXel USG series routers CPU utilization.
|
||||
# Based on snmp__if_ plugin.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.4.1.890.1.6.22.1.1.0 \n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_zyxel_usg_([^_]+)_cpu$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $sysCPUUsage = "1.3.6.1.4.1.890.1.6.22.1.1.0";
|
||||
my $sysCPU5SecUsage = "1.3.6.1.4.1.890.1.6.22.1.3.0";
|
||||
my $sysCPU1MinUsage = "1.3.6.1.4.1.890.1.6.22.1.4.0";
|
||||
my $sysCPU5MinUsage = "1.3.6.1.4.1.890.1.6.22.1.5.0";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
if (!defined ($response = $session->get_request($sysCPUUsage)))
|
||||
{
|
||||
die "Croaking: " . $session->error();
|
||||
}
|
||||
print "graph_title CPU usage\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
|
||||
print "graph_vlabel %\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_period second\n";
|
||||
print "graph_info CPU usage\n";
|
||||
print "sysCPUUsage.label CPU Usage\n";
|
||||
print "sysCPU5SecUsage.label CPU 5 sec Avg Usage\n";
|
||||
print "sysCPU1MinUsage.label CPU 1 min Avg Usage\n";
|
||||
print "sysCPU5MinUsage.label CPU 5 min Avg Usage\n";
|
||||
print "sysCPUUsage.draw AREA\n";
|
||||
print "sysCPU5SecUsage.draw AREA\n";
|
||||
print "sysCPU1MinUsage.draw AREA\n";
|
||||
print "sysCPU5MinUsage.draw AREA\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
if (defined ($response = $session->get_request($sysCPUUsage)))
|
||||
{
|
||||
print "sysCPUUsage.value ", $response->{$sysCPUUsage}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysCPUUsage.value U\n";
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($sysCPU5SecUsage)))
|
||||
{
|
||||
print "sysCPU5SecUsage.value ", $response->{$sysCPU5SecUsage}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysCPU5SecUsage.value U\n";
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($sysCPU1MinUsage)))
|
||||
{
|
||||
print "sysCPU1MinUsage.value ", $response->{$sysCPU1MinUsage}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysCPU1MinUsage.value U\n";
|
||||
}
|
||||
|
||||
if (defined ($response = $session->get_request($sysCPU5MinUsage)))
|
||||
{
|
||||
print "sysCPU5MinUsage.value ", $response->{$sysCPU5MinUsage}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysCPU5MinUsage.value U\n";
|
||||
}
|
||||
|
||||
|
||||
# vim:syntax=perl
|
102
plugins/snmp/snmp_zyxel_usg__ram
Executable file
102
plugins/snmp/snmp_zyxel_usg__ram
Executable file
|
@ -0,0 +1,102 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2009 Branislav Bozgai
|
||||
#
|
||||
# Munin plugin to monitor ZyXel USG series routers RAM utilization.
|
||||
# Based on snmp__if_ plugin.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.4.1.890.1.6.22.1.2.0 \n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_zyxel_usg_([^_]+)_ram$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $sysRAMUsage = "1.3.6.1.4.1.890.1.6.22.1.2.0";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
if (!defined ($response = $session->get_request($sysRAMUsage)))
|
||||
{
|
||||
die "Croaking: " . $session->error();
|
||||
}
|
||||
print "graph_title RAM usage\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
|
||||
print "graph_vlabel %\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_period second\n";
|
||||
print "graph_info RAM usage\n";
|
||||
print "sysRAMUsage.label RAM Usage\n";
|
||||
print "sysRAMUsage.draw AREA\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
if (defined ($response = $session->get_request($sysRAMUsage)))
|
||||
{
|
||||
print "sysRAMUsage.value ", $response->{$sysRAMUsage}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysRAMUsage.value U\n";
|
||||
}
|
||||
|
||||
# vim:syntax=perl
|
101
plugins/snmp/snmp_zyxel_usg__sessions
Executable file
101
plugins/snmp/snmp_zyxel_usg__sessions
Executable file
|
@ -0,0 +1,101 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2009 Branislav Bozgai
|
||||
#
|
||||
# Munin plugin to monitor ZyXel USG series routers Sessions utilization.
|
||||
# Based on snmp__if_ plugin.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.4.1.890.1.6.22.1.6.0 \n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_zyxel_usg_([^_]+)_sessions$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $sysActiveSessions = "1.3.6.1.4.1.890.1.6.22.1.6.0";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
if (!defined ($response = $session->get_request($sysActiveSessions)))
|
||||
{
|
||||
die "Croaking: " . $session->error();
|
||||
}
|
||||
print "graph_title Active Sessions\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_args --base 1000 --lower-limit 0\n";
|
||||
print "graph_vlabel Active Sessions\n";
|
||||
print "graph_period second\n";
|
||||
print "graph_info Active Sessions\n";
|
||||
print "sysActiveSessions.label Sessions\n";
|
||||
print "sysActiveSessions.draw AREA\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
if (defined ($response = $session->get_request($sysActiveSessions)))
|
||||
{
|
||||
print "sysActiveSessions.value ", $response->{$sysActiveSessions}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysActiveSessions.value U\n";
|
||||
}
|
||||
|
||||
# vim:syntax=perl
|
102
plugins/snmp/snmp_zyxel_zywall__cpu
Executable file
102
plugins/snmp/snmp_zyxel_zywall__cpu
Executable file
|
@ -0,0 +1,102 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2009 Branislav Bozgai
|
||||
#
|
||||
# Munin plugin to monitor ZyXel ZyWall series routers CPU utilization.
|
||||
# Based on snmp__if_ plugin.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.4.1.890.1.6.1.1.1.0 \n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_zyxel_zywall_([^_]+)_cpu$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $sysCPUUsage = "1.3.6.1.4.1.890.1.6.1.1.1.0";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
if (!defined ($response = $session->get_request($sysCPUUsage)))
|
||||
{
|
||||
die "Croaking: " . $session->error();
|
||||
}
|
||||
print "graph_title CPU usage\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
|
||||
print "graph_vlabel %\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_period second\n";
|
||||
print "graph_info CPU usage\n";
|
||||
print "sysCPUUsage.label CPU Usage\n";
|
||||
print "sysCPUUsage.draw AREA\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
if (defined ($response = $session->get_request($sysCPUUsage)))
|
||||
{
|
||||
print "sysCPUUsage.value ", $response->{$sysCPUUsage}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysCPUUsage.value U\n";
|
||||
}
|
||||
|
||||
# vim:syntax=perl
|
102
plugins/snmp/snmp_zyxel_zywall__flash
Executable file
102
plugins/snmp/snmp_zyxel_zywall__flash
Executable file
|
@ -0,0 +1,102 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2009 Branislav Bozgai
|
||||
#
|
||||
# Munin plugin to monitor ZyXel ZyWall series routers Flash memory utilization.
|
||||
# Based on snmp__if_ plugin.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.4.1.890.1.6.1.1.2.0 \n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_zyxel_zywall_([^_]+)_flash$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $sysFLASHUsage = "1.3.6.1.4.1.890.1.6.1.1.2.0";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
if (!defined ($response = $session->get_request($sysFLASHUsage)))
|
||||
{
|
||||
die "Croaking: " . $session->error();
|
||||
}
|
||||
print "graph_title FLASH usage\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
|
||||
print "graph_vlabel %\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_period second\n";
|
||||
print "graph_info FLASH usage\n";
|
||||
print "sysFLASHUsage.label FLASH Usage\n";
|
||||
print "sysFLASHUsage.draw AREA\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
if (defined ($response = $session->get_request($sysFLASHUsage)))
|
||||
{
|
||||
print "sysFLASHUsage.value ", $response->{$sysFLASHUsage}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysFLASHUsage.value U\n";
|
||||
}
|
||||
|
||||
# vim:syntax=perl
|
102
plugins/snmp/snmp_zyxel_zywall__ram
Executable file
102
plugins/snmp/snmp_zyxel_zywall__ram
Executable file
|
@ -0,0 +1,102 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2009 Branislav Bozgai
|
||||
#
|
||||
# Munin plugin to monitor ZyXel ZyWall series routers RAM utilization.
|
||||
# Based on snmp__if_ plugin.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.4.1.890.1.6.1.1.3.0 \n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_zyxel_zywall_([^_]+)_ram$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $sysRAMUsage = "1.3.6.1.4.1.890.1.6.1.1.3.0";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
if (!defined ($response = $session->get_request($sysRAMUsage)))
|
||||
{
|
||||
die "Croaking: " . $session->error();
|
||||
}
|
||||
print "graph_title RAM usage\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
|
||||
print "graph_vlabel %\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_period second\n";
|
||||
print "graph_info RAM usage\n";
|
||||
print "sysRAMUsage.label RAM Usage\n";
|
||||
print "sysRAMUsage.draw AREA\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
if (defined ($response = $session->get_request($sysRAMUsage)))
|
||||
{
|
||||
print "sysRAMUsage.value ", $response->{$sysRAMUsage}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysRAMUsage.value U\n";
|
||||
}
|
||||
|
||||
# vim:syntax=perl
|
101
plugins/snmp/snmp_zyxel_zywall__sessions
Executable file
101
plugins/snmp/snmp_zyxel_zywall__sessions
Executable file
|
@ -0,0 +1,101 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2009 Branislav Bozgai
|
||||
#
|
||||
# Munin plugin to monitor ZyXel ZyWall series routers Sessions utilization.
|
||||
# Based on snmp__if_ plugin.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "require 1.3.6.1.4.1.890.1.6.1.1.4.0\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_zyxel_zywall_([^_]+)_sessions$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
my $sysActiveSessions = "1.3.6.1.4.1.890.1.6.1.1.4.0";
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
if (!defined ($response = $session->get_request($sysActiveSessions)))
|
||||
{
|
||||
die "Croaking: " . $session->error();
|
||||
}
|
||||
print "graph_title Active Sessions\n";
|
||||
print "graph_category system\n";
|
||||
print "graph_args --base 1000 --lower-limit 0\n";
|
||||
print "graph_vlabel Active Sessions\n";
|
||||
print "graph_period second\n";
|
||||
print "graph_info Active Sessions\n";
|
||||
print "sysActiveSessions.label Sessions\n";
|
||||
print "sysActiveSessions.draw AREA\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
if (defined ($response = $session->get_request($sysActiveSessions)))
|
||||
{
|
||||
print "sysActiveSessions.value ", $response->{$sysActiveSessions}, "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "sysActiveSessions.value U\n";
|
||||
}
|
||||
|
||||
# vim:syntax=perl
|
Loading…
Add table
Add a link
Reference in a new issue