mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
d7e8315462
Right now this produces two graphs: memory and session allocation. CPU time will be added shortly.
130 lines
3.1 KiB
Perl
Executable File
130 lines
3.1 KiB
Perl
Executable File
#!/usr/bin/perl -w
|
|
# -*- perl -*-
|
|
|
|
=head1 NAME
|
|
|
|
snmp__screenos_ - SNMP plugin to monitor Juniper ScreenOS based routers
|
|
|
|
=head1 APPLICABLE SYSTEMS
|
|
|
|
This has been developed against a Juniper SSG5-Serial router, but
|
|
should work with any ScreenOS-based router as manufactured by Juniper.
|
|
|
|
Using a command such as "munin-node-configure --snmp
|
|
switch.langfeldt.net --snmpversion 2c --snmpcommunity public | sh -x"
|
|
should identify whether this plugin can apply.
|
|
|
|
|
|
=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 MIB INFORMATION
|
|
|
|
This plugin requires NETSCREEN-RESOURCE-MIB information.
|
|
|
|
=head1 MAGIC MARKERS
|
|
|
|
#%# family=snmpauto
|
|
#%# capabilities=snmpconf
|
|
|
|
=head1 AUTHOR
|
|
|
|
Copyright (C) 2012 Diego Elio Pettenò.
|
|
|
|
=head1 LICENSE
|
|
|
|
GPLv2
|
|
|
|
=cut
|
|
|
|
use strict;
|
|
use Munin::Plugin;
|
|
use Munin::Plugin::SNMP;
|
|
|
|
# This corresponds to NETSCREEN-SMI::netscreenResource
|
|
my $oidBase = '1.3.6.1.4.1.3224.16';
|
|
|
|
my $oidMemAllocate = $oidBase . '.2.1';
|
|
my $oidMemLeft = $oidBase . '.2.2';
|
|
my $oidSessAllocate = $oidBase . '.3.2';
|
|
my $oidSessMaximum = $oidBase . '.3.3';
|
|
my $oidSessFailed = $oidBase . '.3.4';
|
|
|
|
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
|
|
print "require $oidBase.[23].[13].0";
|
|
}
|
|
|
|
my $session = Munin::Plugin::SNMP->session();
|
|
my $data = $session->get_entries(-columns => [ $oidMemAllocate,
|
|
$oidMemLeft,
|
|
$oidSessAllocate,
|
|
$oidSessMaximum,
|
|
$oidSessFailed ]);
|
|
|
|
if ($ARGV[0] and $ARGV[0] eq "config") {
|
|
my ($host) = Munin::Plugin::SNMP->config_session();
|
|
|
|
my $memTotal = $data->{"$oidMemAllocate.0"} + $data->{"$oidMemLeft.0"};
|
|
|
|
# this is the closet I can get to the yellow/red on the ScreenOS
|
|
# interface.
|
|
my $memWarning = int($memTotal * 0.75 + 0.5);
|
|
my $memCritical = int($memTotal * 0.85 + 0.5);
|
|
my $sessWarning = int($data->{"$oidSessMaximum.0"} * 0.75 + 0.5);
|
|
my $sessCritical = int($data->{"$oidSessMaximum.0"} * 0.85 + 0.5);
|
|
|
|
print <<END;
|
|
host_name $host
|
|
|
|
multigraph screenos_memory
|
|
graph_title Memory allocation
|
|
graph_vlabel bytes
|
|
graph_args --base 1024
|
|
graph_category system
|
|
|
|
memory.label Memory
|
|
memory.min 0
|
|
memory.max $memTotal
|
|
memory.warning $memWarning
|
|
memory.critical $memCritical
|
|
|
|
multigraph screenos_sessions
|
|
graph_title Sessions allocation
|
|
graph_vlabel Count
|
|
graph_category system
|
|
|
|
sessions.label Active Sessions
|
|
sessions.min 0
|
|
sessions.max $data->{"$oidSessMaximum.0"}
|
|
sessions.warning $sessWarning
|
|
sessions.critical $sessCritical
|
|
failed.label Failed Sessions
|
|
failed.min 0
|
|
failed.critical 1
|
|
END
|
|
|
|
exit 0;
|
|
}
|
|
|
|
print <<END;
|
|
multigraph screenos_memory
|
|
memory.value $data->{"$oidMemAllocate.0"}
|
|
|
|
multigraph screenos_sessions
|
|
sessions.value $data->{"$oidSessAllocate.0"}
|
|
failed.value $data->{"$oidSessFailed.0"}
|
|
END
|