`
lavafree
  • 浏览: 534969 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

nginx下搭建cacti监控服务器

阅读更多

 

一.安装nginx,php,mysql

详见张宴的 Nginx 0.8.x + PHP 5.2.13(FastCGI)搭建胜过Apache十倍的Web服务器(第6版)http://blog.s135.com/nginx_php_v6/

二.安装 RRDtool和net-snmp

yum install rrdtool

yum install net-snmp

yum install net-snmp-utils

 

修改snmp配置

shell>vi /etc/snmp/snmpd.conf
  把第89行前面的注释符号#去掉,变成 
  view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
  在62行进行修改:将
  access notConfigGroup "" any noauth exact systemview   改为
  access notConfigGroup "" any noauth exact mib2 none none

 

 snmp默认的弱口令为Public,安全改为一个更复杂的口令,
修改第41行的community字段..把public改成mypassword就可以了,将“default”改为你想哪台机器
可以看到你的snmp信息,如10.10.10.10,)
重启服务service snmpd restart
查看snmp是否获取信息
snmpwalk -v 1 127.0.0.1 -c public
如果可以看到大量的信息输出..就表明snmp已经配置好了

 

三.安装cacti

1. 解压

shell>cp cacti-version.tar.gz /usr/local/webserver/nginx/html/

shell> tar xzvf cacti-version.tar.gz

2. 创建数据库

shell> mysqladmin --user=root create cacti

3. 导入数据

shell> mysql cacti < cacti.sql

4. 创建cacti用户

shell> mysql --user=root mysql

mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';

mysql> flush privileges;

5. 剪辑 include/config.php 文件,更改数据库连接

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cactiuser";

$database_password = "somepassword";

6. 配置nginx.conf

server {

        listen 80;

 

        root html; #apps下面有cacti目录

        index index.php index.html;

        location ~.*\.(php|php5)?$ {

                root html;  #apps下面有cacti目录

                fastcgi_pass 127.0.0.1:9000;

                fastcgi_index index.php;

                include fastcgi_params;

        }

}

7.增加www的权限

chown -R /usr/local/webserver/nginx/html/cacti/log /usr/local/webserver/nginx/html/cacti/raa

*/5 * * * * php /usr/local/webserver/nginx/html/cacti/poller.php > /dev/null 2>&1

8. 浏览器访问:

http://your-server/cacti/

进入安装界面

安装完成,就可以使用了,默认用户名:admin密码:admin

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics