Page 1 of 2
./check_ironport.sh: line 88: [: CPU: integer expression exp
Posted: Tue May 31, 2011 9:20 am
by tgfde
Hi,
I'm getting the error message above when running a command from the Nagios server. Could someone please help on giving the right expression it is looking for? Line 88 of the shell script is shown below:
if [ $PAR_WARN -ge $PAR_CRIT ]; then
Sorry, still new to shell scripting.
Thanks.
Re: ./check_ironport.sh: line 88: [: CPU: integer expression
Posted: Tue May 31, 2011 9:56 am
by tonyyarusso
What are your values for $PAR_WARN and $PAR_CRIT? My first guess is that you are passing numbers with a decimal point instead of integers. If that is the case, and you actually need to support floats, then you'll want to try something like
Code: Select all
if [ $(echo "$PAR_WARN >= $PAR_CRIT" | /usr/bin/bc) -eq 1 ]; then
Re: ./check_ironport.sh: line 88: [: CPU: integer expression
Posted: Tue May 31, 2011 12:52 pm
by tgfde
warn=90
crit=95
Re: ./check_ironport.sh: line 88: [: CPU: integer expression
Posted: Tue May 31, 2011 1:16 pm
by tonyyarusso
Could you attach a copy of the script as well as showing the command as issued (with arguments) and the terminal output?
Re: ./check_ironport.sh: line 88: [: CPU: integer expression
Posted: Wed Jun 01, 2011 1:44 pm
by tgfde
command - ./check_ironport.sh -H $HOSTADDRESS$ <user> <password> CPU 90 95
output - ./check_ironport.sh: line 88: [: CPU: integer expression expected
Can't collect data from an Ironpor appliance Ironport. Verify hostname, userID and password!
check_ironport.txt
Re: ./check_ironport.sh: line 88: [: CPU: integer expression
Posted: Wed Jun 01, 2011 2:05 pm
by tonyyarusso
Do not use -H, as this plugin is not written to properly use switched arguments, but rather only positional ones. Right now you are telling it that $HOSTNAME is literally "-H", $USER is "$HOSTADDRESS", $PASSWORD is "<user>", $ARGS is "<password>", $PAR_WARN is "CPU", and $PAR_CRIT is "90". So, instead, use:
./check_ironport.sh $HOSTADDRESS <user> <password> CPU 90 95
Re: ./check_ironport.sh: line 88: [: CPU: integer expression
Posted: Wed Jun 01, 2011 2:19 pm
by tgfde
Hi Tony,
Here's what I got from removing -H:
Usage: check_ironport.sh <hostname> <user> <password> <parameter> <warning_nro> <critical_nro>
Notes:
hostname - Can be a hostname or IP address
parameter - Can be status, cpu, ram, msgxhour, conn_in, conn_out, queue, workqueue,
msgs_in_quarantine, disk_util, queuedisk_usage or resourseconservation
parameters for STATUS are ignored but must be provided. The results for STATUS can be OK or critical.
parameters for RESOURSECONSERVATION should be 1 and 2.
Thanks.
Re: ./check_ironport.sh: line 88: [: CPU: integer expression
Posted: Wed Jun 01, 2011 2:36 pm
by tonyyarusso
Don't capitalize cpu then.
Re: ./check_ironport.sh: line 88: [: CPU: integer expression
Posted: Wed Jun 01, 2011 3:03 pm
by tgfde
That worked. Thank you so much!
Re: ./check_ironport.sh: line 88: [: CPU: integer expression
Posted: Wed Jun 01, 2011 3:05 pm
by tgfde
Tony,
Now all I have to figure is why Nagios is not getting the results somehow of a stopped windows service.
Again, thank you for your help on this.