Problem Description
After running the MSSQL Query wizard your new service has an UNKNOWN state with the following error:
UNKNOWN: Invalid characters in the username.
This problem can occur when trying to connect using Windows authentication and your username is something like user\domain, it is complaining about the backslash (\).
Resolution
The check_mssql plugin can be updated to allow the backslash. Establish a terminal session to your Nagios xi server as the user root.
Execute the following command to open the /usr/local/nagios/libexec/check_mssql file in vi:
vi /usr/local/nagios/libexec/check_mssql
When using the vi editor, to make changes press i on the keyboard first to enter insert mode. Press Esc to exit insert mode.
Jump to line 347 by typing the following:
:347
and press Enter.
The line you are looking for should look like this:
if (!preg_match("/^[a-zA-Z0-9-_]{2,32}$/", $db_user)) {
Change it to (add \\\\):
if (!preg_match("/^[a-zA-Z0-9-_\\\\]{2,32}$/", $db_user)) {
When you have finished, save the changes in vi by typing:
:wq
and press Enter.
After making these changes go back into the xi web interface and force an immediate check of the service to test that it is working correctly.
Final Thoughts
For any support related questions please visit the Nagios Support Forums at: