check_mssql_database.py

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
felipelps
Posts: 5
Joined: Tue Mar 26, 2013 4:47 pm

check_mssql_database.py

Post by felipelps »

Hi All,

My script check_mssql_database.py,its working fine, but i when i tryied to configure on NAgios i´ve a problem.

Could someone help me in this configuration ?
define service{
use generic-service-workhours
host_name BESSPSRV35
service_description BASE SQL ePO4_BESSPSRV35
check_command /usr/local/nagios/libexec/check_mssql_database.py -H XXXX -U XXXX -P XXX -T XXXX-p 3638 --datasize -w 3500000 -c 3700000
}
When i executed this line command /usr/local/nagios/libexec/check_mssql_database.py -H XXXX -U XXXX -P XXX -T XXXX-p 3638 --datasize -w 3500000 -c 3700000 its work fine.

Thanks.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mssql_database.py

Post by slansing »

What is the problem you asked about? Can you share the error you received when trying to add the command and service definition to Nagios XI? Do you have the plugin added as a command? It must be added via Configure > Core Configuration Manager > Commands.

For example:

Code: Select all

define service {
        host_name                       192.168.5.1
        service_description             I/O Wait
        use                             xiwizard_nagiosxiserver_service
        check_command                   check_xi_nagiosxiserver!--address=192.168.5.1 -xxxxxxxxxxxxxxxxxxxx
        max_check_attempts              5
        check_interval                  5
        retry_interval                  1
        check_period                    xi_timeperiod_24x7
        notification_interval           60
        notification_period             xi_timeperiod_24x7
        contacts                        nagiosadmin
        _xiwizard                       nagiosxiserver
        register                        1
        }
It looks like you may be trying to create that service by hand, as that is not how Nagios XI normally formats services. You should be creating it through the Core Configuration Manager, or allowing a Wizard to walk you through the steps, and then adding an additional, custom service.
felipelps
Posts: 5
Joined: Tue Mar 26, 2013 4:47 pm

Re: check_mssql_database.py

Post by felipelps »

[root@besspsrv24 libexec]# service nagios restart
Running configuration check... CONFIG ERROR! Restart aborted. Check your Nagios configuration.

[root@besspsrv24 libexec]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Checking services...
Error: Service check command '"/usr/local/nagios/libexec/check_mssql_database.py -H XXXXX -U XXXX -P XXXX -T XXXXX -p 3638 --datasize -w 3500000 -c 3700000"' specified in service 'BASE SQL ePO4_BESSPSRV35' for host 'BESSPSRV35' not defined anywhere!
Checked 395 services.

The script works fine, but when i try to configure on Nagios i have this problems, im sure that im using the wrong configuration.

define service{
use generic-service-workhours
host_name BESSPSRV35
service_description BASE SQL ePO4_BESSPSRV35
check_command check_mssql_database.py -H XXXX -U XXXX -P XXXX -T XXXX -p 3638 --datasize -w 3500000 -c 3700000
}


Thanks
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_mssql_database.py

Post by lmiltchev »

Is "check_mssql_database.py" command defined? Go to the Core Config Manager->Commands->type "check_mssql_database.py" in the "Search" bar and hit "Enter". Do you see your command?
Be sure to check out our Knowledgebase for helpful articles and solutions!
felipelps
Posts: 5
Joined: Tue Mar 26, 2013 4:47 pm

Re: check_mssql_database.py

Post by felipelps »

No, cant see the command.
Do u know how can i configure this in the config file, /usr/local/nagios/etc/objects/commands.cfg ?

Many thanks
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mssql_database.py

Post by slansing »

Since you are running Nagios XI you should already have a command which can be used for that plugin as it comes with the MSSQL database wizard.

It should look like the following, with the same name:
mssqldb.jpg
"full command name: check_xi_mssql_database"

You should also be able to select it as a command from your service modifications page, for the service, within the Core Configuration Manager.
You do not have the required permissions to view the files attached to this post.
felipelps
Posts: 5
Joined: Tue Mar 26, 2013 4:47 pm

Re: check_mssql_database.py

Post by felipelps »

Hi Slansing,

Now i can see the command, but i dont know if i put it correct;
check_mssql_database.py $USER1$/check_mssql_database.py -H $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$

And in the servisse config i put as this;
define service{
use generic-service-workhours
host_name BESSPSRV35
service_description BASE SQL ePO4_BESSPSRV35
check_command check_mssql_database.py -H besspsrv35 -U nagios -P XXXX -T XXXXXX -p 3638 --datasize -w 3500000 -c 3700000
}


How should be the check_command ?

Thank u very much.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_mssql_database.py

Post by slansing »

You can leave the -H out of the service config as it automatically pulls that data from it's parent host. You will however, need to separate your arguments by "!'s" like so:

Code: Select all

check_local_procs!250!400!RSZDT
Where: check_local_procs is the command name, and each argument, starting with $ARG1$, is divided by a "!"
Locked