-
Notifications
You must be signed in to change notification settings - Fork 0
/
cacti_install.sh
77 lines (64 loc) · 2.39 KB
/
cacti_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
## cacti 2016-09-06
## http://www.aqzt.com
##email: [email protected]
##robert yu
##centos 6
##cacti搭建
#安装LAMP环境
yum install -y gcc make vim unzip wget install httpd mysql mysql-devel mysql-server php php-devel php-mysql php-comman php-pdo php-gd lm_sensor net-snmp php-snmp net-snmp-utils
yum install -y gcc perl-devel libxml2-devel libpng-devel pkg-config glib pixman pango pango-devel freetype freetype-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel
### chkconfig mysqld on
### chkconfig httpd on
### chkconfig snmpd on
### service mysqld start
### service httpd start
### service snmpd start
### mysqladmin -u root password '123456'
### mysql -uroot -p
if false ; then
###注释start###
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.69 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on cacti.* to cactiuser@localhost identified by '654321';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
###注释end###
fi
tar zxvf rrdtool-1.4.5.tar.gz
cd rrdtool-1.4.5
./configure --prefix=/usr/local/rrdtool
make && make install
ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
cd ..
tar zxvf net-snmp-5.3.4.tar.gz
cd net-snmp-5.3.4
./configure --prefix=/usr/local/net-snmp
make && make install
cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/
ln -s /usr/local/net-snmp/bin/* /usr/local/bin/
/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf
echo "/usr/local/net-snmp/sbin/snmpd -c /usr/local/net-snmp/share/snmp/snmpd.conf" >>/etc/rc.local
cd ..
tar zxvf cacti-0.8.7g.tar.gz
cd cacti-0.8.7g
mysql -ucacti -pcactiWWW123 cacti < cacti.sql
cd include
sed -i "/cactiuser/ {29s/cactiuser/cacti/g}" config.php
sed -i "/cactiuser/ {30s/cactiuser/cactiWWW123/g}" config.php
cd ..
cd ..
mv cacti-0.8.7g /data/www/wwwroot/cacti
ln -s /usr/local/php-5.2.17/bin/php /usr/bin/php
/usr/bin/php /data/www/wwwroot/cacti/poller.php
echo "*/5 * * * * env LANG=C /usr/bin/php /data/www/wwwroot/cacti/poller.php" >>/etc/crontab