check_sqljob.sh

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.
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

check_sqljob.sh

Post by braindope »

Hi All,

Can anyone help me with my error?. i'm using check_sqljob.sh plugins but it's returning status of unknown in nagios, however ,when i manually run the checks it return a normal information. :cry:

below is the sample output when running manually

<a href=/nagios/sqllog/xx.xx.xx.xx-2015-02-25.html target=main> CRITICAL: Number of Jobs Failed:4|count=4</a>
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: check_sqljob.sh

Post by ssax »

Please post the output of the following:

Code: Select all

ls -l check_sqljob
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

Re: check_sqljob.sh

Post by braindope »

Hi,

here is the output below.

ls: check_sqljob: No such file or directory

and here the commands when i add .sh
ls -l check_sqljob.sh
-rwxr-xr-x 1 nagios nagios 1748 Feb 25 13:16 check_sqljob.sh
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_sqljob.sh

Post by Box293 »

Can you please post your service definition and the command definition.

Please also show us the command you are executing at the command line to test it along with the output.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

Re: check_sqljob.sh

Post by braindope »

Hi


define service{
use generic-service
host_name POSX_DB
service_description SQL_Jobs
check_command check_sqljob!<server IP>!<username>!<password>

}


define command{
command_name check_sqljob
command_line $USER1$/check_sqljob.sh -H $ARG1$ -u $ARG2$ -p $ARG3$
}
Attachments
check sqljob.txt
(1.76 KiB) Downloaded 276 times
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: check_sqljob.sh

Post by jdalrymple »

Does your Nagios user have rights to execute your java binary? You might want to `su nagios` and try to run the command logged in with that user.
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

Re: check_sqljob.sh

Post by braindope »

Hi jdalrymple,

your right the status is
UNKNOWN:
when i run it in nagios user , how can i make my nagios user run java? or can i make the checks to run on root user?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_sqljob.sh

Post by Box293 »

run this as root and then run it as nagios and post the output from both:

Code: Select all

which java
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
braindope
Posts: 80
Joined: Fri Sep 26, 2014 12:13 am

Re: check_sqljob.sh

Post by braindope »

Please see result below.

[root@pwnagios ~]# which java
/usr/bin/java

[nagios@pwnagios root]$ which java
/usr/bin/java
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: check_sqljob.sh

Post by jdalrymple »

Please post the output of

Code: Select all

ll /usr/bin/java
I suspect it will be owned by root:root or root:wheel and that the binary is not world executable. If that's the case the proper way to fix the problem would be to create an appropriate group and put the nagios user in it, or just put the nagios user in the java group if it already exists. Run that command, post the output and we'll figure it out for you.

Does this server do anything besides host Nagios?
Locked