1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-09-18 16:48:44 +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:
Diego Elio Pettenò 2012-08-06 21:33:00 -07:00
parent 2fc9c2400b
commit 7da1b039c2
45 changed files with 0 additions and 0 deletions

View file

@ -1,181 +0,0 @@
#!/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};
}
}

View file

@ -1,213 +0,0 @@
#!/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};
}
}

View file

@ -1,92 +0,0 @@
#!/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