Check_by_ssh issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
MarMottE
Posts: 25
Joined: Thu Aug 18, 2016 3:00 am

Re: Check_by_ssh issue

Post by MarMottE »

Box293 wrote:
tgriep wrote:I am thinking that the error is the printing of the message of the day or the banner when you login to the remote system.
Adding -E 1 to the check_by_ssh command will ignore the first line of output.

In my previous message page 1, I have put the command definition and there is already -E 1

The check_by_ssh

# 'ssh_disk' command definition
define command{
command_name ssh_disk
command_line /usr/local/nagios/libexec/check_by_ssh -i /home/nagios/.ssh/id_dsa -H '$HOSTADDRESS$' -E 1 -C "/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -e -p '$ARG3$'"
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Check_by_ssh issue

Post by tgriep »

It could also be the single quotes around the macros remove them and see if that works for you.

Code: Select all

/usr/local/nagios/libexec/check_by_ssh -i /home/nagios/.ssh/id_dsa -H $HOSTADDRESS$ -E 1 -C "/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -e -p $ARG3$"
Be sure to check out our Knowledgebase for helpful articles and solutions!
MarMottE
Posts: 25
Joined: Thu Aug 18, 2016 3:00 am

Re: Check_by_ssh issue

Post by MarMottE »

No, the same ..
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Check_by_ssh issue

Post by tgriep »

Can you login to the Nagios server as the nagios user and run the command like in the previous post, filling in the IP Address and arguments and post the output here?
Be sure to check out our Knowledgebase for helpful articles and solutions!
MarMottE
Posts: 25
Joined: Thu Aug 18, 2016 3:00 am

Re: Check_by_ssh issue

Post by MarMottE »

tgriep wrote:Can you login to the Nagios server as the nagios user and run the command like in the previous post, filling in the IP Address and arguments and post the output here?
nagios@nagiosserver:/usr/local/nagios/libexec$ ./check_by_ssh -i /home/nagios/.ssh/id_dsa -H xxxxxx -E 1 -C "/usr/lib/nagios/plugins/check_disk -w 10 -c 20 -e -p /"
DISK OK| /=4453MB;12677;12667;0;12687
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check_by_ssh issue

Post by rkennedy »

Could you please post your service definition for the one that's using this check_command and failing? The command definition looks good, as well as the fact it's working over the CLI.
Former Nagios Employee
MarMottE
Posts: 25
Joined: Thu Aug 18, 2016 3:00 am

Re: Check_by_ssh issue

Post by MarMottE »

rkennedy wrote:Could you please post your service definition for the one that's using this check_command and failing? The command definition looks good, as well as the fact it's working over the CLI.
define service {
host_name xxxxxxx,
service_description /
check_command ssh_disk!20%!10%!/
use generic-service
}
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check_by_ssh issue

Post by rkennedy »

To rule out parsing and values getting lost in translation, could you create a new command definition and assign this to your service?

Code: Select all

$USER1$/check_by_ssh -i /home/nagios/.ssh/id_dsa -H xxxxxx -E 1 -C "/usr/lib/nagios/plugins/check_disk -w 10 -c 20 -e -p /"
This isn't ideal, but it will at least help us to see what's going on. Let us know what the status is for the check when it comes back.
Former Nagios Employee
MarMottE
Posts: 25
Joined: Thu Aug 18, 2016 3:00 am

Re: Check_by_ssh issue

Post by MarMottE »

rkennedy wrote:To rule out parsing and values getting lost in translation, could you create a new command definition and assign this to your service?

Code: Select all

$USER1$/check_by_ssh -i /home/nagios/.ssh/id_dsa -H xxxxxx -E 1 -C "/usr/lib/nagios/plugins/check_disk -w 10 -c 20 -e -p /"

# 'ssh_disk' command definition
define command{
command_name ssh_disk_test
command_line $USER1$/check_by_ssh -i /home/nagios/.ssh/id_dsa -H '$HOSTADDRESS$' -E 1 -C "/usr/lib/nagios/plugins/check_disk -w 10 -c 20 -e -p /"
}



define service {
host_name xxxxxx, xxxxxxx
service_description /_test
check_command ssh_disk_test
use generic-service
}


It's the same ... check goes down when the session is closed


/_test
Perform Extra Service Actions
CRITICAL 09-05-2016 11:26:18 0d 0h 3m 16s 3/3 (Return code of 255 is out of bounds)
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Check_by_ssh issue

Post by rkennedy »

It really sounds like the storage isn't persistent if that's the case. What type of firewall device is this?
Former Nagios Employee
Locked