What does -H -v 1 -C -c -w3$


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What does -H -v 1 -C -c -w3$
# 1  
Old 06-21-2012
What does -H -v 1 -C -c -w3$

so am working on some perl modules

and i have this -H $HOSTADDRESS$ -v 1 -C $ARG1$ -c $ARG2$ -w $ARG3$

i know -h refers host and -v refer to version 1 ,, but what does 1$,-c,2$,-w,3$ refer to what do they mean, and when writing the above script -v 1 has to be written. cant we just skip it?

thx

Last edited by vbe; 06-21-2012 at 08:45 AM.. Reason: icode
# 2  
Old 06-21-2012
We cannot know without seeing what the script's code does with parameters.
# 3  
Old 06-21-2012
Quote:
Originally Posted by jim mcnamara
We cannot know without seeing what the script's code does with parameters.
this is the code , i guess after reading whats inside print where every letter is declared i understand what everyone of these letters do.

EDIT: if only i have scratched my head harder lol

Quote:
undef($result);

$cpu /= $i;

# Plugin return code
my $status = "OK";
if ($cpu >= $opt_c) {
$status = "CRITICAL";
} elsif ($cpu >= $opt_w) {
$status = "WARNING";
}

my $str = "CPU utilization percentage : ".$cpu."%|avg=".$cpu."%";
if ($opt_l == 0) {
for ($i = 0; defined($cpulist[$i]); $i++){
$str .= " cpu$i=".$cpulist[$i]."%";
}
}

# Display Ouptut
print $str."\n";
undef($str);
exit $ERRORS{$status};

sub print_usage () {
print "\nUsage:\n";
print "$PROGNAME\n";
print "This Plugin is design for return CPU percent on windows Serveurs (1 min Average)\n";
print "\n";
print " -H (--hostname) Hostname to query - (required)\n";
print " -C (--community) SNMP read community (defaults to public,\n";
print " -c (--critical) Three critical tresholds (defaults : 95)\n";
print " -w (--warning) Three warning tresholds (defaults : 90)\n";
print " -l Display only cpu average\n";
print " -v (--snmp_version) 1 for SNMP v1 (default)\n";
print " 2 for SNMP v2c\n";
print " -k (--key) snmp V3 key\n";
print " -p (--password) snmp V3 password\n";
print " -u (--username) snmp v3 username \n";
print " -V (--version) Plugin version\n";
print " -h (--help) usage help\n";
}



sub print_help () {
print
print_usage();
print "\n";
}
# 4  
Old 06-21-2012
Your code looks like part of nagios plugin ....

If so:

Code:
-H $HOSTADDRESS$ -v 1 -C $ARG1$ -c $ARG2$ -w $ARG3$ 

-C = command
-c = critical threshold
-w = warning threshold

$ARG1$ = argument number 1 ..etc

edit...heh ...I did not read your last post Smilie
# 5  
Old 06-21-2012
yeah man its a nagios plugin, and lol its ok. anyways thx for the help Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question