CentOS5.2 x64/ net-snmp 5.3.1 / rrd-tool 1.2.30
Cacti 0.8.7d
cacti-plugin-0.8.7d-PA-v2.4
Settings – v0.5
Thold – v0.4.1
1. install package
yum -y install httpd
yum -y install php
yum -y install php-mysql
yum -y install php-snmp
yum -y install mysql-server
yum -y install perl
yum -y install net-snmp-utils
yum -y install libpng
yum -y install freetype
yum -y install libart_lgpl
2. set chkconfig
chkconfig httpd on
chkconfig mysqld on
3.download rrdtool http://oss.oetiker.ch/rrdtool/download.var
wget http://dag.wieers.com/rpm/packages/rrdtool/perl-rrdtool-1.2.23-1.el5.rf.i386.rpm
wget http://dag.wieers.com/rpm/packages/rrdtool/rrdtool-1.2.23-1.el5.rf.i386.rpm
4.install rddtool
rpm -ivh perl-rrdtool-1.2.23-1.el5.rf.i386.rpm rrdtool-1.2.23-1.el5.rf.i386.rpm
5. change mysql charset
vi /etc/my.cnf
[mysqld]
collation-server = utf8_general_ci
default-collation = utf8_general_ci
character-set-server = utf8
default-character-set = utf8
6. download cacti
wget http://www.cacti.net/downloads/cacti-0.8.7d.tar.gz
tar zxvf cacti-0.8.7d.tar.gz
7. download cacti-plugin-0.8.7d-PA-v2.4.zip from cactiuser & extract it
2 method of install:
1) cd /path/cacti-0.8.7d && patch -p1 -N –dry-run < /path/to/cacti-plugin-0.8.7d-PA-v2.4.diff
2) cd /path/cacti-0.8.7d && cp -R /path/to/files-0.8.7d/* ./
注: 第一种方式在我这里报错了,官方论坛上也有提及,如果你也有遇到可以直接用第二种方式更新
8. imp cacti db
mysqladmin create cacti
mysql -u root -p cacti < /path/to/cacti.sql
mysql -u root -p cacti < /path/to/pa.sql
mysql> create user cacti@’localhost’;
mysql> create user cacti@’127.0.0.1′;
mysql> grant all privileges on cacti.* to cacti@’localhost’;
mysql> grant all privileges on cacti.* to cacti@’127.0.01′;
mysql> set password for cacti@’localhost’ = password(’cactipasswd’);
mysql> set password for cacti@’127.0.0.1′ = password(’cactipasswd’);
9. ensure the db-section at global.php is correct
vi /opt/www/html/cacti/include/global.php #–>check this section: /* Default database settings*/
10. set crontab
crontab -u cacti -e
*/5 * * * * /usr/bin/php /opt/www/html/cacti/poller.php > /dev/null 2>&1
11. install threshold
wget http://cactiusers.org/downloads/settings.tar.gz
wget http://cactiusers.org/downloads/thold.tar.gz
wget http://cactiusers.org/downloads/monitor.tar.gz
12. exract
tar zxvf settings.tar.gz
tar zxvf thold.tar.gz
tar zxvf monitor.tar.gz
13. place plug-in files into appropriate directory
mv settings /opt/www/html/cacti/plugins/
mv thold /opt/www/html/cacti/plugins/
mv monitor /opt/www/html/cacti/plugins/
14. update mysql db
mysql -u root -p cacti < thold.sql
mysql -u root -p cacti < monitor.sql
15. activate plug-ins now:
vi /opt/www/html/cacti/include/global.php
$plugins = array();
$plugins[] = ’settings’;
$plugins[] = ‘thold’;
$plugins[] = ‘monitor’;
16. After installation, the 1st thing u need do is edit admin account, otherwise the “plug-in management” & “ThreshHold Templates” will not be added into console tab
Console -> User Management -> admin

Now go to:
Console -> Plugin Management
At “Thresholds”, click “Install” & “Enable”

17. Use Tholds
17.1 mail settings
Go to console -> Settings select the “Mail/DNS” tab
Go to console -> Settings select the “Alerting/Thold” tab
enable “Dead Hosts Notifications”
Dead Host Notifications Email: enter the web-admin mail account
From Email Address: cacti alert mail accout
Save the configuration.
Then we will receive alter-mail when a host goes down or up:
17.2 create Threshhold Templates
Go to Console -> Threshhold Templates
Create
you need
17.3 Apply the Threshhold Templaes
Then Go to Console -> devices
Click the device you want to apply the Threshhold Template
And then click “Create Graphs for this Host”
Create Graphs for this Host -> Auto-create thresholds
17.4 some threshold examples
Create disk usage Thold template
When (used_space/total_space%) > 90%, cacti will send alert mail
4.1.1 Add “VALUE_OF_HDD_TOTAL” at global _arrays.php
vi /opt/www/html/cacti/include/global _arrays.php
add VALUE_OF_HDD_TOTAL
find
$custom_data_source_types = array(
add
“VALUE_OF_HDD_TOTAL” => “Value of hdd_total data source”,
add a new CDEF
Now go to Console -> Graph Management -> CDEFs click “Add” to add a new CDEF
Add new CDEF named like “Used Disk Space Percent”, at this CDEF, add 5 items:
Item #1 Special Data Source: CURRENT_DATA_SOURCE
Item #2 Custom String: 100
Item #3 Operator: *
Item #4 Special Data Source: VALUE_OF_HDD_TOTAL
Item #5 Operator: /
create new Threshold Templates
Go to Console -> Threshold Templates -> click Add
For linux host, we choose “ucd/net – CPU Usage – user” template;
for windows host, we choose “Host MIB – Hard Drive Space” template
this depends on what templates we used in device graphic:
Data Field: hdd_used
Enabled: yes
Threshold Type: High / Low
High Threshold: 90
Low Threshold: 0
Data Type: CDEF
Threshold CDEF: Used Disk Space Percent (the CDEF Name we just created)
Alert E-Mail: the email-address that alert message will send to
ucdnet memroy usage linux
cacti_graph_template_ucdnet_-_memory_usage_linux
Reference:
http://forums.cacti.net/viewtopic.php?t=13829
http://cactiusers.org/wiki/TholdDocs
http://www.bsdmap.com/2008/12/07/how-to-install-cacti/
pyopyo docs


