summaryrefslogtreecommitdiffstats
path: root/contrib/check_fan_fsc_present
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/check_fan_fsc_present')
-rw-r--r--contrib/check_fan_fsc_present135
1 files changed, 0 insertions, 135 deletions
diff --git a/contrib/check_fan_fsc_present b/contrib/check_fan_fsc_present
deleted file mode 100644
index 19f8e7f0..00000000
--- a/contrib/check_fan_fsc_present
+++ /dev/null
@@ -1,135 +0,0 @@
1#!/usr/bin/perl
2#
3#
4# check_most.pl -i <ip address> -p <port> -c community -o <oid> [warn] [critical]
5#
6# NetSaint host script to get the disk usage from NT snmp
7#
8# Changes and Modifications
9# =========================
10# 3-Aug-2000 - Xavier Dusart
11# Created
12# 2003 - Rainer Duffner
13
14BEGIN {
15 if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) {
16 $runtimedir = $1;
17 $PROGNAME = $2;
18 }
19}
20
21
22
23require 5.004;
24use POSIX;
25#use strict;
26use Getopt::Std ;
27use BER;
28require 'SNMP_Session.pm';
29use vars qw($opt_H $opt_p $opt_C $opt_f $opt_h $PROGNAME);
30use lib $main::runtimedir;
31use utils qw($TIMEOUT %ERRORS &print_revision &usage &support);
32use snmputil qw(%FSC_LOCALE %FSC_FAN_STATUS);
33
34delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
35
36getopts('H:p:C:f:hV') ;
37
38my $ip_address=undef ;
39
40if ($opt_h) {&help();}
41
42if ($opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]*(\.[a-zA-Z][-a-zA
43-Z0-9]*)*)$/) {
44 $ip_address = $opt_H ;
45 }
46else {
47 usage();
48 print "IP-Address format wrong\n";
49 exit $ERRORS{'UNKNOWN'};
50 }
51
52#if ($opt_p =~ m/^[0-9]
53
54my $port = $opt_p;
55
56my $community = $opt_C;
57
58my $fan = $opt_f ;
59
60#my $err_counter=0 ;
61#my $err_status="";
62
63 my $fan_locale_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,4,0,$fan-1 );
64# not used for the moment - gives no usable output
65# if reused, enter at end of list to avoid renumbering !
66 my $fan_cur_speed_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,8,0,$fan-1 );
67 my $fan_nom_max_speed_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,9,0,$fan-1 );
68 my $fan_cur_max_speed_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,10,0,$fan-1 );
69 my $fan_condition_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,3,0,$fan-1 );
70 my $count=1 ;
71 my $label ;
72 my @r_array=();
73 my $q ;
74 my $diff ;
75 $warning=$warning/100 ;
76 $crititcal=$critical/100 ;
77
78
79# get temperature, temperature_threshold bfore shutdown
80 my $session=SNMP_Session->open ($ip_address, $community, $port) || die "couldn't open SNMP-session to host" ;
81
82 if ($session->get_request_response ($fan_locale_oid, $fan_cur_speed_oid, $fan_nom_max_speed_oid, $fan_cur_max_speed_oid, $fan_condition_oid )) {
83 (my $bindings) = $session->decode_get_response ($session->{pdu_buffer});
84 while ($bindings ne '') {
85 ($binding, $bindings) = &decode_sequence ($bindings) ;
86 ($oid,$value) = &decode_by_template ($binding,"%O%@");
87 $r_array[$count]=&pretty_print($value);
88 $count++;
89 }
90 } else {
91 print "No response from agent\n";
92 exit $ERRORS{'CRITICAL'};
93 }
94 $result_fan_locale= $r_array[1];
95 $result_fan_cur_speed= $r_array[2];
96 $result_fan_nom_max_speed= $r_array[3];
97 $result_fan_cur_max_speed= $r_array[4];
98 $result_fan_condition=$r_array[5];
99
100
101 if ( $result_fan_condition != "3" ) {
102 print "Fan ". $fan . " ".$FSC_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - Critical: Cur./Nom./Cur-Max-Speed: ". $result_fan_cur_speed."/". $result_fan_nom_max_speed."/".$result_fan_cur_max_speed.". Overall condition: ". $FSC_FAN_STATUS{$result_fan_condition} ."\n" ;
103 exit $ERRORS{'CRITICAL'} ;
104 }
105 else {
106 print "Fan " .$fan . " ".$FSC_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - OK: Cur./Nom./Cur-Max-Speed: ". $result_fan_cur_speed."/". $result_fan_nom_max_speed."/".$result_fan_cur_max_speed.". Overall condition: ". $FSC_FAN_STATUS{$result_fan_condition} ."\n" ;
107 exit $ERRORS{'OK'} ;
108 }
109
110
111sub print_usage () {
112 print "Usage: $PROGNAME -H <host> -p <port> -C <community> -f <fannumber>\n";
113 }
114
115sub print_help () {
116 print_revision($PROGNAME,'$Revision: 1113 $\n ');
117 print "Copyright (c) 2003 Rainer Duffner\n ";
118 print_usage();
119 print "\n";
120 print "<host> = IP-Address or DNS-Name of the W2K-Server\n";
121 print "<port> = SNMP-Port (normaly 161)\n";
122 print "<community> = SNMP v1 community\n";
123 print "<fannumber> = Fannumber (1, 2, 3 etc.)\n";
124 }
125
126sub version () {
127 print_revision($PROGNAME,'$Revision: 1113 $ ');
128 exit $ERRORS{'OK'};
129}
130
131sub help () {
132 print_help();
133 exit $ERRORS{'OK'};
134}
135