cacti install and threshold settings

June 15th, 2009 viva No comments

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
cacti user

cacti plugin

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

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 Threshhold Templates 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: /

cdef

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

graph_image

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

Categories: Tech Tags: ,

httpd2.2 tomcat5.5 mod_jk integration

June 13th, 2009 viva 1 comment

httpd 编译参数

./configure –prefix=/opt/httpd2/ \
–with-mpm=worker \
–enable-ssl \
–enable-cache \
–enable-disk-cache \
–enable-mem-cache \
–enable-rewrite \
–enable-usertrack \
–enable-proxy \
–enable-proxy-connect \
–enable-proxy-http \
–enable-deflate

编译安装

make && make install

下载 mod_jk 并 cp 至 httpd modules 目录(请根据自己的发行版选择,这里使用 centos 52 x64)

wget http://apache.etoak.com/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.28/x86_64/mod_jk-1.2.28-httpd-2.2.X.so
cp /where/is/your/mod_jk-1.2.28-httpd-2.2.X.so /opt/httpd2/modules/mod_jk.so

配置 workers.properties
vi /opt/httpd2/conf/workers.properties

#
# workers.properties
#
# list the workers by name
worker.list=s1
# localhost server 1
# ————————
worker.s1.port=8009
worker.s1.host=localhost
worker.s1.type=ajp13

配置 http.conf 添加 modjk 参数
vi /opt/httpd2/conf/httpd.conf

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat “%w %V %T”
JkLogFile logs/mod_jk.log
JkLogLevel error

添加动态页面转发

JkMount /*.jsp s1
JkMount /*.action s1
JkMount /*Servlet* s1

httpd-mpm.conf 参数


ServerLimit 30
StartServers 2
ThreadLimit 200
MaxClients 3000
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 100
MaxRequestsPerChild 10000

配置 tomcat server.xml
默认的 server.xml 过于臃肿,可以使用 server-minimal.xml 代替

vi /opt/tomcat5/conf/server.xml
修改 8009 的参数

maxTreads="800" minSpareThreads="10" maxSpareThreads="50"
acceptCount="50" connectionTimeout="60000"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

配置 context,注意 docBase 和 httpd 的 DocumentRoot 一致

unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

重启动 tomcat 和 httpd,大功告成。 :35:

btw: tomcat 启动内存调节
编辑 catalina.sh 添加下面的内容

JAVA_OPTS=’-Xms1024m -Xmx2048m’

Categories: Tech Tags: , ,

Test WP Super Cache

May 30th, 2009 viva No comments

wp super cache is done :34:

Categories: Tech Tags:

kds emotions

May 30th, 2009 viva 2 comments

特别喜欢 kds 的表情符号,今天抽空替换到了自己 blog 上 :7: :7: :7: ,不知道在山上算啥水平 :8: :8: :8:

Categories: Normal Tags:

Shanghai Maglev

May 30th, 2009 viva 1 comment

昨天送老丈人去浦东机场,回来时和 lp 一起坐做的磁悬浮最高时速达到了 430公里,有意思的是加速过弯时车厢会非常倾斜(30度左右)但感觉不到抖动,唯一的遗憾就是时间太短票价过高 7 分钟 50 元…

shanghai maglev

Categories: Life Tags:

change host again,but ~MISSING DATA FOR THREE YEARS~

May 30th, 2009 viva No comments

cry

Categories: News Tags:

UPGRADE DONE

August 29th, 2005 viva No comments

败了 sp64 2500+epox EP-8HDA5I Pro+a-data 512*2 真 tmd 快,在 org 的时候终于能不卡乐,看来玩 wow 内存 1G 是必需的。

Categories: Normal Tags:

YONEX

July 2nd, 2005 viva No comments

Categories: Normal Tags:

lol my friend essay

June 29th, 2005 viva No comments

养鸡场的新运动

曾经有个不大不小,经营的不好不坏的养鸡场。

有一天,养鸡场boss突然决定收购一个规模大很多的养猪场,对方据说觉得猪吃得多,亏得多,有意出售。

目前仍然不清楚什么原因驱动boss毅然进行了兼并,但是据说当时养鸡场方面凭借多年“高科技”的养鸡经验,有把握让猪不吃or少吃饲料照样长膘,于是成立了“鸡猪联营公司”。

怎奈猪还不好养,养鸡场店小利薄,鸡饲料不够猪吃,不久就开始欠饲料商钱了,boss想,与其赊着饲料商的钱,猪还不长膘,不如干脆不给饲料,于是实行了一段时期的“饥饿疗法”,几百头猪饿得不行。

到后来,情况更加恶化,电费也付不出了,电力公司拉电(真不人道),好多猪夏天就在没有空调没有电灯的黑漆漆的猪笼里闷着,还没饲料吃!想起以前滋润的日子,好多猪一边扇着扇子一边流出了伤心的眼泪。

当然养鸡场方面也不是没有尽力,自然使出了各种招数,比方说把2只忒别优待的肥猪拉到电台去秀什么的。最毒辣的招数据说是2boss想出来的,就是把笼子改一下,一只笼子里同时养一只猪和一只鸡,这样据说可以让猪和鸡彼此催膘…….

怎奈饲料最终吃完了,鸡阿猪阿的生生都饿死了!(据说还好多饲料商来抢死猪死鸡抵债)。

为了防止类似的事情再次发生,痛定思痛,boss决定:让养鸡场的扫粪工、饲养员什么的进行深刻反省,每人结合自己的工作,比如如何防止扫粪工工作偷懒,如何防止饲养员盗窃饲料,写一篇深刻的工作小结

看不懂?呵呵,没关系,那是因为你不是倒霉的养鸡场扫粪工、饲养员,这些可怜的人正愁小结的事呢,据说写的不深刻,不发自肺腑的话,要被开除的说

Categories: Normal Tags:

MSN 7.0.0813

June 17th, 2005 viva No comments

upgrade msn to 813,use new patch and new skin,so pl and cleanemoticon

download

Categories: Normal Tags:

GIVE UP

June 16th, 2005 viva No comments

本来今晚预订的羽毛球活动由于华师大场地的问题又 cancel 乐,真是无言以对,看来在那里订场地绝对是考验 rp 的一件事。

Categories: Normal Tags:

SIGH

June 9th, 2005 viva No comments

很久很久没有更新过了(更新也没人看-.-),发现 wow 实在是太废时间鸟!现在所有的业余时间都泡在上面,除了一星期还能保持打两次羽毛球。

Categories: Normal Tags:

WOW

May 3rd, 2005 viva No comments

终于还是上了 WOW 的贼船,tmd 真好玩!!!
偶第一个 char 是兽人战士练到 lv11 后被拉去参加了”黑社会”
现在主力混 1 区光明使者,Dreamland 工会 偶上面的 id 是 kikyou 欢迎大家来找偶哦:p

Categories: Normal Tags:

TRIP(an ji)

April 21st, 2005 viva 1 comment

公司福利被强行拉去参加周末的安吉一日游(不去的人罚款)

PP 回来补上

Categories: Normal Tags:

GOT IPOD MINI(GREEN)

April 17th, 2005 viva No comments

new version,sync use foo_podemoticon

Categories: Normal Tags: