模板下载:
(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配置:
1、导入增加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
2、上传ss_win_mssql.php到 cacti目录下的scripts目录里,并赋予权限
3、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
4、在要监控的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);
5、在添加监控设备时,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
部分监控图片展示: