diff options
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | contrib/check_disk_snmp.pl | 74 |
2 files changed, 2 insertions, 74 deletions
@@ -3,6 +3,8 @@ This file documents the major additions and syntax changes between releases. | |||
3 | 1.4.4 | 3 | 1.4.4 |
4 | New C based check_ntp. The perl version is now deprecated. | 4 | New C based check_ntp. The perl version is now deprecated. |
5 | New check_apt plugin | 5 | New check_apt plugin |
6 | Notice: plugins in contrib/ will start to be removed from this distribution. | ||
7 | Please check at http://www.nagiosexchange.org for contributed plugins | ||
6 | 8 | ||
7 | 1.4.3 | 9 | 1.4.3 |
8 | Setuid plugins (check_dhcp, check_icmp) separated into plugins-root/. Run make install as root to install | 10 | Setuid plugins (check_dhcp, check_icmp) separated into plugins-root/. Run make install as root to install |
diff --git a/contrib/check_disk_snmp.pl b/contrib/check_disk_snmp.pl deleted file mode 100644 index a09343d..0000000 --- a/contrib/check_disk_snmp.pl +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # cm@financial.com 07/2002 | ||
3 | use strict; | ||
4 | use Net::SNMP; | ||
5 | use Getopt::Std; | ||
6 | |||
7 | my %opts =( | ||
8 | u => 'nobody', # snmp user | ||
9 | l => 'authNoPriv', # snmp security level | ||
10 | a => 'MD5', # snmp authentication protocol | ||
11 | A => 'nopass', # authentication protocol pass phrase. | ||
12 | x => 'DES', # privacy protocol | ||
13 | m => 'localhost', # host | ||
14 | d => 1, # devicenumber | ||
15 | w => 70, # warnratio | ||
16 | c => 85, # critical ratio | ||
17 | h => 0, | ||
18 | ); | ||
19 | |||
20 | getopts('m:u:l:a:A:x:d:w:c:h',\%opts); | ||
21 | |||
22 | if ( $opts{'h'} ) { | ||
23 | print "Usage: $0 [ -u <username> ] [ -l <snmp security level>] [ -a <snmp authentication protocol> ] [ -A <authentication protocol pass phrase> ] [ -x <snmp privacy protocol> ] [ -m <hostname>] [ -d <devicenumber> ] [ -w <warning ratio> ] [ -c <critical ratio ]\n"; | ||
24 | exit 1; | ||
25 | } | ||
26 | |||
27 | if ($opts{'w'} >= $opts{'c'}) { | ||
28 | print "Errorratio must be higher then Warnratio!\n"; | ||
29 | exit 1; | ||
30 | } | ||
31 | |||
32 | my ($session, $error) = Net::SNMP->session( | ||
33 | -hostname => $opts{'m'}, | ||
34 | -nonblocking => 0x0, | ||
35 | -username => $opts{'u'}, | ||
36 | -authpassword => $opts{'A'}, | ||
37 | -authprotocol => $opts{'a'}, | ||
38 | -version => '3', | ||
39 | ); | ||
40 | |||
41 | if ($@) { | ||
42 | print "SNMP-Error occured"; | ||
43 | exit 1; | ||
44 | } | ||
45 | my $result=undef; | ||
46 | |||
47 | |||
48 | my $deviceSize=".1.3.6.1.2.1.25.2.3.1.5.$opts{'d'}"; | ||
49 | my $deviceUsed=".1.3.6.1.2.1.25.2.3.1.6.$opts{'d'}"; | ||
50 | my $deviceName=".1.3.6.1.2.1.25.2.3.1.3.$opts{'d'}"; | ||
51 | my @OID=($deviceSize, $deviceUsed, $deviceName); | ||
52 | $result = $session->get_request( | ||
53 | -varbindlist => \@OID, | ||
54 | ); | ||
55 | |||
56 | if (!defined($result)) { | ||
57 | printf("ERROR: %s.\n", $session->error); | ||
58 | $session->close; | ||
59 | exit 1; | ||
60 | } | ||
61 | |||
62 | my $ratio=$result->{$deviceUsed}*100/$result->{$deviceSize}; | ||
63 | |||
64 | if ($ratio > $opts{'c'}){ | ||
65 | printf("CRITICAL: %s usage %.2f%%\n", $result->{$deviceName}, $ratio); | ||
66 | exit 2; | ||
67 | } | ||
68 | if ($ratio > $opts{'w'}){ | ||
69 | printf("WARNING: %s usage %.2f%%\n", $result->{$deviceName}, $ratio); | ||
70 | exit 1; | ||
71 | } | ||
72 | |||
73 | printf("OK: %s usage %.2f%%\n", $result->{$deviceName}, $ratio); | ||
74 | exit 0; | ||