check_by_ssh problem

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
barbatrukko
Posts: 2
Joined: Tue Mar 14, 2017 5:03 am

check_by_ssh problem

Post by barbatrukko »

Hi to all,
I have a problem with this script.
I have a nagios server with a user called nagios.
I have 2 jboss server (for example jb1 e jb2)
I added authentication by key so I can execute command from nagios server to jboss client without authentication.
So, if I m in folder /usr/local/nagios/libexec logged by nagios user
and run
./check_by_ssh -H jb1 -t 60 -l nagios -C "/opt/jboss/scripts/check_file_size_custom.sh --maxwarn 80000000 --maxcrit 150000000 /opt/jboss/domain/servers/*/log/* /opt/jboss/domain/log/*" -E
or
./check_by_ssh -H jb2 -t 60 -l nagios -C "/opt/jboss/scripts/check_file_size_custom.sh --maxwarn 80000000 --maxcrit 150000000 /opt/jboss/domain/servers/*/log/* /opt/jboss/domain/log/*" -E

both commands respond with the correct result

for jb1
FILE: Check for all files (452). Click for details on the service...
---

Warning: Size of 113799 KB > 78125 KB for /opt/jboss/domain/servers/XXXXXXXX/log/server.log.2017-02-21
Warning: Size of 97286 KB > 78125 KB for /opt/jboss/domain/servers/YYYYYY/log/server.log.2017-02-22
Critical: Size of 250648 KB > 146484 KB for /opt/jboss/domain/servers/ZZZZZZZ/log/server.log
...

---

for jb2
FILE: Check for all files (909). Click for details on the service...
---

---

so in jb2 server all is ok (if I lower the threshold, also jb2 return warning.)

But in nagios dashboard i see this
in jb1 server I read what I posted before but in jb2 server I read this

(Return code of 255 is out of bounds : UNKNOWN - check_by_ssh: Remote command '/opt/jboss/scripts/check_file_size_custom.sh --maxwarn 80000000 --maxcrit 150000000 /opt/jboss/domain/servers/*/log/* /opt/jboss/domain/log/*' returned status 255))


The advanced service is the same for both server and also the command line (except server name). Why by shell works and by nagios dashboard not?

Can someone help me?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_by_ssh problem

Post by mcapra »

Can you run the following command both as the nagios user and as root from the CLI of your Nagios Core machine and share the output:

Code: Select all

/usr/local/nagios/libexec/check_by_ssh -H jb1 -t 60 -l nagios -C "/opt/jboss/scripts/check_file_size_custom.sh --maxwarn 80000000 --maxcrit 150000000 /opt/jboss/domain/servers/*/log/* /opt/jboss/domain/log/*" -E && echo $?
Can you also post the service definition as well as the corresponding command definition used for this check?
Former Nagios employee
https://www.mcapra.com/
Locked