Page 1 of 1

check_mssql_database.py

Posted: Tue Mar 26, 2013 4:52 pm
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.

Re: check_mssql_database.py

Posted: Tue Mar 26, 2013 4:56 pm
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.

Re: check_mssql_database.py

Posted: Tue Mar 26, 2013 5:02 pm
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

Re: check_mssql_database.py

Posted: Wed Mar 27, 2013 9:23 am
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?

Re: check_mssql_database.py

Posted: Wed Mar 27, 2013 4:25 pm
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

Re: check_mssql_database.py

Posted: Wed Mar 27, 2013 4:49 pm
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.

Re: check_mssql_database.py

Posted: Wed Mar 27, 2013 5:41 pm
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.

Re: check_mssql_database.py

Posted: Thu Mar 28, 2013 9:18 am
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 "!"