Overview: SQL Server2000\2005\2008 does not support snmp, use cacti to monitor mssql, you must connect mssql through php to get the value of SQL 2005 performance calculator.
Steps:
1.php connect mssql freetds tool
[[email protected] /]# yum install freetds –y
2. Install the php-mssql driver
[[email protected] /]# yum install php-mysql -y
3. Test the connection of mssql
[[email protected] /]#php –q test_mssql_connect.php
#Detailed code please download the attachment
4. Configure the monitoring script after downloading the plug-in
(1) Create a new monitoring user account in sql sever,
The content in sql scripts\sql_server_2005-2008.sql is imported into sql server2005, and the user and password can be modified according to the actual situation. The code is detailed in the attachment.
(2) Test and monitor mssql connection: php -q test_mssql_connect.php User connection: # php test_dm_os_performance_counters.php
#Detailed code, please see attachment.
(3) Fill in the monitoring script: upload the decompressed scripts\ss_win_mssql.php to scripts/ under the cacti directory of the cacti server, and grant permissions.
[[email protected] scripts]# chmod 755 ss_win_mssql.php
If memcached is not installed. You need to comment out the lines related to memcached. Otherwise, mssql data cannot be retrieved, see nearby for details.
(4) Test monitoring script:
/usr/bin/php -q /var/www/html/cacti/scripts/ss_win_mssql.php monitoring service IP connetions username password
After executing the last name, the following result appears, indicating that the test was successful.
fullscans:4167 rangescans:611197 probescans:130196372 indexsearches:3420215
(5) Import template: import the decompressed template\cacti_host_template_windows_-_sql_server.xml into cacti
Console → Import/Export → Import Templates → select file → Import
The imported Host Templates are named Windows-SQL Server
After import, graph templates contain:
Windows-SQL Server-Backup/Restore I/O
Windows-SQL Server-Buffer Cache
Windows-SQL Server-Connections
Windows-SQL Server-Log Cache
Windows-SQL Server-Log Flush I/O
Windows-SQL Server-Log Flushes
Windows-SQL Server-Memory
Windows-SQL Server-Page I/O
Windows-SQL Server-Page Splits
Windows-SQL Server-Procedure Cache
Windows-SQL Server-Processes Blocked
Windows-SQL Server-SQL Compilations
Windows-SQL Server-Table Scans
Windows-SQL Server-Temp Tables
Windows-SQL Server-Transactions
(6) New devices are omitted, pay attention to a problem, select the items to be monitored in "Graph Templates", click "Create" and then "Create Graphs from Data Query" will appear, and the port number, user name, and password of sql server are required to be filled in. If you do not fill in here, the port number, user name, and password previously filled in ss_win_mssql.php will be used directly, and subsequent operations such as Data Source List and *Graph List will be omitted.
In summary, to successfully configure cacti to monitor mssql2005, there are several things to note:
1. A freetds tool and a php-mssql driver must be installed;
2. The database side (the monitored server side) adds a user name and password through a piece of code;
3. Use a small piece of code to test the connection between the database and the user;
4. This production server does not have memcached installed, and you need to comment out the lines related to memcached, otherwise the mssql data cannot be retrieved.
5. Importing templates and uploading and modifying script files should also be familiar.
cacti monitors mssql 2005 running resources