I see a couple of issues with your command:
/usr/local/nagios/libexec/check_mssql_server.py -H 192.168.1.69 -U 'mydomain\\salam' -P my\*password' -p 1433 --time2connect --warning 10 --critical 20
1. You are escaping the backslash after the domain name, but the whole expression is wrapped in single quotes (which will take it literally)
2. You are missing a single quote before "my". If you are wrapping the password in single quotes, you won't need to escape the "*" with "\".
Try running the command as such:
Code: Select all
/usr/local/nagios/libexec/check_mssql_server.py -H 192.168.1.69 -U 'mydomain\salam' -P 'my*password' -p 1433 --time2connect --warning 10 --critical 20
Did this help.
Also I think that the KB article is not up-to-date as it shows in the arg field
--username .....--password
whereas in the Nagios it is
-U user -P password
There are a few mssql plugins that are used with our wizards. The options vary a bit, but in most cases, you could use either one - the "long" or the "short" version. This particular one:
[root@main-nagios-xi libexec]# ./check_mssql -h
check_mssql, 0.8.4
This plugin checks various aspect of an MSSQL server. It will also
execute queries or stored procedures and return results based on
query execution times and expected query results.
Options:
-h, --help Print detailed help screen.
-V, --version Print version information.
-H, --hostname Hostname of the MSSQL server.
-U, --username Username to use when logging into the MSSQL server.
-P, --password Password to use when logging into the MSSQL server.
-F, --cfgfile Read parameters from a php file, e. g.
-I, --instance Optional MSSQL Instance. (Overrides port)
-p, --port Optional MSSQL server port. (Default is 1433)
-d, --database Optional DB name to connect to.
-q, --query Optional query or SQL file to execute on MSSQL server.
-l, --longquery Optional query or SQL file to execute on MSSQL server.
The query is used for multiple line output only.
By default Nagios will only read the first 4 KB.
(MAX_PLUGIN_OUTPUT_LENGTH)
--decode Reads the query -q in urlencoded format. Useful if
special characters are in your query.
--decodeonly Decode the query -q
Prints the decoded query string and exits.
--encode Encodes the query -q
Prints urlencoded query and exits.
-s, --storedproc Optional stored procedure to execute on MSSQL server.
--parameters Optional parameters to pass to the stored procedure.
Assumes a comma-delimited list. Ignored if -s isn't set.
-r, --result Expected result from the specified query, requires -q.
The query pulls only the first row for comparison,
so you should limit yourself to small, simple queries.
-w, --warning Warning threshold in seconds on duration of check
-c, --critical Critical threshold in seconds on duration of check
-W, --querywarning Query warning threshold
-C, --querycritical Query critical threshold
The check_mssql_server.py uses the following options:
[root@main-nagios-xi libexec]# ./check_mssql_server.py -h
Usage: check_mssql_server.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