模板下載:
(1)能夠直接下載本站發佈的
Cnyunwei-Cacti+Nagios 集成全自動安裝ISO進行安裝,已集成此模板及更多的使用插件模板
(2)能夠直接去官方論壇下載最新的模板
http://forums.cacti.net/viewtopic.php?f=12&t=38135
php-mssql配置:
cacti的機器上必須有php-mssql驅動
php -m | grep mssql 查看是否有mssql,如沒有安裝的話,直接yum安裝便可
yum install php-mssql -y
Cacti配置:
一、導入增長ms sql監控模板 Console – Import Templates \ 瀏覽 選擇
cacti_host_template_windows_-_sql_server.xml save
導入後graph templates包含:
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
二、上傳ss_win_mssql.php到 cacti目錄下的scripts目錄裏,並賦予權限
三、sqlserver 執行語句 給予監控權限,還有防禦牆要給予1433端口對應的ip訪問權限
USE master
CREATE LOGIN cactistats WITH PASSWORD=N'www.cnyunwei.com', DEFAULT_DATABASE= master,DEFAULT_LANGUAGE=us_english, CHECK_EXPIRATION=OFF,CHECK_POLICY=OFF
EXEC sys.sp_addsrvrolemember @loginame = N'cactistats', @rolename = N'processadmin'
CREATE USER cactistats FOR LOGIN cactistats WITH DEFAULT_SCHEMA=dbo
GRANT SELECT ON sys.dm_os_performance_counters TO cactistats
四、在要監控的MS SQL服務器上,建立相應的用戶,注意密碼設置後,修改ss_win_mssql.php裏的密碼與之對應
function ss_win_mssql ($hostname, $cmd, $username = NULL, $password = NULL) {
list($host, $port) = explode(':', $hostname);
$port = ($port == '' ? '1433' : $port);
$username = ($username == NULL ? '
cactistats' : $username);
$password = ($password == NULL ? '
www.cnyunwei.com' : $password);
五、在添加監控設備時,Host Template 選擇 」Windows – SQL Server」
腳本測試:
/usr/bin/php -q /var/www/html/scripts/ss_win_mssql.php 122.xxx.xxx.xxx scans cactistats
www.cnyunwei.com
fullscans:114947 rangescans:4428184 probescans:4228710 indexsearches:8975892
php /usr/local/cacti/scripts/ss_win_mssql.php 122.xxx.xxx.xxx connections
userconnections:10
部分監控圖片展現:
來自羣組:
北京運維圈