Check_by_ssh showing return error code 255

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
manimurugesan
Posts: 145
Joined: Wed Oct 03, 2018 9:15 am

Check_by_ssh showing return error code 255

Post by manimurugesan »

Hello Team,

We are using check_by_ssh for linux file system but it's showing return error code 255 and when I try to do ssh from nagios server it's asking password .

Note: other parameters are working fine except file system which we are using check_by_ssh

Can you please help me to fix this issue
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Check_by_ssh showing return error code 255

Post by pbroste »

Hello @manimurugesan

Thanks for reaching out on this issue with the 'check_by_ssh'. Sounds like the check_by_ssh is working for other checks, but not for the file system check.

When running the check_by_ssh from the command line what are the results?

Several reasons for failing:
  • Failing when checking known_host file typically found in .ssh directory (but doubt that since you stated that other checks are passing via check_by_ssh
  • Run the command manually, should look something like this:
  • [quote]/usr/local/nagios/libexec/check_by_ssh -i /home/nagios/.ssh/your_id_dsa -H '$HOSTADDRESS$' -E 1 -C "/usr/lib/nagios/plugins/check_something"[/quote]
  • Other option to check permissions (chown/chmod)
  • And last toss the command inside a script with correct permissons and run that instead
  • [code]#!/bin/ksh CMD="/somepath/libexec/check_something -c 95 -w 90" $($CMD) ERROR_CODE=$? exit $ERROR_CODE[/code] [code]/usr/local/nagios/libexec/check_by_ssh -i /home/nagios/.ssh/your_id_dsa -H '$HOSTADDRESS$' -E -C "/path/to/your/script.sh"[/code]
Thanks,
Perry
manimurugesan
Posts: 145
Joined: Wed Oct 03, 2018 9:15 am

Re: Check_by_ssh showing return error code 255

Post by manimurugesan »

Hello Team,

There was different user name configured with the service after changing to user name as nagios it's started working but still i am not able to understand why other services was working we are using same Check_by_ssh .

Can please you clarify ?
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: Check_by_ssh showing return error code 255

Post by pbroste »

Hello @manimurugesan

Looking at my library directory, we see that ownership and group on the default "plugin" are owned by apache and belong to nagios group. There is possibly some "plugin" that got tossed in there by other means belong to another group and owner. This can cause inconsistency in how each "plugin" functions.
-rwxrwxr-x 1 apache nagios
Thanks,
Perry
Locked