您的位置:首页 > 运维架构 > Linux

linux 下cacti监控

2012-06-17 22:21 211 查看
如果忘记密码不能登入cacti

用root用户进入系统

[root@localhsot]# 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
一.安装包

[root@www ~]# yum install httpd php php-mysql php-snmp mysql-server perl-DBD-MySQL php-pdo net-snmp net-snmp-libs net-snmp-utils net-snmp-devel ruby ruby-devel
Complete!

[root@www ~]# chkconfig httpd on
[root@www ~]# chkconfig mysqld on
[root@www ~]# vim /etc/snmp/snmpd.conf
62 access notConfigGroup "" any noauth exact all none none
85view all included .1 80
[root@www ~]# chkconfig snmpd on

[root@www ~]# service snmpd restart
停止 snmpd: [失败]
启动 snmpd: [确定]
[root@www ~]# service httpd start
启动 httpd: [确定]
[root@www ~]# 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下

[root@www ~]# cd cacti/
[root@www cacti]# ll
总计 4184
-rw-r--r-- 1 root root 2236916 2010-09-29 cacti-0.8.7g.tar.gz
-rw-r--r-- 1 root root 207069 2010-10-01 cacti-plugin-0.8.7g-PA-v2.8.tar.gz
-rw-r--r-- 1 root root 442525 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

[root@www ]# 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/N]: 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的数据包

[root@www ]# tar -zxvf cacti-0.8.7g.tar.gz -C /var/www/html
[root@www ]# cd /var/www/html
[root@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
[root@www html]# mv cacti-0.8.7g/ cacti
[root@www html]# 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> grant all privileges on cacti.* to cacti@localhost identified by 'cacti';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on cacti.* to cacti@127.0.0.1 identified by 'cacti';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on cacti.* to cacti@192.168.2.0 identified 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

[root@www html]# crontab -e
写入 */5 * * * * php /usr/html/cacti/poller.php >/dev/null 2>&1
[root@www html]# crontab -l
*/5 * * * * php /var/www/html/cacti/poller.php >/dev/null 2>&1

创建账号

[root@www html]# useradd cacti
[root@www html]# 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.

导入数据库

[root@www html]# mysql -ucacti -pcacti cacti </var/www/html/cacti/cacti.sql

[root@www html]# cd /var/www/html/cacti/
改变权限
[root@www cacti]# chown -R root.root *
编辑cacti的配置脚本

[root@www cacti]# vim include/config.php
26 $database_type = "mysql";
27 $database_default = "cacti";
28 $database_hostname = "localhost";
29 $database_username = "cacti";
30 $database_password = "cacti";
31 $database_port = "3306";

二.安装插件管理器

[root@www ~]# cd /root/cacti/
[root@www cacti]# tar -zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz

[root@www cacti]# cp -R cacti-plugin-arch/* /var/www/html/cacti/
cp:是否覆盖“/usr/html/cacti/LICENSE”? n
cp:是否覆盖“/usr/html/cacti/README”? n

进入cacti的目录
[root@www cacti]# cd /var/www/html/cacti/

[root@www cacti]# mysql -ucacti -pcacti cacti <pa.sql
[root@www cacti]# patch -p1 -N <cacti-plugin-0.8.7g-PA-v2.8.diff

编辑php的配置文件
[root@www cacti]# vim include/config.php

42 $url_path = "/cacti/";

拆解插件
[root@www cacti]#cd /root/cacti/

[root@www cacti]# tar -zxvf thold-latest.tgz
[root@www cacti]# tar -zxvf monitor-latest.tgz
[root@www cacti]# tar -zxvf settings-latest.tgz
[root@www cacti]# mv monitor-0.9/ /var/www/html/cacti/plugins/monitor
[root@www cacti]# mv thold-0.41/ /var/www/html/cacti/plugins/thold
[root@www cacti]# mv settings-0.6/ /var/www/html/cacti/plugins/settings

进入控制台中User Management,对管理员admin启用插件管理器
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux 监控 cacti