Sunday, February 7, 2010

Monitor MS SQL with ceck_mssql

!I had major problem getting the user authentication to work. As soon as I removed freetds it started to work...

One way is to run queries from Nagios directly to the MSSQL server with this plugin:
http://exchange.nagios.org/directory/Plugins/Databases/SQLServer/check_mssql/details

This is a risk since user / pwd has to be stored on the Nagios server and also sent over network. It is perhaps better to create vbs scripts that reads the database and access it over nsclient++.

1) Install check_mssql
download the script from http://exchange.nagios.org/directory/Plugins/Databases/SQLServer/check_mssql/details
Copy it to libexec
sudo cp check_mssql /usr/local/nagios/libexec
*Change owner to nagios and make it executable

2) Install php support in ubuntu
sudo apt-get install php5 php5-mysql php5-cli libapache2-mod-php5 php5-sybase
(I dont see why php5-mysql should be installed, but installed by mistake and if removed it stops working. Will test without next scratch install)

3) Test from commandline
/usr/local/nagios/libexec/check_mssql -H 192.168.0.100 -U myuser -P mypwd

x) from doc
sec
Hide Sensitive Information With $USERn$ Macros. The CGIs read the main config file and object config file(s), so you don't want to keep any sensitive information (usernames, passwords, etc) in there. If you need to specify a username and/or password in a command definition use a $USERn$ macro to hide it. $USERn$ macros are defined in one or more resource files. The CGIs will not attempt to read the contents of resource files, so you can set more restrictive permissions (600 or 660) on them. See the sample resource.cfg file in the base of the Nagios distribution for an example of how to define $USERn$ macros.

No comments:

Post a Comment