linux 下cacti監控

 

如果忘記密碼不能登入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 [email protected] identified by 'cacti';

Query OK, 0 rows affected (0.00 sec)

mysql> grant  all privileges on cacti.* to [email protected]  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啓用插件管理器

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章