现在的位置: 首页 > 综合 > 正文

linux下cacti监控

2012年06月17日 综合 ⁄ 共 7509字 ⁄ 字号 暂无评论

安装软件

[root@it598]# 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@it598]#tar -zxvf cacti-0.8.7g.tar.gz -C /usr/html

[root@it598]# cd /usr/html

[root@it598html]# 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@it598html]# mv cacti-0.8.7g/ cacti

[root@it598html]# mysql

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

[root@it598html]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 14

Server version: 5.5.15-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE DATABASE cacti;

Query OK, 1 row affected (0.04 sec)

mysql> grant all privileges on cacti.* to cacti@localhost identified by 'cacti';

Query OK, 0 rows affected (0.04 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.03 sec)

mysql> \q

Bye

[root@it598html]#

编辑 crontab

[root@it598cacti]# crontab -l */5 * * * * php /usr/html/cacti/poller.php >/dev/null 2>&1

导入数据库

[root@it598html]# mysql -ucacti -pcacti cacti

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 15

Server version: 5.5.15-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

-> \q

Bye

编辑cacti的配置脚本

[root@it598html]# cd cacti/

[root@it598cacti]# 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@it598cacti]# useradd cacti

[root@it598cacti]# 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@it598cacti]# cd /usr/html/cacti/

[root@it598cacti]# chown -R cacti.cacti *

安装插件管理器

[root@it598~]# cd cacti/

[root@it598cacti]# tar -zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz

cacti-plugin-arch/

cacti-plugin-arch/files-0.8.7g/

cacti-plugin-arch/files-0.8.7g/poller.php

cacti-plugin-arch/files-0.8.7g/host.php

cacti-plugin-arch/files-0.8.7g/utilities.php

cacti-plugin-arch/files-0.8.7g/lib/

cacti-plugin-arch/files-0.8.7g/lib/poller.php

cacti-plugin-arch/files-0.8.7g/lib/functions.php

cacti-plugin-arch/files-0.8.7g/lib/html.php

cacti-plugin-arch/files-0.8.7g/lib/auth.php

cacti-plugin-arch/files-0.8.7g/lib/api_device.php

cacti-plugin-arch/files-0.8.7g/lib/rrd.php

cacti-plugin-arch/files-0.8.7g/lib/plugins.php

cacti-plugin-arch/files-0.8.7g/lib/variables.php

cacti-plugin-arch/files-0.8.7g/lib/html_form.php

cacti-plugin-arch/files-0.8.7g/graphs_new.php

cacti-plugin-arch/files-0.8.7g/graph.php

cacti-plugin-arch/files-0.8.7g/auth_changepassword.php

cacti-plugin-arch/files-0.8.7g/user_admin.php

cacti-plugin-arch/files-0.8.7g/plugins/

cacti-plugin-arch/files-0.8.7g/plugins/index.php

cacti-plugin-arch/files-0.8.7g/images/

cacti-plugin-arch/files-0.8.7g/images/install_icon_disabled.png

cacti-plugin-arch/files-0.8.7g/images/disable_icon.png

cacti-plugin-arch/files-0.8.7g/images/install_icon.png

cacti-plugin-arch/files-0.8.7g/images/view_none.gif

cacti-plugin-arch/files-0.8.7g/images/uninstall_icon.gif

cacti-plugin-arch/files-0.8.7g/images/enable_icon_disabled.png

cacti-plugin-arch/files-0.8.7g/images/enable_icon.png

cacti-plugin-arch/files-0.8.7g/graphs.php

cacti-plugin-arch/files-0.8.7g/include/

cacti-plugin-arch/files-0.8.7g/include/global.php

cacti-plugin-arch/files-0.8.7g/include/global_form.php

cacti-plugin-arch/files-0.8.7g/include/top_header.php

cacti-plugin-arch/files-0.8.7g/include/top_graph_header.php

cacti-plugin-arch/files-0.8.7g/include/global_settings.php

cacti-plugin-arch/files-0.8.7g/include/auth.php

cacti-plugin-arch/files-0.8.7g/include/bottom_footer.php

cacti-plugin-arch/files-0.8.7g/include/config.php.dist

cacti-plugin-arch/files-0.8.7g/include/plugins.php

cacti-plugin-arch/files-0.8.7g/include/global_constants.php

cacti-plugin-arch/files-0.8.7g/include/global_arrays.php

cacti-plugin-arch/files-0.8.7g/graph_image.php

cacti-plugin-arch/files-0.8.7g/plugins.php

cacti-plugin-arch/files-0.8.7g/data_sources.php

cacti-plugin-arch/files-0.8.7g/index.php

cacti-plugin-arch/files-0.8.7g/auth_login.php

cacti-plugin-arch/pa.sql

cacti-plugin-arch/README

cacti-plugin-arch/LICENSE

cacti-plugin-arch/cacti-plugin-0.8.7g-PA-v2.8.diff

[root@it598cacti]#

[root@it598cacti]# ll

总计 4188

-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

drwxr-xr-x 3 1000 users 4096 2010-07-10 cacti-plugin-arch

-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@it598cacti]# cp -R cacti-plugin-arch/* /usr/html/cacti/

cp:是否覆盖“/usr/html/cacti/LICENSE”? y

cp:是否覆盖“/usr/html/cacti/README”? y

[root@it598cacti]#

进入控制台,对管理员启用插件管理器

进入cacti的目录

[root@it598cacti]# mysql -ucacti -pcacti cacti

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 18

Server version: 5.5.15-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

mysql> patch -p1 -N

-> \q

Bye

拆解插件

[root@it598cacti]# tar -zxvf thold-latest.tgz

[root@it598cacti]# tar -zxvf monitor-latest.tgz

[root@it598cacti]# tar -zxvf settings-latest.tgz

[root@it598cacti]# mv monitor-0.9/ /usr/html/cacti/plugins/monitor

[root@it598cacti]# mv thold-0.41/ /usr/html/cacti/plugins/thod

[root@it598cacti]# mv settings-0.6/ /usr/html/cacti/plugins/settings

[root@it598cacti]#

给我留言

留言无头像?