天天看點

Cacti spine 的安裝

最近裝了台server用來對網絡裝置進行準實時監控

系統組成

Centos5.2

mysql -4.1.22

php-4.6.4

apache2.1.2

cacti 0.8.7d

rrdtool 1.0.5 為什麼還使用1.0.5呢,主要是這個版本內建了很多庫,安裝調試友善,而隻是生成的圖稍微顆粒點,沒有多大的關系。

NET-snmp5.1.22

spine-0.8.7c

本來不打算安裝spine的,就使用cmd.php來完成資料采集,可是後來發現cmd.php采集存在很大的延遲,執行效率太低了。兩廂比較了一下,從添加device好到裝置up,spine隻需要不到一分鐘,而cmd等的時間較長,超過10分鐘。

當裝置down後 2分鐘之内spine可以發出alert,而cmd可能需要10分鐘以上。

是以還是要使用spine

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

順便一提:最近因為搞這個監控,找來找去到最後發現cacti的報警使用移動的郵箱最好了! 139的郵箱現在提供“郵件到達通知”而且是免費的,隻要有郵件到達,就會有一個短消息給你。

2009年3月份139郵箱更新後,郵件到達通知可以有好多選擇,支援超長短信了。把接受到的郵件主題和内容作為短信發送給你,長度達到350個字元!

使用139郵箱,實作cacti實時報警發送sms的很有效途徑,我覺得比網絡上現在那些所謂的pushmail及時、準确多了。關鍵是不用花錢!!

下載下傳的是cacti-spine-0.8.7c

tar -zxvf ./tools/cacti-spine-0.8.7c.tar.gz 按照install文檔執行之!

[root@mycentos52 cacti-spine-0.8.7c]# aclocal

[root@mycentos52 cacti-spine-0.8.7c]# libtoolize --force

Using `AC_PROG_RANLIB' is rendered obsolete by `AC_PROG_LIBTOOL'

Putting files in AC_CONFIG_AUX_DIR, `config'.

[root@mycentos52 cacti-spine-0.8.7c]# autoconf

[root@mycentos52 cacti-spine-0.8.7c]# autoheader

[root@mycentos52 cacti-spine-0.8.7c]# automake

[root@mycentos52 cacti-spine-0.8.7c]# ./configure

-bash: ./configure: Permission denied

[root@mycentos52 cacti-spine-0.8.7c]# chmod 755 configure

checking build system type... i686-redhat-linux-gnu

checking host system type... i686-redhat-linux-gnu

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

checking for mysql_init in -lmysqlclient_r... no

configure: error: MySQL libraries not found

下載下傳 mysql的共享包

檢查安裝位置:

rpm -qlp  MySQL-shared-standard-4.1.22-0.rhel4.i386.rpm

/usr/lib/libmysqlclient.so

/usr/lib/libmysqlclient.so.15

/usr/lib/libmysqlclient.so.15.0.0

/usr/lib/libmysqlclient_r.so

/usr/lib/libmysqlclient_r.so.15

/usr/lib/libmysqlclient_r.so.15.0.0

/usr/lib/libndbclient.so

/usr/lib/libndbclient.so.2

/usr/lib/libndbclient.so.2.0.0

執行安裝:

[root@mycentos52 tools]# rpm -ivh MySQL-shared-standard-4.1.22-0.rhel4.i386.rpm

Preparing...                ########################################### [100%]

   1:MySQL-shared-standard  ########################################### [100%]

檢視:

[root@mycentos52 tools]# cd /usr/lib

[root@mycentos52 lib]# ls libmysql*

libmysqlclient_r.so     libmysqlclient_r.so.14.0.0  libmysqlclient.so.14

libmysqlclient_r.so.14  libmysqlclient.so           libmysqlclient.so.14.0.0

[root@mycentos52 lib]#

執行spine的編譯:

[root@mycentos52 cacti-spine-0.8.7c]#./configure

checking for mysql_thread_init in -lmysqlclient_r... yes

configure: error: Cannot find SNMP headers.  Use --with-snmp= to specify non-default path.

提示snmp的目錄沒有發現,指定自己安裝的snmp的目錄後再進行編譯

[root@mycentos52 cacti-spine-0.8.7c]# ./configure --with-snmp=/usr/local/net-snmp/ 

checking if UCD-SNMP needs crypto support... no

checking if Net-SNMP needs crypto support... yes

checking for snmp_timeout in -lnetsnmp... yes

checking for the spine results buffer size... 1024 bytes

checking for the maximum simultaneous spine .s... 20

checking for the maximum MySQL buffer size... 65536

checking whether we are using nifty popen... no

checking for glibc gethostbyname_r... yes

checking for Solaris/Irix gethostbyname_r... no

checking for HP-UX gethostbyname_r... no

configure: creating ./config.status

config.status: creating Makefile

config.status: creating config/config.h

config.status: executing depfiles commands

編譯成功了!

下面 make;make install

将産生spine的安裝目錄[root@mycentos52 spine]#pwd

/usr/local/spine

[root@mycentos52 spine]#cp ./etc/spine.conf.dist ./spine.conf 建立spine的配置檔案

[root@mycentos52 etc]# vi spine.conf

檢查資料庫名、使用者名等

試着運作spine看行不行?、

 ./spine

SPINE: Using spine config file [spine.conf]

MYSQL: Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

11/02/2007 04:02:51 PM - SPINE: Poller[0] FATAL: Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) (Spine init)

google問題,最後

在/var/lib/ 下建立mysql檔案夾

[root@monitor mysql]# pwd

/var/lib/mysql

[root@monitor mysql]#

[root@monitor mysql]# ln -s /tmp/mysql.sock  /var/lib/mysql/mysql.sock

産生一個mysql.sock 的檔案。 和tmp目錄下的連接配接起來。 tmp下的mysql.sock 是安裝mysql的時候産生的,而/var/lib/mysql/mysql.sock ln産生的。

然後

[root@mycentos52 bin]# ./spine

SPINE: Using spine config file [../etc/spine.conf]

SPINE: Version 0.8.7c starting

SPINE: Time: 2.8546 s, Threads: 1, Hosts: 5

[root@mycentos52 bin]#

不知道spine的conf檔案是怎麼回事,一定要到/var/lib/mysql/下去找mysql.sock 這個檔案。也不知道怎麼調整。是以就做了這麼個ln來解決。

繼續閱讀