Problem with a own check. what Log activate for see problem?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
redesgtt
Posts: 36
Joined: Mon May 16, 2016 2:57 am

Problem with a own check. what Log activate for see problem?

Post 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)

Image


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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Problem with a own check. what Log activate for see prob

Post 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?
Former Nagios employee
https://www.mcapra.com/
redesgtt
Posts: 36
Joined: Mon May 16, 2016 2:57 am

Re: Problem with a own check. what Log activate for see prob

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Problem with a own check. what Log activate for see prob

Post 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.)
Former Nagios Employee
redesgtt
Posts: 36
Joined: Mon May 16, 2016 2:57 am

Re: Problem with a own check. what Log activate for see prob

Post 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?
You do not have the required permissions to view the files attached to this post.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Problem with a own check. what Log activate for see prob

Post 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)
Former Nagios Employee
redesgtt
Posts: 36
Joined: Mon May 16, 2016 2:57 am

Re: Problem with a own check. what Log activate for see prob

Post 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)
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Problem with a own check. what Log activate for see prob

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
redesgtt
Posts: 36
Joined: Mon May 16, 2016 2:57 am

Re: Problem with a own check. what Log activate for see prob

Post 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.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Problem with a own check. what Log activate for see prob

Post by rkennedy »

Glad to hear you were able to solve it!
Former Nagios Employee
Locked