Page 1 of 1

mssql_server.py

Posted: Wed Feb 19, 2020 7:52 am
by Auel
define service{
use generic-service
host_name BTP
service_description SQL
check_command check_mssql_database.py -H BTP -U nagios -P XXXX -T XXXXXX -p 1433 --cpu -w 50 -c 80
}

not working. I use Nagios Core.

Please,can someone give me an example of how to define the service of this plugins?
mssql_server.py
Thanks

Re: mssql_server.py

Posted: Wed Feb 19, 2020 4:46 pm
by scottwilkerson
First you need to make a command definition
See:

Code: Select all

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/objectdefinitions.html#command
such as

Code: Select all

define command {
    command_name    check_mssql_database
    command_line    $USER1$/check_mssql_database.py -H $HOSTADDRESS$ $ARG1$
}
then you would change your check_command to something like this

Code: Select all

check_command    check_mssql_database!-U nagios -P XXXX -T XXXXXX -p 1433 -w 50 -c 80 --activetrans
The plugin I have has the following usage, but yours may vary

Code: Select all

# /usr/local/nagios/libexec/check_mssql_database.py -h
Usage: check_mssql_database.py -H hostname -U user -P password -T table --mode

Options:
  -h, --help            show this help message and exit

  Required Options:
    -H HOSTNAME, --hostname=HOSTNAME
                        Specify MSSQL Server Address
    -U USER, --user=USER
                        Specify MSSQL User Name
    -P PASSWORD, --password=PASSWORD
                        Specify MSSQL Password
    -T TABLE, --table=TABLE
                        Specify the table to check

  Optional Connection Information:
    -I INSTANCE, --instance=INSTANCE
                        Specify instance
    -p PORT, --port=PORT
                        Specify port.

  Nagios Plugin Information:
    -w WARNING, --warning=WARNING
                        Specify warning range.
    -c CRITICAL, --critical=CRITICAL
                        Specify critical range.

  Mode Options:
    --logshrinks        Log Shrinks
    --transpsec         Transactions Per Second
    --logfileusage      Log File Usage
    --logwait           Log Flush Wait Time
    --datasize          Database Size
    --activetrans       Active Transactions
    --logflushes        Log Flushes Per Second
    --logcachehit       Log Cache Hit Ratio
    --loggrowths        Log Growths
    --test              Run tests of all queries against the database.
    --time2connect      Time to connect to the database.
    --logtruncs         Log Truncations