21322121 发表于 2015-11-17 09:04:53

cacti 监控利器-服务安装搭建实战讲解

安装准备

操作系统环境

系统安装包选择


需要使用3台服务器。

一台监控的服务器C 183。一台snmp的服务器182 S1。一台web 服务器181 S2。


snmp简单介绍

简单网络管理协议(SNMP),由一组网络管理的标准组成,包含一个应用层协议(application layer protocol)、数据库模型(database schema)和一组资源对象。该协议能够支持网络管理系统,用以监测连接到网络上的设备是否有任何引起管理上关注的情况。该协议是互联网工程工作小组(IETF,Internet Engineering Task Force)定义的internet协议簇的一部分。SNMP的目标是管理互联网Internet上众多厂家生产的软硬件平台,因此SNMP受Internet标准网络管理框架的影响也很大。SNMP已经出到第三个版本的协议,其功能较以前已经大大地加强和改进了。


详细介绍:http://baike.baidu.com/link?url=z02jw0iHeRRubmzuEgAuuRhmb0zatU2d0O-KxxlsxUKMffxAxKprY6lTO_I-gLpnsY_bEUP0bl0n8k4Lz-BcF_
SNMP安装完整的命令集

cat /etc/redhat-release

uname -r

uname -m

yum install net-snmp* -y

ll /etc/snmp/snmpd.conf

cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori

cat >/etc/snmp/snmpd.conf<<EOF

com2sec local   localhost      public

com2sec mynetwork192.168.204.0/24   public

group MyRWGroup v1         local

group MyRWGroup v2c      local

group MyRWGroup usm      local

group MyROGroup v1         mynetwork

group MyROGroup v2c      mynetwork

group MyROGroup usm      mynetwork

view all    included.1                               80

access MyROGroup ""      any       noauth    exactall    none   none

access MyRWGroup ""      any       noauth    exactall    all    none

syslocation etiantian.org

syscontact Me <hyran@126.com>

proc mountd

proc ntalkd 4

proc sendmail 10 1

proc httpd 10 1

exec echotest /bin/echo hello world

exec disk_used_shell/bin/sh/root/current_disk_used.sh

exec httpd_proc/bin/sh/root/current_httpd_proc.sh

disk /       10000

disk /boot   10000

load 12 14 14

EOF

cat -n /etc/snmp/snmpd.conf

/etc/init.d/snmpd start

lsof -i :161

netstat -lntup|grep 161

ps -ef|grep snmpd|grep -v grep

snmpget -v 1 -c public localhost system.sysUpTime.0

tail -10 /var/log/snmpd.log

##################################################################################################





其他操作的命令集合

mkdir /home/oldboy/tools

cd /home/oldboy/tools

rz

ll

tar xf cacti_tools.tar.gz

tree

cd cacti_tools

ll

tar zxf libart_lgpl-2.3.17.tar.gz

cd libart_lgpl-2.3.17

./configure

make

make install

/bin/cp -r /usr/local/include/libart-2.0 /usr/include

cd ../







tar xf rrdtool-1.2.30.tar.gz

cd rrdtool-1.2.30

./configure

make && make install

ls -l /usr/local/bin/rrdtool

ls -l /usr/local/rrdtool-1.2.30/bin/rrdtool && ln -s /usr/local/rrdtool-1.2.30/bin/rrdtool

ls -l /usr/local/bin/rrdtool

ls -l /usr/local/rrdtool-1.2.30/bin/rrdtool && ln -s /usr/local/rrdtool-1.2.30/bin/rrdtool /usr/local/bin/rrdtool

ls -l /usr/local/bin/rrdtool

yum install gcc glibc glibc-common cairo pango zlib zlib-devel freetype freetype-devel gd gd-devel-y

yum install mysql* httpd* php* --skip-broken -y

cd ../

cd /etc/httpd/conf

cp httpd.conf httpd.conf.oldboy.ori

sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#' /etc/httpd/conf/httpd.conf

sed -i 's#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html #' /etc/httpd/conf/httpd.conf

egrep "127.0.0.1|index.php" /etc/httpd/conf/httpd.conf

/etc/init.d/httpd start

lsof -i :80

grep DocumentRoot httpd.conf

echo -e "<?php \nphpinfo(); \n?>" >/var/www/html/index.php

cat /var/www/html/index.php

rm -f /var/www/html/index.php

cd ~

/etc/init.d/mysqld start

lsof -i :3306

ps -ef|grep mysql

mysql

cd /home/oldboy/tools/

ll

cd cacti_tools

ll

tar xf cacti-0.8.8a.tar.gz

cd cacti-0.8.8a

mysql cacti <cacti.sql

mysql -e "use cacti;show tables;"

grep database include/config.php

grep apache /etc/httpd/conf/httpd.conf

chown -R apache rra/ log/

mv ../cacti-0.8.8a /var/www/html/cacti

cd /var/www/html/

ll

ll cacti/

ll

chown -R apache.apache cacti

/usr/bin/php /var/www/html/cacti/poller.php

chmod 755 /var/www/html/cacti/poller.php

/usr/bin/php /var/www/html/cacti/poller.php

/usr/bin/php /var/www/html/cacti/poller.php

/usr/bin/php /var/www/html/cacti/poller.php

/usr/bin/php /var/www/html/cacti/poller.php

/usr/bin/php /var/www/html/cacti/poller.php

echo '*/5 * * * */usr/bin/php /var/www/html/cacti/poller.php> /dev/null 2>&1' >>/var/spool/cron/root

crontab -l

cat /var/www/html/cacti/poller.php

ll /usr/local/bin/rrdtool

/usr/bin/php

ll /usr/bin/php

rpm -qa |grep net-snmp

netstat -lntup|grep 161

/etc/init.d/iptables stop

crontab -l

/usr/bin/php /var/www/html/cacti/poller.php

/usr/bin/php /var/www/html/cacti/poller.php

telnet 10.0.0.181 161

sz -y/etc/httpd/conf/httpd.conf


SNMP详细实战安装过程


如果yum安装的比较慢的话,需要提前配置好yum最好选择阿里源

#yum install net-snmp* -y   #所监控的和作为监控的机器都需要安装。

# cat /etc/redhat-release

CentOS release 5.8 (Final)

# unam -r

-bash: unam: command not found

# uname -r

2.6.18-308.el5

# uname -m

x86_64

#

# yum install net-snmp* -y



Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

* base: mirror.bit.edu.cn

* extras: mirror.bit.edu.cn

* updates: mirror.bit.edu.cn

base                                                               | 1.1 kB   00:00   

extras                                                             | 2.1 kB   00:00   

updates                                                            | 1.9 kB   00:00   

updates/primary_db                                                 | 734 kB   00:00   

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package net-snmp.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated

--> Processing Dependency: libsensors.so.3()(64bit) for package: net-snmp

---> Package net-snmp-devel.i386 1:5.3.2.2-17.el5_8.1 set to be updated

--> Processing Dependency: elfutils-devel for package: net-snmp-devel

--> Processing Dependency: lm_sensors-devel for package: net-snmp-devel

--> Processing Dependency: beecrypt-devel for package: net-snmp-devel

---> Package net-snmp-devel.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated

---> Package net-snmp-libs.i386 1:5.3.2.2-17.el5_8.1 set to be updated

---> Package net-snmp-libs.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated

---> Package net-snmp-perl.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated

---> Package net-snmp-utils.x86_64 1:5.3.2.2-17.el5_8.1 set to be updated

--> Running transaction check

---> Package beecrypt-devel.x86_64 0:4.1.2-10.1.1 set to be updated

--> Processing Dependency: beecrypt = 4.1.2-10.1.1 for package: beecrypt-devel

--> Processing Dependency: libbeecrypt.so.6()(64bit) for package: beecrypt-devel

---> Package elfutils-devel.x86_64 0:0.137-3.el5 set to be updated

--> Processing Dependency: elfutils-devel-static-x86_64 = 0.137-3.el5 for package: elfutils-devel

---> Package lm_sensors.x86_64 0:2.10.7-9.el5 set to be updated

---> Package lm_sensors-devel.x86_64 0:2.10.7-9.el5 set to be updated

--> Running transaction check

---> Package beecrypt.x86_64 0:4.1.2-10.1.1 set to be updated

---> Package elfutils-devel-static.x86_64 0:0.137-3.el5 set to be updated

--> Finished Dependency Resolution



Dependencies Resolved



==========================================================================================

Package                     Arch         Version                     Repository   Size

==========================================================================================

Installing:

net-snmp                  x86_64       1:5.3.2.2-17.el5_8.1      updates       706 k

net-snmp-devel            i386         1:5.3.2.2-17.el5_8.1      updates       1.9 M

net-snmp-devel            x86_64       1:5.3.2.2-17.el5_8.1      updates       2.0 M

net-snmp-perl               x86_64       1:5.3.2.2-17.el5_8.1      updates       201 k

net-snmp-utils            x86_64       1:5.3.2.2-17.el5_8.1      updates       192 k

Updating:

net-snmp-libs               i386         1:5.3.2.2-17.el5_8.1      updates       1.3 M

net-snmp-libs               x86_64       1:5.3.2.2-17.el5_8.1      updates       1.3 M

Installing for dependencies:

beecrypt                  x86_64       4.1.2-10.1.1                base         87 k

beecrypt-devel            x86_64       4.1.2-10.1.1                base          118 k

elfutils-devel            x86_64       0.137-3.el5               base         62 k

elfutils-devel-static       x86_64       0.137-3.el5               base          119 k

lm_sensors                  x86_64       2.10.7-9.el5                base          525 k

lm_sensors-devel            x86_64       2.10.7-9.el5                base         85 k



Transaction Summary

==========================================================================================

Install      11 Package(s)

Upgrade       2 Package(s)



Total download size: 8.5 M

Downloading Packages:

(1/13): elfutils-devel-0.137-3.el5.x86_64.rpm                      |62 kB   00:00   

(2/13): lm_sensors-devel-2.10.7-9.el5.x86_64.rpm                   |85 kB   00:00   

(3/13): beecrypt-4.1.2-10.1.1.x86_64.rpm                           |87 kB   00:00   

(4/13): beecrypt-devel-4.1.2-10.1.1.x86_64.rpm                     | 118 kB   00:00   

(5/13): elfutils-devel-static-0.137-3.el5.x86_64.rpm               | 119 kB   00:00   

(6/13): net-snmp-utils-5.3.2.2-17.el5_8.1.x86_64.rpm               | 192 kB   00:00   

(7/13): net-snmp-perl-5.3.2.2-17.el5_8.1.x86_64.rpm                | 201 kB   00:00   

(8/13): lm_sensors-2.10.7-9.el5.x86_64.rpm                         | 525 kB   00:00   

(9/13): net-snmp-5.3.2.2-17.el5_8.1.x86_64.rpm                     | 706 kB   00:00   

(10/13): net-snmp-libs-5.3.2.2-17.el5_8.1.i386.rpm               | 1.3 MB   00:00   

(11/13): net-snmp-libs-5.3.2.2-17.el5_8.1.x86_64.rpm               | 1.3 MB   00:01   

(12/13): net-snmp-devel-5.3.2.2-17.el5_8.1.i386.rpm                | 1.9 MB   00:01   

(13/13): net-snmp-devel-5.3.2.2-17.el5_8.1.x86_64.rpm            | 2.0 MB   00:01   

------------------------------------------------------------------------------------------

Total                                                   888 kB/s | 8.5 MB   00:09   

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Updating       : net-snmp-libs                                                   1/15

Installing   : lm_sensors                                                      2/15

Installing   : net-snmp                                                          3/15

Updating       : net-snmp-libs                                                   4/15

Installing   : beecrypt                                                          5/15

Installing   : net-snmp-perl                                                   6/15

Installing   : net-snmp-utils                                                    7/15

Installing   : beecrypt-devel                                                    8/15

Installing   : lm_sensors-devel                                                9/15

Installing   : elfutils-devel                                                   10/15

Installing   : elfutils-devel-static                                          11/15

Installing   : net-snmp-devel                                                   12/15

Installing   : net-snmp-devel                                                   13/15

Cleanup      : net-snmp-libs                                                    14/15

Cleanup      : net-snmp-libs                                                    15/15



Installed:

net-snmp.x86_64 1:5.3.2.2-17.el5_8.1         net-snmp-devel.i386 1:5.3.2.2-17.el5_8.1   

net-snmp-devel.x86_64 1:5.3.2.2-17.el5_8.1   net-snmp-perl.x86_64 1:5.3.2.2-17.el5_8.1

net-snmp-utils.x86_64 1:5.3.2.2-17.el5_8.1



Dependency Installed:

beecrypt.x86_64 0:4.1.2-10.1.1         beecrypt-devel.x86_64 0:4.1.2-10.1.1         

elfutils-devel.x86_64 0:0.137-3.el5      elfutils-devel-static.x86_64 0:0.137-3.el5   

lm_sensors.x86_64 0:2.10.7-9.el5         lm_sensors-devel.x86_64 0:2.10.7-9.el5         



Updated:

net-snmp-libs.i386 1:5.3.2.2-17.el5_8.1    net-snmp-libs.x86_64 1:5.3.2.2-17.el5_8.1   



Complete!

查看是否存在默认的snmp配置文件。

# ll /etc/snmp/snmpd.conf

-rw-r--r-- 1 root root 18579 May 21 17:00 /etc/snmp/snmpd.conf

# cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ori

增加snmp配置文件内容。全部清空原始内容,然后添加如下内容。

# cat >/etc/snmp/snmpd.conf<<EOF

com2sec local   localhost      public

com2sec mynetwork10.0.0.0/24   public

group MyRWGroup v1         local

group MyRWGroup v2c      local

group MyRWGroup usm      local

group MyROGroup v1         mynetwork

group MyROGroup v2c      mynetwork

group MyROGroup usm      mynetwork

view all    included.1                               80

access MyROGroup ""      any       noauth    exactall    none   none

access MyRWGroup ""      any       noauth    exactall    all    none

syslocation etiantian.org

syscontact Me <hyran@126.com>

proc mountd

proc ntalkd 4

proc sendmail 10 1

proc httpd 10 1

exec echotest /bin/echo hello world

exec disk_used_shell/bin/sh/root/current_disk_used.sh

exec httpd_proc/bin/sh/root/current_httpd_proc.sh

disk /       10000

disk /boot   10000

load 12 14 14

EOF

提示:snmp.conf的以下两行比较重要

com2sec local   localhost      public

com2sec mynetwork10.0.0.0/24   public

#其中的public为团体名字,可以随意改名字。

#10.0.0.0/24为允许访问的SNMP一般是内网IP的IP段。多个IP段换行写,也可以cat添加。

检查配置文件

# cat -n /etc/snmp/snmpd.conf

com2sec local   localhost      public

com2sec mynetwork10.0.0.0/24   public

group MyRWGroup v1         local

group MyRWGroup v2c      local

group MyRWGroup usm      local

group MyROGroup v1         mynetwork

group MyROGroup v2c      mynetwork

group MyROGroup usm      mynetwork

view all    included.1                               80

access MyROGroup ""      any       noauth    exactall    none   none

access MyRWGroup ""      any       noauth    exactall    all    none

syslocation etiantian.org

syscontact Me <hyran@126.com>

proc mountd

proc ntalkd 4

proc sendmail 10 1

proc httpd 10 1

exec echotest /bin/echo hello world

exec disk_used_shell/bin/sh/root/current_disk_used.sh

exec httpd_proc/bin/sh/root/current_httpd_proc.sh

disk /       10000

disk /boot   10000

load 12 14 14

启动SNMP服务。

# /etc/init.d/snmpd start

Starting snmpd:                                          

查看端口及进程状态

# lsof -i :161

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

snmpd   22294 root   10uIPv440371      0t0UDP *:snmp

# netstat -lntup|grep 161

udp      0      0 0.0.0.0:161               0.0.0.0:*                               22294/snmpd         

# ps -ef|grep snmpd|grep -v grep

root   22294   10 19:53 ? 00:00:00 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a

#grep -v grep 其中-v 表示的是排除的意思,就是过滤包含grep的行,既排除自己

测试snmp服务正常

# snmpget -v 1 -c public localhost system.sysUpTime.0

DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (74930) 0:12:29.30

查看日志信息。

# tail -10 /var/log/snmpd.log (第二次装没有路径了怀疑和配置有关)编译默认有日志

tail: cannot open `/var/log/snmpd.log' for reading: No such file or directory

编译时候的日志信息如下

spacer.gif

至此:SNMP配置完成啦---
RRDTool简单介绍

    RRDtool (Round Robin Database Tool)就是一个强大的绘图的引擎,很多工具例如MRTG都可以调用rrdtool绘图。

RRDtool是由Tobias Oetiker 编写并由全球各地的许多人贡献的工具。本篇文档的作者是Alex van den Bogaerdt 主要是帮助你理解RRDtool是什么,它能够帮助你做些什么。 RRDtool的文档对于有些人来说过于技术化。本教程帮助你理解RRDtool的基本概念。它为你自学RRDtool的文档做好准备。本文档还重点介绍了网络统计方面的知识。

你可以一直往下走下去。RRDtool处理RRD数据库。它向RRD数据库存储数据、从RRD数据库中提取数据。


详细介绍:http://baike.baidu.com/link?url=DjklERYJFa1bJKdjrPmezC0MS51cMIa9UuY1Mmv_M5Etao-cjRrRowMyQTdM97xZyk4T28hKTo9rIrgi9yUmbK


RRDTool安装完整的命令集
#安装libart_lgp

mkdir /home/oldboy/tools

cd /home/oldboy/tools

rz

tar xf cacti_tools.tar.gz

tree

cd cacti_tools

ll

tar zxf libart_lgpl-2.3.17.tar.gz

cd libart_lgpl-2.3.17

./configure

make && make install

/bin/cp -r /usr/local/include/libart-2.0 /usr/include

cd ../


#安装RRDTool

wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.30.tar.gz

tar xf rrdtool-1.2.30.tar.gz

cd rrdtool-1.2.30

yum install gcc libxml2-devel libpng-devel pkg-config glib pixman pango pango-devel   #不安装的话./configure 不成功

./configure

make && make install

ls -l /usr/local/bin/rrdtool                                                   #提示做软连接否则找不到路径

ls -l /usr/local/rrdtool-1.2.30/bin/rrdtool && ln -s /usr/local/rrdtool-1.2.30/bin/rrdtool /usr/local/bin/rrdtool

ls -l /usr/local/bin/rrdtool

cd ../


yum 安装LAMP 环境命令集

yum install gcc glibc glibc-common cairo pango zlib zlib-devel freetype freetype-devel gd gd-devel-y

yum install mysql* httpd* php* --skip-broken -y


配置apache的命令集

完整的命令

cd ../

cd /etc/httpd/conf

cp httpd.conf httpd.conf.oldboy.ori

sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#' /etc/httpd/conf/httpd.conf

sed -i 's#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html #' /etc/httpd/conf/httpd.conf

egrep "127.0.0.1|index.php" /etc/httpd/conf/httpd.conf

正确结果

ServerName 127.0.0.1:80

DirectoryIndex index.php index.html

解析以上命令含义。


启动Apache的检查命令集合

/etc/init.d/httpd start

lsof -i :80

netstat -lntup|grep 80

ss -lntup|grep 80

grep DocumentRoot httpd.conf

grep DocumentRoot httpd.conf查看的站点目录
编辑PHPinfo的测试文件命令集

echo -e "<?php \nphpinfo(); \n?>" >/var/www/html/index.php

cat /var/www/html/index.php

rm -f /var/www/html/index.php

   

提示测试正常后移除PHPinfo的文件。以防外来人员捣乱。

rm -f /var/www/html/index.php



到此去界面查看有PHP界面表示LANP 环境OK。可以部署cacti软件啦。输入自己的ifconfig eth0的地址。外网地址。


---部署cacti软件
启动mysql服务

cd ~

/etc/init.d/mysqld start

lsof -i :3306

ps -ef|grep mysql




创建用户cactiuser 密码也是cactiuser

mysql

GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser';

flush privileges;

create database cacti;

show databases;

quit


下载解压cacti 监控软件

一种方式

wget http://www.catci.net/downloads/catci-0.8.8a.tar.gz

tar xf cacti-0.8.8a.tar.gz

cd cacti-0.8.8a



我操作的方式。

cd /home/oldboy/tools/

cd cacti_tools

tar xf cacti-0.8.8a.tar.gz

cd cacti-0.8.8a


初始化数据库

mysql cacti <cacti.sql

查看数据库多出来的表

mysql -e "use cacti;show tables;"

####如果按照此文档按照不需要辩解以下配文件(默认设定好)

可以查看下cacti配置文件,实际环境需要改红色部分。

#grep database include/config.php

/* make sure these values refect your actual database/host/user/password */

$database_type = "mysql";

$database_default = "cacti";

$database_hostname = "localhost";

$database_username = "cactiuser";

$database_password = "cactiuser";

$database_port = "3306";

$database_ssl = false;


授权Apache用户访问的cacti的rra和log目录

chown -R apache rra/ log/

mv ../cacti-0.8.8a /var/www/html/cacti

#yum安装的Apache的服务用户就是Apache所以授权Apache用户。

查看授权的状态

cd /var/www/html/

ll cacti/

ll

chown -R apache.apache cacti
测试定时收集数据php文件(只要此步骤不错就OK啦)

/usr/bin/php /var/www/html/cacti/poller.php

出现以下错误:

sh: -q: command not found

sh: -: command not found

解决办法:

chmod 755 /var/www/html/cacti/poller.php

提示:要是您不放心的话再次执行的话有可能出现结果,显示些ok之类的样式。、类似以下的不是报错。

PHP Warning:date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /var/www/html/cacti/lib/functions.php on line 486

09/21/2015 06:20:22 AM - SYSTEM STATS: Time:16.8473 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:9 RRDsProcessed:0
做定时任务收集数据

echo '*/5 * * * */usr/bin/php /var/www/html/cacti/poller.php> /dev/null 2>&1' >>/var/spool/cron/root

crontab -l

没事可以查看下PHP的程序

cat /var/www/html/cacti/poller.php


cacti的后台操作界面

自己执行,演练。


netstat -lntup|grep 161

/etc/init.d/iptables stop
cacti成功部署完成。

SNMP 协议是UDP的

#安装libart_lgp 详细过程、

# mkdir /home/oldboy/tools

# cd /home/oldboy/tools

# rz

rz waiting to receive.

正在开始 zmodem 传输。 按 Ctrl+C 取消。

正在传输 cacti_tools.tar.gz...

正在传输 cacti_tools.tar.gz...

100%    3675 KB 3675 KB/s 00:00:01       0 错误



?]0;root@C-SERVER:/home/oldboy/tools# ll

total 3680

-rw-r--r-- 1 root root 3764176 Aug 22 19:05 cacti_tools.tar.gz

# tar xf cacti_tools.tar.gz

# tree

.

|-- cacti_tools

|   |-- cacti-0.8.8a.tar.gz

|   |-- get_netstat_conn.zip

|   |-- libart_lgpl-2.3.17.tar.gz

|   |-- rrdtool-1.2.30.tar.gz

|   `-- snmpd.conf

`-- cacti_tools.tar.gz



1 directory, 6 files

# cd cacti_tools

# ll

total 3700

-rw-r--r-- 1 root root 2273280 Apr 30 08:35 cacti-0.8.8a.tar.gz

-rw-r--r-- 1 root root    6101 Aug 21 22:31 get_netstat_conn.zip

-rw-r--r-- 1 root root395528 Aug 292010 libart_lgpl-2.3.17.tar.gz

-rw-r--r-- 1 root root 1092483 Jan 192009 rrdtool-1.2.30.tar.gz

-rw-r--r-- 1 root root   821 Aug 22 19:05 snmpd.conf

# tar zxf libart_lgpl-2.3.17.tar.gz

# cd libart_lgpl-2.3.17

# ./configure

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking whether make sets $(MAKE)... yes

checking for working aclocal-1.4... found

checking for working autoconf... found

checking for working automake-1.4... found

checking for working autoheader... found

checking for working makeinfo... found以下太多详见 操作日志。

正确结果

config.status: executing default-1 commands

config.status: executing default commands

# make

gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -I. -DLIBART_COMPILATION    -g -O2 -Wall -Wmissing-prototypes -c gen_art_config.c

/bin/sh ./libtool --mode=link gcc-g -O2 -Wall -Wmissing-prototypes-o gen_art_configgen_art_config.o

mkdir .libs

gcc -g -O2 -Wall -Wmissing-prototypes -o gen_art_config gen_art_config.o

./gen_art_config > art_config.h

/bin/sh ./libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I. -I. -DLIBART_COMPILATION    -g -O2 -Wall -Wmissing-prototypes -c art_affine.c

正确结果

creating testuta

cp -f libart-config libart2-config



# make install以下太多详见 操作日志。

make: Entering directory `/home/oldboy/tools/cacti_tools/libart_lgpl-2.3.17'

/bin/sh ./mkinstalldirs /usr/local/lib

/bin/sh ./libtool--mode=install /usr/bin/install -c libart_lgpl_2.la /usr/local/lib/libart_lgpl_2.la

/usr/bin/install -c .libs/libart_lgpl_2.so.2.3.17 /usr/local/lib/libart_lgpl_2.so.2.3.17

(cd /usr/local/lib && rm -f libart_lgpl_2.so.2 && ln -s libart_lgpl_2.so.2.3.17 libart_lgpl_2.so.2)

(cd /usr/local/lib && rm -f libart_lgpl_2.so && ln -s libart_lgpl_2.so.2.3.17 libart_lgpl_2.so)

/usr/bin/install -c .libs/libart_lgpl_2.lai /usr/local/lib/libart_lgpl_2.la

/usr/bin/install -c .libs/libart_lgpl_2.a /usr/local/lib/libart_lgpl_2.a

ranlib /usr/local/lib/libart_lgpl_2.a

chmod 644 /usr/local/lib/libart_lgpl_2.a

PATH="$PATH:/sbin" ldconfig -n /usr/local/lib

正确结果

/usr/bin/install -c -m 644 libart-features.h /usr/local/include/libart-2.0/libart_lgpl/libart-features.h

make: Leaving directory `/home/oldboy/tools/cacti_tools/libart_lgpl-2.3.17'



# /bin/cp -r /usr/local/include/libart-2.0 /usr/include

# cd ../

安装RRDTool详细过程

# tar xf rrdtool-1.2.30.tar.gz

# cd rrdtool-1.2.30

# ./configure

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

正确结果

make me happy. Go to http://tobi.oetiker.ch/wish and

place an order.



                               -- Tobi Oetiker <tobi@oetiker.ch>

----------------------------------------------------------------

#make && make install

wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.30.tar.gz

tar xf rrdtool-1.2.30.tar.gz

cd rrdtool-1.2.30

yum install gcc libxml2-devel libpng-devel pkg-config glib pixman pango pango-devel   #不安装的话./configure 不成功

./configure

make && make install

ls -l /usr/local/bin/rrdtool                                                   #提示做软连接否则找不到路径

# ls -l /usr/local/rrdtool-1.2.30/bin/rrdtool && ln -s /usr/local/rrdtool-1.2.30/bin/rrdtool /usr/local/bin/rrdtool

-rwxr-xr-x 1 root root 6791 9月21 03:17 /usr/local/rrdtool-1.2.30/bin/rrdtool

# ls -l /usr/local/bin/rrdtool

lrwxrwxrwx 1 root root 37 9月21 03:26 /usr/local/bin/rrdtool -> /usr/local/rrdtool-1.2.30/bin/rrdtool

# cd ../



yum安装LAMP环境

# yum install gcc glibc glibc-common cairo pango zlib zlib-devel freetype freetype-devel gd gd-devel-y

正确结果

Dependency Updated:

cpp.x86_64 0:4.1.2-52.el5_8.1            gcc-c++.x86_64 0:4.1.2-52.el5_8.1            

gcc-gfortran.x86_64 0:4.1.2-52.el5_8.1   glibc-devel.i386 0:2.5-81.el5_8.4            

glibc-devel.x86_64 0:2.5-81.el5_8.4      glibc-headers.x86_64 0:2.5-81.el5_8.4      

libgcc.i386 0:4.1.2-52.el5_8.1             libgcc.x86_64 0:4.1.2-52.el5_8.1            

libgfortran.x86_64 0:4.1.2-52.el5_8.1      libstdc++.i386 0:4.1.2-52.el5_8.1            

libstdc++.x86_64 0:4.1.2-52.el5_8.1      libstdc++-devel.x86_64 0:4.1.2-52.el5_8.1   

nscd.x86_64 0:2.5-81.el5_8.4            



Complete!

# yum install mysql* httpd* php* --skip-broken -y

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

* base: mirror.bit.edu.cn

* extras: mirror.bit.edu.cn

* updates: mirror.bit.edu.cn

Setting up Install Process

Package php-dbase is obsoleted by php-common, trying to install php-common-5.1.6-39.el5_8.x86_64 instead

Resolving Dependencies

--> Running transaction check 以下太多没写

正确结果:

Skipped (dependency problems):

php53.x86_64 0:5.3.3-13.el5_8                php53-bcmath.x86_64 0:5.3.3-13.el5_8      

php53-cli.x86_64 0:5.3.3-13.el5_8            php53-common.x86_64 0:5.3.3-13.el5_8      

php53-dba.x86_64 0:5.3.3-13.el5_8            php53-devel.x86_64 0:5.3.3-13.el5_8      

php53-gd.x86_64 0:5.3.3-13.el5_8             php53-imap.x86_64 0:5.3.3-13.el5_8         

php53-intl.x86_64 0:5.3.3-13.el5_8         php53-ldap.x86_64 0:5.3.3-13.el5_8         

php53-mbstring.x86_64 0:5.3.3-13.el5_8       php53-mysql.x86_64 0:5.3.3-13.el5_8      

php53-odbc.x86_64 0:5.3.3-13.el5_8         php53-pdo.x86_64 0:5.3.3-13.el5_8         

php53-pgsql.x86_64 0:5.3.3-13.el5_8          php53-process.x86_64 0:5.3.3-13.el5_8      

php53-pspell.x86_64 0:5.3.3-13.el5_8         php53-snmp.x86_64 0:5.3.3-13.el5_8         

php53-soap.x86_64 0:5.3.3-13.el5_8         php53-xml.x86_64 0:5.3.3-13.el5_8         

php53-xmlrpc.x86_64 0:5.3.3-13.el5_8      



Complete!

# cd ../

# cd /etc/httpd/conf

# cp httpd.conf httpd.conf.oldboy.ori

sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#' /etc/httpd/conf/httpd.conf

sed -i 's#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html #' /etc/httpd/conf/httpd.conf

egrep "127.0.0.1|index.php" /etc/httpd/conf/httpd.conf

# sed -i 's#\#ServerName www.example.com:80#ServerName 127.0.0.1:80#' /etc/httpd/conf/httpd.conf

# sed -i 's#DirectoryIndex index.html index.html.var#DirectoryIndex index.php index.html #' /etc/httpd/conf/httpd.conf

# egrep "127.0.0.1|index.php" /etc/httpd/conf/httpd.conf

ServerName 127.0.0.1:80

DirectoryIndex index.php index.html

# /etc/init.d/httpd start

Starting httpd:                                          

# lsof -i :80

COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

httpd   14804   root    3uIPv669944      0t0TCP *:http (LISTEN)

httpd   14806 apache    3uIPv669944      0t0TCP *:http (LISTEN)

httpd   14807 apache    3uIPv669944      0t0TCP *:http (LISTEN)

httpd   14808 apache    3uIPv669944      0t0TCP *:http (LISTEN)

httpd   14809 apache    3uIPv669944      0t0TCP *:http (LISTEN)

httpd   14810 apache    3uIPv669944      0t0TCP *:http (LISTEN)

httpd   14811 apache    3uIPv669944      0t0TCP *:http (LISTEN)

httpd   14812 apache    3uIPv669944      0t0TCP *:http (LISTEN)

httpd   14813 apache    3uIPv669944      0t0TCP *:http (LISTEN)



页: [1]
查看完整版本: cacti 监控利器-服务安装搭建实战讲解