Linux监控和安全运维--cacti安装部署

cacti安装

[root@client~]# rpm -ivh http://www.aminglinux.com/bbs/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm

//安装epel扩展源

[root@client ~]# yum install -y  httpd php php-mysql mysql mysql-server mysql-devel php-gd  libjpeg libjpeg-devel libpng libpng-devel

//安装httpdphpmysql

 

[root@client ~]# yum install -y cacti  net-snmp  net-snmp-utils  rrdtool

//安装cacti  net-snmp  rrdtool

 

 

[root@client ~]# /etc/init.d/mysqld start

[root@client ~]# /etc/init.d/httpd start

[root@client ~]# /etc/init.d/snmpd  start

 

 

[root@client ~]# vim /etc/httpd/conf.d/cacti.conf

<Directory /usr/share/cacti/>

        <IfModule mod_authz_core.c>

                # httpd 2.4

                Require host localhost

        </IfModule>

        <IfModule !mod_authz_core.c>

                # httpd 2.2

                Order deny,allow

                 Allow from all

                Allow from localhost

        </IfModule>

</Directory>

 

 

[root@client ~]# /etc/init.d/httpd  restart

 

 

 

[root@client ~]# mysql -uroot  -e "create database cacti"

[root@client ~]# mysql -uroot -e "grant all on cacti.* to 'cacti'@'127.0.0.1' identified by 'cacti';"

[root@client ~]# mysql -uroot cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql

 

 

 

 

[root@client ~]# vim /usr/share/cacti/include/config.php

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "127.0.0.1";

$database_username = "cacti";

$database_password = "cacti";

$database_port = "3306";

$database_ssl = false;

 

 

web访问192.168.137.21/cacti进入cacti安装的图形页面

spacer.gif

next-----next------finish

User Name: admin

Password:admin

//输入用户名密码登入

 

Password:admin

Confirm:admin

//修改密码

 

登入成功

spacer.gif

 

 

 

 

 

[root@client ~]# /usr/bin/php /usr/share/cacti/poller.php

 

 

[root@client ~]# vim /etc/php.ini

date.timezone ='Asia/Chongqing'

 

 

[root@client ~]# crontab  -e

*/5 * * * *  /usr/bin/php /usr/share/cacti/poller.php

 

等待5分钟以上,任务计划执行后,有监控信息参数,产生为图片信息。

spacer.gif

 

 

 

以上监控的为本机

cacti增加客户端监控,安装客户端(增加一个linux服务器)

打开一台客户机

[root@client ~]# yum install -y net-snmp

[root@client ~]#  vim /etc/snmp/snmpd.conf

syslocation 137.21                         //可写本机IP

syscontact Root [email protected]               //管理员的邮箱

 

[root@client ~]# service  snmpd  start

 

 

 

 

在网页上增加该客户机的监控

spacer.gif

console-------Device-------Add----

Description  可写本机ip(或自定义)

 Hostname  可写本机ip

 Host Template  ucd/net  SNMP Host

 SNMP Version  Version 2

 

 ----create------Create Graphs for this Host---------

Graph Types: SNMP - Interface Statistics

选中网卡-----create

spacer.gif

 

 

 

 

Graph Types: Graph Template Based

Create: ucd/net - CPU Usage         

Create: ucd/net - Load Average    

Create: ucd/net - Memory Usage

三项全选,监控CPULoadMemory

create

spacer.gif

 

 

将这台设备的监控加入tree

Graph Trees------- Default Tree--------- Add------

spacer.gif

Host-----选中刚加的设备---create

spacer.gif

 

graphs---------Default Tree----192.168.137.21

spacer.gif

查看监控数据产生

 

你可能感兴趣的:(cacti安装部署)