#217 Solved.
git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@6505 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
parent
42e5d5936c
commit
dfd2024da8
|
@ -1,6 +1,6 @@
|
|||
#! /usr/bin/perl -w
|
||||
###################################################################
|
||||
# Oreon is developped with GPL Licence 2.0
|
||||
# Centreon is developped with GPL Licence 2.0
|
||||
#
|
||||
# GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
||||
#
|
||||
|
@ -41,7 +41,7 @@ if (eval "require centreon" ) {
|
|||
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_v $opt_C $opt_p $opt_H $opt_n $opt_k $opt_u $opt_x $result @result %process_list %STATUS);
|
||||
use vars qw($opt_V $opt_h $opt_v $opt_C $opt_p $opt_H $opt_n $opt_k $opt_u $opt_x $opt_w $opt_c $result @result %process_list %STATUS);
|
||||
|
||||
# Plugin var init
|
||||
|
||||
|
@ -64,7 +64,9 @@ GetOptions
|
|||
"v=s" => \$opt_v, "snmp=s" => \$opt_v,
|
||||
"C=s" => \$opt_C, "community=s" => \$opt_C,
|
||||
"p=s" => \$opt_p, "process=s" => \$opt_p,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||
"c=s" => \$opt_c, "critical=s" => \$opt_c);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision: 1.2 $');
|
||||
|
@ -80,6 +82,12 @@ if (!$opt_H) {
|
|||
print_usage();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_n && !$opt_c && !$opt_w) {
|
||||
print_usage();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
my $snmp = "1";
|
||||
$snmp = $opt_v if ($opt_v && $opt_v =~ /^[0-9]$/);
|
||||
|
||||
|
@ -193,13 +201,15 @@ if ($opt_n){
|
|||
sub print_usage () {
|
||||
print "\nUsage:\n";
|
||||
print "$PROGNAME\n";
|
||||
print " -H (--hostname) Hostname to query - (required)\n";
|
||||
print " -H (--hostname) Hostname to query (required)\n";
|
||||
print " -n (--number) Return the number of current running processes. \n";
|
||||
print " -w (--warning) Number of process that will cause a warning (only required with -n option)\n";
|
||||
print " -c (--critical) Number of process that will cause an error (only required with -n option)\n";
|
||||
print " -C (--community) SNMP read community (defaults to public,\n";
|
||||
print " used with SNMP v1 and v2c\n";
|
||||
print " used with SNMP v1 and v2c)\n";
|
||||
print " -v (--snmp_version) 1 for SNMP v1 (default)\n";
|
||||
print " 2 for SNMP v2c\n";
|
||||
print " -n (--number) Return the number of current running processes. \n";
|
||||
print " -p (--process) Set the process name ex: by default smbd\n";
|
||||
print " -p (--process) Set the process name ex: by default smbd (required)\n";
|
||||
print " -k (--key) snmp V3 key\n";
|
||||
print " -x (--password) snmp V3 password\n";
|
||||
print " -u (--username) snmp v3 username \n";
|
||||
|
@ -207,10 +217,10 @@ sub print_usage () {
|
|||
print " -h (--help) usage help\n";
|
||||
}
|
||||
sub print_help () {
|
||||
print "##############################################\n";
|
||||
print "# Copyright (c) 2004-2007 Centreon #\n";
|
||||
print "# Bugs to http://bugs.oreon-project.org/ #\n";
|
||||
print "##############################################\n";
|
||||
print "######################################\n";
|
||||
print "# Copyright (c) 2004-2008 Centreon #\n";
|
||||
print "# Bugs to http://www.centreon.com/ #\n";
|
||||
print "######################################\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
}
|
Loading…
Reference in New Issue