Advertisement
Guest User

Untitled

a guest
May 28th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.88 KB | None | 0 0
  1. #! /usr/bin/perl -w
  2. ################################################################################
  3. # Copyright 2004-2013 MERETHIS
  4. # Centreon is developped by : Julien Mathis and Romain Le Merlus under
  5. # GPL Licence 2.0.
  6. #
  7. # This program is free software; you can redistribute it and/or modify it under
  8. # the terms of the GNU General Public License as published by the Free Software
  9. # Foundation ; either version 2 of the License.
  10. #
  11. # This program is distributed in the hope that it will be useful, but WITHOUT ANY
  12. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  13. # PARTICULAR PURPOSE. See the GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License along with
  16. # this program; if not, see <http://www.gnu.org/licenses>.
  17. #
  18. # Linking this program statically or dynamically with other modules is making a
  19. # combined work based on this program. Thus, the terms and conditions of the GNU
  20. # General Public License cover the whole combination.
  21. #
  22. # As a special exception, the copyright holders of this program give MERETHIS
  23. # permission to link this program with independent modules to produce an executable,
  24. # regardless of the license terms of these independent modules, and to copy and
  25. # distribute the resulting executable under terms of MERETHIS choice, provided that
  26. # MERETHIS also meet, for each linked independent module, the terms and conditions
  27. # of the license of that module. An independent module is a module which is not
  28. # derived from this program. If you modify this program, you may extend this
  29. # exception to your version of the program, but you are not obliged to do so. If you
  30. # do not wish to do so, delete this exception statement from your version.
  31. #
  32. # For more information : contact@centreon.com
  33. #
  34. # SVN : $URL: http://svn.centreon.com/trunk/plugins-2.x/src/check_centreon_snmp_traffic $
  35. # SVN : $Id: check_centreon_snmp_traffic 13081 2012-06-07 09:15:11Z jmathis $
  36. #
  37. ####################################################################################
  38. #
  39. # Script init
  40. #
  41.  
  42. use strict;
  43. require "/usr/lib/nagios/plugins/Centreon/SNMP/Utils.pm";
  44.  
  45. use vars qw($PROGNAME);
  46. use Getopt::Long;
  47. use vars qw($opt_V $opt_h $opt_i $opt_n $opt_w $opt_c $opt_s $opt_T $opt_a $opt_r $opt_S);
  48.  
  49. my $centplugins_path = "/var/lib/centreon/centplugins";
  50. my %ERRORS = ('OK' => 0, 'WARNING' => 1, 'CRITICAL' => 2, 'UNKNOWN' => 3);
  51.  
  52. my %centreon = Centreon::SNMP::Utils::load_oids($ERRORS{'UNKNOWN'}, "/usr/lib/nagios/plugins/centreon.conf");
  53.  
  54. # Plugin var init
  55. my $session;
  56. my ($row, $last_check_time, $last_in_bits, $last_out_bits, @last_values, $update_time, $in_traffic, $out_traffic, $in_usage, $out_usage);
  57.  
  58. $PROGNAME = "$0";
  59.  
  60. sub print_help ();
  61. sub print_usage ();
  62.  
  63. my %OPTION = (
  64. "host" => undef,
  65. "snmp-community" => "public", "snmp-version" => 1, "snmp-port" => 161,
  66. "snmp-auth-key" => undef, "snmp-auth-user" => undef, "snmp-auth-password" => undef, "snmp-auth-protocol" => "MD5",
  67. "snmp-priv-key" => undef, "snmp-priv-password" => undef, "snmp-priv-protocol" => "DES",
  68. "maxrepetitions" => undef,
  69. "64-bits" => undef,
  70.  
  71. "disable-warn-state" => undef
  72. );
  73.  
  74. # Catch UNKNOWN From GetOptions (like -i without value)
  75. $SIG{'__WARN__'} = sub { print $_[0]; exit($ERRORS{'UNKNOWN'}); };
  76.  
  77. Getopt::Long::Configure('bundling');
  78. GetOptions
  79. (
  80. "H|hostname|host=s" => \$OPTION{'host'},
  81. "C|community=s" => \$OPTION{'snmp-community'},
  82. "v|snmp|snmp-version=s" => \$OPTION{'snmp-version'},
  83. "P|snmpport|snmp-port=i" => \$OPTION{'snmp-port'},
  84. "u|username=s" => \$OPTION{'snmp-auth-user'},
  85. "p|authpassword|password=s" => \$OPTION{'snmp-auth-password'},
  86. "k|authkey=s" => \$OPTION{'snmp-auth-key'},
  87. "authprotocol=s" => \$OPTION{'snmp-auth-protocol'},
  88. "privpassword=s" => \$OPTION{'snmp-priv-password'},
  89. "privkey=s" => \$OPTION{'snmp-priv-key'},
  90. "privprotocol=s" => \$OPTION{'snmp-priv-protocol'},
  91. "maxrepetitions=s" => \$OPTION{'maxrepetitions'},
  92. "64-bits" => \$OPTION{'64-bits'},
  93.  
  94. "disable-warn-state" => \$OPTION{'disable-warn-state'},
  95. "h" => \$opt_h, "help" => \$opt_h,
  96. "s" => \$opt_s, "show" => \$opt_s,
  97. "V" => \$opt_V, "version" => \$opt_V,
  98. "i=s" => \$opt_i, "interface=s" => \$opt_i,
  99. "n" => \$opt_n, "name" => \$opt_n,
  100. "w=s" => \$opt_w, "warning=s" => \$opt_w,
  101. "c=s" => \$opt_c, "critical=s" => \$opt_c,
  102. "T=s" => \$opt_T, "r" => \$opt_r,
  103. "S" => \$opt_S,
  104. "a=i" => \$opt_a, "cache=s" => \$opt_a);
  105.  
  106. if ($opt_V) {
  107. print_revision($PROGNAME,'$Revision: 1.3 $');
  108. exit $ERRORS{'OK'};
  109. }
  110.  
  111. if ($opt_h) {
  112. print_help();
  113. exit $ERRORS{'OK'};
  114. Getopt::Long::Configure('bundling');
  115. }
  116.  
  117. ##################################################
  118. ##### Verify Options
  119. ##
  120.  
  121. ######
  122. ### SNMP Check
  123. ##
  124. my ($session_params) = Centreon::SNMP::Utils::check_snmp_options($ERRORS{'UNKNOWN'}, \%OPTION);
  125.  
  126. ######
  127. ### Others
  128. ##
  129. if (defined($opt_n) && !defined($opt_i)) {
  130. print "Option -n (--name) need option -i (--interface)\n";
  131. exit $ERRORS{'UNKNOWN'};
  132. }
  133.  
  134. if (!defined($opt_i)) {
  135. $opt_i = 1;
  136. }
  137.  
  138. if (!defined($opt_a)) {
  139. $opt_a = 3;
  140. }
  141.  
  142. my $critical = 95;
  143. if ($opt_c && $opt_c =~ /[0-9]+/) {
  144. $critical = $opt_c;
  145. }
  146. my $warning = 80;
  147. if ($opt_w && $opt_w =~ /[0-9]+/) {
  148. $warning = $opt_w;
  149. }
  150.  
  151. my $interface;
  152. if ($opt_i =~ /^([0-9]+)$/ && !defined($opt_n)) {
  153. $interface = $1;
  154. } elsif (!defined($opt_n)) {
  155. print "Unknown -i number expected... or it doesn't exist, try another interface - number\n";
  156. exit $ERRORS{'UNKNOWN'};
  157. }
  158.  
  159. if ($critical <= $warning){
  160. print "(--crit) must be superior to (--warn)";
  161. print_usage();
  162. exit $ERRORS{'OK'};
  163. }
  164.  
  165. #################################################
  166. ##### Plugin snmp requests
  167. ##
  168.  
  169. $session = Centreon::SNMP::Utils::connection($ERRORS{'UNKNOWN'}, $session_params);
  170.  
  171. my $OID_DESC = $centreon{MIB2}{IF_DESC};
  172. my $OID_OPERSTATUS = $centreon{MIB2}{IF_OPERSTATUS};
  173. my @operstatus = ("up","down","testing", "unknown", "dormant", "notPresent", "lowerLayerDown");
  174.  
  175. my $cacheFile = "$centplugins_path/traffic_cache_". $OPTION{'host'};
  176. my $result;
  177. my $mustCreateFile = 0;
  178. my $countLine;
  179.  
  180. #
  181. # Cache File exists, lets read it
  182. #
  183. if (-e $cacheFile) {
  184. open(FILE,"<".$cacheFile);
  185. $row = <FILE>;
  186. if (defined($row)) {
  187. chomp $row;
  188. my $deltaTime = time() - $row;
  189. if ($deltaTime > ($opt_a * 3600)) {
  190. $mustCreateFile = 1;
  191. }
  192. }
  193. close(FILE);
  194.  
  195. # Manage file empty or line 1 empty
  196. if (!defined($row) || $row eq '') {
  197. $mustCreateFile = 1;
  198. }
  199. } else {
  200. $mustCreateFile = 1;
  201. }
  202.  
  203. if ($mustCreateFile) {
  204. $result = Centreon::SNMP::Utils::get_snmp_table($OID_DESC, $session, $ERRORS{'UNKNOWN'}, \%OPTION);
  205. unless (open(FILE,">".$cacheFile)){
  206. print "Check mod for temporary file : ".$cacheFile."...\n";
  207. exit $ERRORS{"UNKNOWN"};
  208. }
  209. my $currentTime = time();
  210. print FILE $currentTime."\n";
  211. foreach my $key (oid_lex_sort(keys %$result)) {
  212. my @oid_list = split (/\./,$key);
  213. my $interfaceIndex = pop (@oid_list);
  214. print FILE $interfaceIndex.";".$result->{$key}."\n";
  215. }
  216. close(FILE);
  217. }
  218.  
  219. ################################################################
  220. # Getting interface using its name instead of its oid index
  221. if ($opt_n) {
  222. if (!-e $cacheFile) {
  223. printf("ERROR: Could not open " . $cacheFile);
  224. exit $ERRORS{'UNKNOWN'};
  225. }
  226.  
  227. open(FILE,"<".$cacheFile);
  228. $countLine = 0;
  229. while ($row = <FILE>) {
  230. if ($countLine) {
  231. my @resLine = split(/\;/, $row);
  232.  
  233. if (defined($opt_r) && $resLine[1] =~ /$opt_i/) {
  234. $interface = $resLine[0];
  235. } else {
  236. $resLine[1] =~ s/\x00//g;
  237. $resLine[1] =~ s/\n//g;
  238. $resLine[1] =~ s/\s*$//g;
  239. if ($resLine[1] eq $opt_i) {
  240. $interface = $resLine[0];
  241. }
  242. }
  243. }
  244. $countLine++;
  245. }
  246. close(FILE);
  247.  
  248. # Can't find an interface in cache file
  249. if (!defined($interface)) {
  250. print "ERROR: Can't find interface name '$opt_i' in cache file '$cacheFile'. Maybe you need a cache rebuild (Command with option '-a 0').";
  251. exit($ERRORS{'UNKNOWN'});
  252. }
  253. }
  254.  
  255. my ($OID_IN, $OID_OUT, $OID_SPEED, $OID_SPEED_BASE);
  256. if (defined($OPTION{'64-bits'})) {
  257. $OID_IN =$centreon{MIB2}{IF_IN_OCTET_64_BITS}.".".$interface;
  258. $OID_OUT = $centreon{MIB2}{IF_OUT_OCTET_64_BITS}.".".$interface;
  259. $OID_SPEED = $centreon{MIB2}{IF_SPEED_64_BITS}.".".$interface;
  260. $OID_SPEED_BASE = $centreon{MIB2}{IF_SPEED_64_BITS};
  261. } else {
  262. $OID_IN =$centreon{MIB2}{IF_IN_OCTET}.".".$interface;
  263. $OID_OUT = $centreon{MIB2}{IF_OUT_OCTET}.".".$interface;
  264. $OID_SPEED = $centreon{MIB2}{IF_SPEED}.".".$interface;
  265. $OID_SPEED_BASE = $centreon{MIB2}{IF_SPEED};
  266. }
  267.  
  268. # Get desctiption table
  269. if ($opt_s) {
  270. if (!-e $cacheFile) {
  271. $result = Centreon::SNMP::Utils::get_snmp_table($OID_DESC, $session, $ERRORS{'UNKNOWN'}, \%OPTION);
  272. unless (open(FILE,">".$cacheFile)){
  273. print "Check mod for temporary file : ".$cacheFile."...\n";
  274. exit $ERRORS{"UNKNOWN"};
  275. }
  276. my $currentTime = time();
  277. print FILE $currentTime."\n";
  278. foreach my $key (oid_lex_sort(keys %$result)) {
  279. my @oid_list = split (/\./,$key);
  280. my $interfaceIndex = pop (@oid_list);
  281. print FILE $interfaceIndex.";".$result->{$key}."\n";
  282. }
  283. close(FILE);
  284. }
  285.  
  286. if (!-e $cacheFile) {
  287. printf("ERROR: Could not open " . $cacheFile);
  288. exit $ERRORS{'UNKNOWN'};
  289. }
  290. open(FILE,"<".$cacheFile);
  291. $countLine = 0;
  292. while ($row = <FILE>){
  293. if ($countLine) {
  294. my @resLine = split(/\;/, $row);
  295. my $index = $resLine[0];
  296. my $interface_status = Centreon::SNMP::Utils::get_snmp_leef([$OID_OPERSTATUS.".".$index], $session, $ERRORS{'UNKNOWN'});
  297. $resLine[1] =~ s/\x00//g;
  298. $resLine[1] =~ s/\n//g;
  299. print "Interface ". $index . " :: " . $resLine[1] . " :: ".$operstatus[$interface_status->{$OID_OPERSTATUS.".".$index} - 1];
  300. if ($opt_S) {
  301. my $link_speed = Centreon::SNMP::Utils::get_snmp_leef([$OID_SPEED_BASE.".".$index], $session, $ERRORS{'UNKNOWN'});
  302. if (!defined($link_speed)) {
  303. printf("ERROR: Interface Speed Request : %s", $session->error);
  304. exit $ERRORS{'UNKNOWN'};
  305. }
  306. my $unit = "bit/s";
  307. my $speed = $link_speed->{$OID_SPEED_BASE.".".$index};
  308. print " :: speed ".$speed." ".$unit."\n";
  309. } else {
  310. print "\n";
  311. }
  312. }
  313. $countLine++;
  314. }
  315. close(FILE);
  316. exit $ERRORS{'OK'};
  317. }
  318.  
  319.  
  320. $result = Centreon::SNMP::Utils::get_snmp_leef([$OID_OPERSTATUS.".".$interface, $OID_IN, $OID_OUT, $OID_SPEED], $session, $ERRORS{'UNKNOWN'},
  321. defined($opt_n) ? "You must specify interface name when option -n is used." : undef);
  322. if (!defined($result->{$OID_OPERSTATUS.".".$interface}) || $result->{$OID_OPERSTATUS.".".$interface} eq "") {
  323. print "ERROR: Can't get interface '$interface' status\n";
  324. exit $ERRORS{'CRITICAL'};
  325. }
  326. if ($operstatus[$result->{$OID_OPERSTATUS.".".$interface} - 1] ne "up") {
  327. if (defined($OPTION{'disable-warn-state'})) {
  328. print "OK: interface is not ready - status : " . $operstatus[$result->{$OID_OPERSTATUS.".".$interface} - 1] . "\n";
  329. exit $ERRORS{'OK'};
  330. } else {
  331. print "ERROR: interface is not ready - status : " . $operstatus[$result->{$OID_OPERSTATUS.".".$interface} - 1] . "\n";
  332. exit $ERRORS{'CRITICAL'};
  333. }
  334. }
  335.  
  336. ####### Get IN bytes
  337. my $in_bits;
  338. if (!defined($result->{$OID_IN})) {
  339. print "ERROR: Can't get interface '$interface' IN Bits\n";
  340. exit $ERRORS{'CRITICAL'};
  341. }
  342. $in_bits = $result->{$OID_IN} * 8;
  343.  
  344. ####### Get OUT bytes
  345. my $out_bits;
  346. if (!defined($result->{$OID_OUT})) {
  347. print "ERROR: Can't get interface '$interface' OUT Bits\n";
  348. exit $ERRORS{'CRITICAL'};
  349. }
  350. $out_bits = $result->{$OID_OUT} * 8;
  351.  
  352. ####### Get SPEED of interface
  353. my $speed_card;
  354. if (defined($opt_T)){
  355. $speed_card = $opt_T * 1000000;
  356. } else {
  357. $speed_card = $result->{$OID_SPEED};
  358. if (!defined($result->{$OID_SPEED}) || int($result->{$OID_SPEED}) !~ /^[0-9]+$/) {
  359. print "ERROR: Card speed is null or incorrect. You should force the value with -T option.\n";
  360. exit $ERRORS{'UNKNOWN'};
  361. }
  362. if (defined($OPTION{'64-bits'})) {
  363. $speed_card = $speed_card * 1000000;
  364. }
  365. }
  366.  
  367. #############################################
  368. ##### Plugin return code
  369. ##
  370.  
  371. $last_in_bits = 0;
  372. $last_out_bits = 0;
  373.  
  374. my $flg_created = 0;
  375.  
  376. if (-e "$centplugins_path/traffic_if".$interface."_".$OPTION{'host'}) {
  377. open(FILE,"<"."$centplugins_path/traffic_if".$interface."_".$OPTION{'host'});
  378. while($row = <FILE>){
  379. @last_values = split(":",$row);
  380. $last_check_time = $last_values[0];
  381. $last_in_bits = $last_values[1];
  382. $last_out_bits = $last_values[2];
  383. $flg_created = 1;
  384. }
  385. close(FILE);
  386. } else {
  387. $flg_created = 0;
  388. }
  389.  
  390. $update_time = time();
  391.  
  392. unless (open(FILE,">"."$centplugins_path/traffic_if".$interface."_".$OPTION{'host'})){
  393. print "Check mod for temporary file : $centplugins_path/traffic_if".$interface."_".$OPTION{'host'}. " !\n";
  394. exit $ERRORS{"UNKNOWN"};
  395. }
  396. print FILE "$update_time:$in_bits:$out_bits";
  397. close(FILE);
  398.  
  399. if ($flg_created == 0){
  400. print "First execution : Buffer in creation.... \n";
  401. exit($ERRORS{"UNKNOWN"});
  402. }
  403.  
  404. ## Bandwith = IN + OUT / Delta(T) = 6 Mb/s
  405. ## (100 * Bandwith) / (2(si full duplex) * Ispeed)
  406. ## Count must round at 4294967296
  407. ##
  408.  
  409. if (($in_bits - $last_in_bits != 0) && defined($last_in_bits)) {
  410. my $total = 0;
  411. if ($in_bits < $last_in_bits && !defined($OPTION{'64-bits'})) {
  412. print "ERROR: IN counter is going back. Two cases: 1) equipment restarted (= ok the next check), COUNTER in 32 bits (= should use COUNTER in 64 bits with option '--64-bits')\n";
  413. exit($ERRORS{"UNKNOWN"});
  414. } elsif ($in_bits < $last_in_bits && defined($OPTION{'64-bits'})) {
  415. print "ERROR: IN counter is going back. One case: 1) equipment restarted (= ok the next check)\n";
  416. exit($ERRORS{"UNKNOWN"});
  417. } else {
  418. $total = $in_bits - $last_in_bits;
  419. }
  420. my $diff = time() - $last_check_time;
  421. if ($diff == 0) {
  422. $diff = 1;
  423. }
  424. my $pct_in_traffic = $in_traffic = abs($total / $diff);
  425. } else {
  426. $in_traffic = 0;
  427. }
  428.  
  429. if ($out_bits - $last_out_bits != 0 && defined($last_out_bits)) {
  430. my $total = 0;
  431. if ($out_bits < $last_out_bits && !defined($OPTION{'64-bits'})) {
  432. print "ERROR: OUT counter is going back. Two cases: 1) equipment restarted (= ok the next check), COUNTER in 32 bits (= should use COUNTER in 64 bits with option '--64-bits')\n";
  433. exit($ERRORS{"UNKNOWN"});
  434. } elsif ($out_bits < $last_out_bits && defined($OPTION{'64-bits'})) {
  435. print "ERROR: OUT counter is going back. One case: 1) equipment restarted (= ok the next check)\n";
  436. exit($ERRORS{"UNKNOWN"});
  437. } else {
  438. $total = $out_bits - $last_out_bits;
  439. }
  440. my $diff = time() - $last_check_time;
  441. if ($diff == 0) {
  442. $diff = 1;
  443. }
  444. my $pct_out_traffic = $out_traffic = abs($total / $diff);
  445. } else {
  446. $out_traffic = 0;
  447. }
  448.  
  449. if ( $speed_card != 0 ) {
  450. $in_usage = sprintf("%.1f",($in_traffic * 100) / $speed_card);
  451. $out_usage = sprintf("%.1f",($out_traffic * 100) / $speed_card);
  452. }
  453.  
  454. my $in_prefix = "";
  455. my $out_prefix = "";
  456.  
  457. my $in_perfparse_traffic = $in_traffic;
  458. my $out_perfparse_traffic = $out_traffic;
  459.  
  460. if ($in_traffic > 1000) {
  461. $in_traffic = $in_traffic / 1000;
  462. $in_prefix = "k";
  463. if($in_traffic > 1000){
  464. $in_traffic = $in_traffic / 1000;
  465. $in_prefix = "M";
  466. }
  467. if($in_traffic > 1000){
  468. $in_traffic = $in_traffic / 1000;
  469. $in_prefix = "G";
  470. }
  471. }
  472.  
  473. if ($out_traffic > 1000){
  474. $out_traffic = $out_traffic / 1000;
  475. $out_prefix = "k";
  476. if ($out_traffic > 1000){
  477. $out_traffic = $out_traffic / 1000;
  478. $out_prefix = "M";
  479. }
  480. if ($out_traffic > 1000){
  481. $out_traffic = $out_traffic / 1000;
  482. $out_prefix = "G";
  483. }
  484. }
  485.  
  486. my $in_bits_unit = "";
  487. $in_bits = $in_bits/1048576;
  488. if ($in_bits > 1000){
  489. $in_bits = $in_bits / 1000;
  490. $in_bits_unit = "G";
  491. } else {
  492. $in_bits_unit = "M";
  493. }
  494.  
  495. my $out_bits_unit = "";
  496. $out_bits = $out_bits/1048576;
  497. if ($out_bits > 1000){
  498. $out_bits = $out_bits / 1000;
  499. $out_bits_unit = "G";
  500. } else {
  501. $out_bits_unit = "M";
  502. }
  503.  
  504. if ( $speed_card == 0 ) {
  505. print "CRITICAL: Interface speed equal 0! Interface must be down.|traffic_in=0B/s traffic_out=0B/s\n";
  506. exit($ERRORS{"CRITICAL"});
  507. }
  508.  
  509. #####################################
  510. ##### Display result
  511. ##
  512.  
  513.  
  514. my $in_perfparse_traffic_str = sprintf("%.1f",abs($in_perfparse_traffic));
  515. my $out_perfparse_traffic_str = sprintf("%.1f",abs($out_perfparse_traffic));
  516.  
  517. $in_perfparse_traffic_str =~ s/\./,/g;
  518. $out_perfparse_traffic_str =~ s/\./,/g;
  519.  
  520. my $status = "OK";
  521.  
  522. if(($in_usage > $warning) or ($out_usage > $warning)){
  523. $status = "WARNING";
  524. }
  525. if (($in_usage > $critical) or ($out_usage > $critical)){
  526. $status = "CRITICAL";
  527. }
  528.  
  529. my $warningBit = $warning * $speed_card / 100;
  530. my $criticalBit = $critical * $speed_card / 100;
  531.  
  532. printf("Traffic In : %.2f ".$in_prefix."b/s (".$in_usage." %%), Out : %.2f ".$out_prefix."b/s (".$out_usage." %%) ", $in_traffic, $out_traffic);
  533. if ($opt_S) {
  534. printf(" - Link Speed : %d", $speed_card);
  535. }
  536. printf("|traffic_in=".$in_perfparse_traffic_str."Bits/s;$warningBit;$criticalBit;0;$speed_card traffic_out=".$out_perfparse_traffic_str."Bits/s;$warningBit;$criticalBit;0;$speed_card\n");
  537. exit($ERRORS{$status});
  538.  
  539. sub print_usage () {
  540. print "\nUsage:\n";
  541. print "$PROGNAME\n";
  542. print " -H (--hostname) Hostname to query (required)\n";
  543. print " -C (--community) SNMP read community (defaults to public)\n";
  544. print " used with SNMP v1 and v2c\n";
  545. print " -v (--snmp-version) 1 for SNMP v1 (default)\n";
  546. print " 2 for SNMP v2c\n";
  547. print " 3 for SNMP v3\n";
  548. print " -P (--snmp-port) SNMP port (default: 161)\n";
  549. print " -k (--authkey) snmp V3 key\n";
  550. print " -u (--username) snmp V3 username \n";
  551. print " -p (--password) snmp V3 password\n";
  552. print " --authprotocol protocol MD5/SHA (v3)\n";
  553. print " --privprotocol encryption system (DES/AES)(v3) \n";
  554. print " --privpassword passphrase (v3) \n";
  555. print " --64-bits Use 64 bits OID\n";
  556. print " --maxrepetitions To use when you have the error: 'Message size exceeded buffer maxMsgSize'\n";
  557. print " Work only with SNMP v2c and v3 (Example: --maxrepetitions=1)\n";
  558. print " -s (--show) Describes all interfaces number (debug mode)\n";
  559. print " -i (--interface) Set the interface number (2 by default)\n";
  560. print " -n (--name) Allows to use interface name with option -i instead of interface oid index\n";
  561. print " (ex: -i \"eth0\" -n, -i \"VMware Virtual Ethernet Adapter for VMnet8\" -n\n";
  562. print " (choose an unique expression for each interface)\n";
  563. print " -w (--warning) Signal strength at which a warning message will be generated\n";
  564. print " (default 80)\n";
  565. print " -c (--critical) Signal strength at which a critical message will be generated\n";
  566. print " --disable-warn-state Option for not alerting on interface state\n";
  567. print " -T Set maximum bandwidth\n";
  568. print " -S Show link speed in output\n";
  569. print " -V (--version) Plugin version\n";
  570. print " -r Regexp Match Mode\n";
  571. print " -a (--cache) Updates cache file every n hours instead of doing snmpwalk for every check (default: 3)\n";
  572. print " -h (--help) usage help\n";
  573. }
  574.  
  575. sub print_help () {
  576. print "##############################################\n";
  577. print "# Copyright (c) 2004-2013 Centreon #\n";
  578. print "# Bugs to http://forge.centreon.com #\n";
  579. print "##############################################\n";
  580. print_usage();
  581. print "\n";
  582. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement