linux 下cacti监控
如果忘记密码不能登入cacti
用root用户进入系统
# mysql -u root -p
mysql> show databases;
mysql> use cacti;
mysql> show tables;
mysql> select * from user_auth;
mysql> update user_auth set password=md5("cactipasswd") where id='1';
现在cacti新密码就是cactipasswd 用户为admin
一.安装包
# yum install httpdphp php-mysql php-snmp mysql-server perl-DBD-MySQL php-pdo net-snmp net-snmp-libs net-snmp-utils net-snmp-devel rubyruby-devel
Complete!
# chkconfig httpd on
# chkconfigmysqldon
# vim /etc/snmp/snmpd.conf
62 accessnotConfigGroup "" any noauth exactall none none
85view allincluded .1 80
# chkconfig snmpd on
# service snmpd restart
停止 snmpd: [失败]
启动 snmpd: [确定]
# service httpd start
启动 httpd: [确定]
# service mysqld start
初始化 MySQL 数据库: Installing MySQL system tables...
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[确定]
启动 MySQL: [确定]
将所需包放在/root/cacti下
# cd cacti/
# ll
总计 4184
-rw-r--r-- 1 root root 2236916 2010-09-29 cacti-0.8.7g.tar.gz
-rw-r--r-- 1 root root207069 2010-10-01 cacti-plugin-0.8.7g-PA-v2.8.tar.gz
-rw-r--r-- 1 root root442525 2010-10-01 monitor-latest.tgz
-rw-r--r-- 1 root root 1154026 2010-09-29 rrdtool-1.4.4-1.el5.wrl.i386.rpm
-rw-r--r-- 1 root root 55839 2010-09-29 rrdtool-perl-1.4.4-1.el5.wrl.i386.rpm
-rw-r--r-- 1 root root 18906 2010-09-29 rrdtool-ruby-1.4.4-1.el5.wrl.i386.rpm
-rw-r--r-- 1 root root 6701 2010-11-22 sendMsg.zip
-rw-r--r-- 1 root root 25570 2010-10-01 settings-latest.tgz
-rw-r--r-- 1 root root 90488 2010-10-01 thold-latest.tgz
# yum localinstall rrdt* --nogpgcheck
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Local Package Process
Examining rrdtool-1.4.4-1.el5.wrl.i386.rpm: rrdtool-1.4.4-1.wrl.i386
Marking rrdtool-1.4.4-1.el5.wrl.i386.rpm to be installed
rhel-cluster | 1.1 kB 00:00
rhel-clusterstorage | 1.1 kB 00:00
rhel-server | 1.1 kB 00:00
rhel-vt | 1.1 kB 00:00
Examining rrdtool-perl-1.4.4-1.el5.wrl.i386.rpm: rrdtool-perl-1.4.4-1.wrl.i386
Marking rrdtool-perl-1.4.4-1.el5.wrl.i386.rpm to be installed
Examining rrdtool-ruby-1.4.4-1.el5.wrl.i386.rpm: rrdtool-ruby-1.4.4-1.wrl.i386
Marking rrdtool-ruby-1.4.4-1.el5.wrl.i386.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package rrdtool.i386 0:1.4.4-1.wrl set to be updated
---> Package rrdtool-perl.i386 0:1.4.4-1.wrl set to be updated
---> Package rrdtool-ruby.i386 0:1.4.4-1.wrl set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
rrdtool i386 1.4.4-1.wrl /rrdtool-1.4.4-1.el5.wrl.i386 2.6 M
rrdtool-perl i386 1.4.4-1.wrl /rrdtool-perl-1.4.4-1.el5.wrl.i386 94 k
rrdtool-ruby i386 1.4.4-1.wrl /rrdtool-ruby-1.4.4-1.el5.wrl.i386 26 k
Transaction Summary
================================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total size: 2.7 M
Is this ok : y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : rrdtool 1/3
Installing : rrdtool-ruby 2/3
Installing : rrdtool-perl 3/3
Installed:
rrdtool.i386 0:1.4.4-1.wrl rrdtool-perl.i386 0:1.4.4-1.wrl
rrdtool-ruby.i386 0:1.4.4-1.wrl
Complete!
拆解 cacti的数据包
# tar -zxvf cacti-0.8.7g.tar.gz -C /var/www/html
# cd /var/www/html
# ll
总计 20
-rw-r--r--1 root root 383 04-08 13:35 50x.html
drwxr-xr-x 12 1000 users 4096 2010-07-10 cacti-0.8.7g
-rw-r--r--1 root root 171 04-08 14:56 index.html
-rw-r--r--1 root root 125 06-17 10:38 index.php
-rw-r--r--1 root root 255 04-08 23:17 index.txt
# mv cacti-0.8.7g/ cacti
# mysql
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> CREATE DATABASE cacti;
Query OK, 1 row affected (0.00 sec)
mysql> grantall privileges on cacti.* to cacti@localhost identified by 'cacti';
Query OK, 0 rows affected (0.00 sec)
mysql> grantall privileges on cacti.* to cacti@127.0.0.1 identified by 'cacti';
Query OK, 0 rows affected (0.00 sec)
mysql> grantall privileges on cacti.* to cacti@192.168.2.0identified by 'cacti';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
编辑crontab
# crontab -e
写入 */5 * * * * php /usr/html/cacti/poller.php >/dev/null 2>&1
# crontab-l
*/5 * * * * php /var/www/html/cacti/poller.php >/dev/null 2>&1
创建账号
# useradd cacti
# passwd cacti
Changing password for user cacti.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
导入数据库
# mysql-ucacti -pcacti cacti
页:
[1]