Page 1 of 1

Error "Unknown option" in Nagios check

Posted: Mon Mar 21, 2016 8:36 am
by tmeto
Hi, we have defined the host "ROZAS-SAI-AUDITORIO" in the file " hosts.cfg ", the following command "check_ups" in the file " commands.cfg " and the next service "Ups Alarm" in the file " services" :

define host{
use generic-switch
host_name ROZAS-SAI-AUDITORIO
alias ROZAS-SAI-AUDITORIO
address 192.168.2.31
hostgroups ROZAS
}

define command {
command_name check_ups
command_line $USER1$/check_ups_snmp.sh -H $HOSTADDRESS$
}


define service{
use generic-service
host_name ROZAS-SAI-AUDITORIO
service_description Ups Alarm
check_command check_ups!-C nagiosica -v 2c -p ups_alarm
normal_check_interval 30
retry_check_interval 10
notification_interval 0
register 1
}


We have Restarted the nagios service but in the web interface it appearan error and does not perform properly check (see attachment ) may be going on ? Instead through command line it works correctly :

root@snoc01debian01:/usr/local/nagios/libexec# ./check_ups_snmp.sh -H 192.168.2.31 -v 2c -C nagiosica -p ups_alarm
OK - 0 alarms present |'alarms'=0

Thank you so mutch!

Re: Error "Unknown option" in Nagios check

Posted: Mon Mar 21, 2016 11:36 am
by rkennedy
What are the permissions of check_ups_snmp.sh?

Re: Error "Unknown option" in Nagios check

Posted: Tue Mar 22, 2016 10:14 am
by tmeto
rkennedy wrote:What are the permissions of check_ups_snmp.sh?
These are the permitions of de file:
-rwxrwxrwx 1 root nagios 12474 may 14 2014 check_ups_snmp.sh

Re: Error "Unknown option" in Nagios check

Posted: Tue Mar 22, 2016 11:15 am
by rhassing
Could you try to run the command as the user nagios?

Re: Error "Unknown option" in Nagios check

Posted: Tue Mar 22, 2016 2:19 pm
by scottwilkerson
Change your command to this

Code: Select all

define command {
command_name check_ups
command_line $USER1$/check_ups_snmp.sh -H $HOSTADDRESS$ $ARG1$
}
You are missing the $ARG1$

Re: Error "Unknown option" in Nagios check

Posted: Tue Mar 22, 2016 2:54 pm
by rhassing
Wow, Scott has the allseeing eye. I missed that one :)

Re: Error "Unknown option" in Nagios check

Posted: Wed Mar 23, 2016 9:41 am
by hsmith
All seeing IT :)

Re: Error "Unknown option" in Nagios check

Posted: Wed Mar 23, 2016 9:42 am
by tmeto
rhassing wrote:Wow, Scott has the allseeing eye. I missed that one :)
The check is already ok!!!! the problem was due to the absence of $ ARG1 $ argument , thank you very much to all for your help!!!!!!!!!!

Re: Error "Unknown option" in Nagios check

Posted: Wed Mar 23, 2016 1:40 pm
by rkennedy
Good to hear! I'll go ahead and close this out, feel free to create a new thread if you need any assistance in the future!