Page 1 of 1
Problem with a own check. what Log activate for see problem?
Posted: Fri Jan 20, 2017 8:57 am
by redesgtt
Hi,
When I run check manually, shows:
[root@nagiosxi nuestros]# ./check_snmp_eigrp.sh ralicante
OK: eigrp neighbor ALC (87) VPB (81)
But when I add this check to "Services", the result in Nagios is bad:
OK: eigrp neighbor ALC (0) VPB (0)
Well, I have tried to see in Nagios.log , but it doesn't show nothing, neither in /var/log/message.
I am pretty sure, there is a problem with file permissions or something. But I don't know where I could see a good log
, or activate some log
I would like activate some log to see how Nagios XI (nagios core) runs this check, for see the difference between how I do it and how Nagios does it.
thanks
regards
Re: Problem with a own check. what Log activate for see prob
Posted: Fri Jan 20, 2017 1:17 pm
by mcapra
There isn't really a log for that sort of thing. Can we see the full Nagios service's check_command definition you are trying to use for this service check?
Can we also see the Nagios command definition for check_snmp_eigrp?
Re: Problem with a own check. what Log activate for see prob
Posted: Tue Jan 24, 2017 3:56 am
by redesgtt
command definition:
Code: Select all
define command {
command_name check_eigrpnei_snmp
command_line /usr/local/nagios/etc/nuestros/check_snmp_eigrp.sh $HOSTNAME$
}
script permissions:
Code: Select all
-rwxrwxr-x. 1 apache nagios 1183 nov 10 12:55 check_snmp_eigrp.sh
define service:
Code: Select all
define service {
host_name ralicante
service_description Cantidad EIGRP
use Service_Router_10
check_command check_eigrpnei_snmp!!!!!!!!
process_perf_data 1
register 1
}
Service template:
Code: Select all
define service {
name Service_Router_10
is_volatile 0
max_check_attempts 2
check_interval 10
retry_interval 1
check_period 24x7
parallelize_check 1
obsess_over_service 0
check_freshness 0
process_perf_data 0
retain_status_information 1
retain_nonstatus_information 1
notification_interval 60
first_notification_delay 0
notification_period 24x7
notification_options c,r
notifications_enabled 1
register 0
}
Like I told you, if I run script manually, it runs. But when I add it to one service, it doesn't run.
Re: Problem with a own check. what Log activate for see prob
Posted: Tue Jan 24, 2017 11:51 am
by rkennedy
You'll want to update your command check_eigrpnei_snmp and add
$ARG1$ -
Code: Select all
define command {
command_name check_eigrpnei_snmp
command_line /usr/local/nagios/etc/nuestros/check_snmp_eigrp.sh $HOSTNAME$ $ARG1$
}
Then at the service level, set $ARG1$ to ralicante
(this is what you appear to be passing on the CLI, and not at the Nagios layer.)
Re: Problem with a own check. what Log activate for see prob
Posted: Fri Feb 03, 2017 3:31 am
by redesgtt
Hi, I am sorry for reply you so late.
Well, I have done you said me:
Put argument in command line. Altough I don't understand you said me this, becasuse "Hostname" is "ralicante" too
captura1_problema_check_eigrpnei.jpg
I add "ralicante" such as $ARG1$ in service:
captura2_problema_check_eigrpnei.jpg
and when I apply changes, services status shows:
captura3_problema_check_eigrpnei.jpg
but when I run check with the new "path"
[root@nagiosxi nuestros]# ./check_snmp_eigrp.sh ralicante ralicante
OK: eigrp neighbor ALC (87) VPB (80)
is it possible the problem is I run manually the check how "root" and when Nagios runs via Web-UI with other user?
Re: Problem with a own check. what Log activate for see prob
Posted: Fri Feb 03, 2017 10:51 am
by rkennedy
Ah - didn't realize that was the hostname.
What happens if you run it over the CLI as the nagios user? su - nagios and then ./check_snmp_eigrp.sh ralicante (from the appropriate path)
Re: Problem with a own check. what Log activate for see prob
Posted: Mon Feb 06, 2017 6:31 am
by redesgtt
it runs OK:
[root@nagiosxi nuestros]# su - nagios /usr/local/nagios/libexec/nuestros/check_snmp_eigrp.sh ralicante
Último inicio de sesión:lun feb 6 12:30:49 CET 2017en pts/0
OK: eigrp neighbor ALC (87) VPB (78)
Re: Problem with a own check. what Log activate for see prob
Posted: Mon Feb 06, 2017 5:07 pm
by tgriep
Can you post the plugin here so we can view it and see how it is written?
Code: Select all
/usr/local/nagios/libexec/nuestros/check_snmp_eigrp.sh
Re: Problem with a own check. what Log activate for see prob
Posted: Thu Feb 16, 2017 2:35 am
by redesgtt
Please, close this thread.
The problem is that script have "plink" for send commands to routers, like:
/usr/local/bin/plink -l $USR -pw $PWUSR "$1" "$2"
(We have it in Nagios Core)
but we have needed put:
sudo /usr/local/bin/plink -l $USR -pw $PWUSR "$1" "$2"
(in our Nagios XI)
We have "plink" in sudoers and in the rest of things that we think "plink" needs stay, but until we didn't put that, script didn't run.
thanks for your support.
Re: Problem with a own check. what Log activate for see prob
Posted: Thu Feb 16, 2017 10:22 am
by rkennedy
Glad to hear you were able to solve it!