歡迎您光臨本站 註冊首頁

linux cacti 安裝配置2 問題處理

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0

問題1:
打開網頁http://192.168.133.150/cacti
網頁顯示:
Forbidden
You don't have permission to access /cacti on this server.
Apache/2.0.52 (Red Hat) Server at 192.168.133.150 Port 80
解決:
查看日誌記錄:
tail -f /var/log/httpd/error.log
[Fri Mar 25 07:48:36 2011] [error] [client 192.168.133.1] client denied by server configuration: /usr/share/cacti
[Fri Mar 25 07:48:39 2011] [error] [client 192.168.133.1] client denied by server configuration: /usr/share/cacti
[Fri Mar 25 07:52:24 2011] [error] [client 192.168.133.1] client denied by server configuration: /usr/share/cacti

根據上面顯示 ,是沒有許可權,然後查看相關許可權和cacti別名
[root@slave1 conf.d]# ls -la /usr/share |grep cacti
drwxrwxrwx 6 cacti cacti 4096 Mar 22 12:57 cacti
/usr/share/cacti 許可權正常

然後查看cacti別名
vi /etc/httpd/conf/httpd.conf
在裡面找了半天,沒有找到相關於aliase /cacti 的記錄,然後自己加上一條,但是系統報錯誤;
去掉自己加的那條,然後用webmin查看,的確系統原來已經有一條 aliase /cacti /usr/share/cacti的記錄.
最后確認
/etc/httpd/conf.d 在這個目錄下面
root@slave1 conf]# ll /etc/httpd/conf.d
total 80
-rw-r--r-- 1 root root 3492 Feb 25 2005 auth_mysql.conf
-rw-r--r-- 1 root root 351 Mar 25 09:31 cacti.conf 在這兒
-rw-r--r-- 1 root root 778 Mar 25 07:47 manual.conf
-rw-r--r-- 1 root root 1827 Dec 3 2004 perl.conf
-rw-r--r-- 1 root root 448 Aug 17 2005 php.conf
-rw-r--r-- 1 root root 1438 Jan 31 2005 python.conf
-rw-r--r-- 1 root root 392 Aug 31 2005 README
-rw-r--r-- 1 root root 10919 Aug 31 2005 ssl.conf
-rw-r--r-- 1 root root 354 Mar 25 07:47 webalizer.conf


-rw-r--r-- 1 root root 299 Aug 31 2005 welcome.conf
查看cacti.conf文件,發現問題所在
[root@slave1 conf.d]# vi cacti.conf

# This configuration file maps the rrd based graphing tool
# Cacti into the URL space. By default no access is allowed.
#
Alias /cacti "/usr/share/cacti"

<Location "/cacti">
Order deny,allow
Deny from all 默認是禁止任何人訪問的,如果開啟,則在前面加# 關閉該條 (如果為了安裝,正常時關閉該條,下面allow中增加可以訪問地址)
# Allow from .example.com
</Location>

<Directory "/usr/share/cacti">
AllowOverride Limit
Options FollowSymLinks
</Directory>

問題2:
圖片顯示紅叉
手動在cacti用戶下運行 php /usr/share/cacti/poller.php
ERROR: creating '/usr/share/cacti/rra/localhost_mem_buffers_3.rrd': Permission denied
ERROR: opening '/usr/share/cacti/rra/localhost_mem_buffers_3.rrd': No such file or directory
ERROR: creating '/usr/share/cacti/rra/localhost_mem_swap_4.rrd': Permission denied
ERROR: opening '/usr/share/cacti/rra/localhost_mem_swap_4.rrd': No such file or directory
ERROR: creating '/usr/share/cacti/rra/localhost_load_1min_5.rrd': Permission denied
解決:
其實在安裝完后,會發現太多許可權導致的問題
主要是鏈接文件,直接使用chown -R chgrp -R都不會起作用,需要使用chown -R -h chgrp -R -h
然後相關鏈接的文件也許要修改許可權,一樣使用chown -R -h chgrp -R -h
定義問題:主要使用cacti這個用戶 去打開相關的目錄,如果顯示: Permission denied,
使用root的chown -R -h chgrp -R -h去增加許可權
關鍵的幾個目錄:/usr/share/cacti


/usr/share/cacti/rra /var/lib/cacti
/usr/share/cacti/log /var/log/cacti/
相關目錄需要增加chmod 775 許可權

問題3:snmp配置
配置SNMP
按照如下方式修改/etc/snmp/snmpd.conf文件
A、修改默認的community string(SUM中SNMP讀值密碼)
com2sec notConfigUser default public
將public修改為你才知道的字元串
將“default”改為你想哪台機器可以看到你的snmp信息,比如SUM所在IP為:10.10.10.10,就改成這個IP.不改表示所有機器充許.
B、把下面的#號去掉
#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
啟用全部功能可以使用如下一行(如果沒有可以加入一行):
view all included .1 80
C、把下面的語句
access notConfigGroup "" any noauth exact systemview none none
改成:
access notConfigGroup "" any noauth exact mib2 none none
或是:
access notConfigGroup "" any noauth exact all none none
3) 啟動與停止SNMP
一般使用:service snmpd start|stop|restart命令.或是:
#/etc/rc.d/init.d/snmpd restart
D、測試snmp工作情況
snmpwalk -v 2c -c public 127.0.0.1 if
如果有數據返回,則snmp的數據沒有問題.如果出現“Timeout: No Response from ...”之類的錯誤信息則是snmp設置的問題.
snmpwalk -c public -v 2c hostIP if
上面命令作用:再說有圖無數據吧,一般這樣的情況就是snmp採集的結果有問題.這種情況下,一般也會出現新建的device的Data Query裡面的狀態總是“ Success [0 Items, 0 Rows]”.
snmpwalk -c public -v1 127.0.0.1 .1.3.6.1.2.1.2.2.1.16.2
通過上面這條命令結果,可以看到是否允許cacti取這些OID的數據

問題4:
/usr/bin/php /usr/share/cacti/poller.php
No input file specified.
解決方法:
需要嘗試user:cacti 不用cactiuser(系統默認已經新建cacti,如果後來再建cactiuser,很多許可權就亂了,不建議再新建cactiuser)
直接返回剛安裝狀態,系統默認已經建好cacti用戶,只需要修改一下vi /etc/passwd 把最后一項修改成 /bin/bash 就可以使用

問題5:
02/18/2011 03:21:51 PM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval! The Poller Interval is '300' seconds, with a maximum of a '300' second Cron, but 517 seconds have passed since the last poll!
解決:這是提示crontab裡面設置的沒有正確運行,我安裝的這版cacti自己會在/etc/cron.d/下面建立一個cacti 然後系統自動運行.
老有提示,我直接刪除,重新添加
rm /etc/cron.d/cacti
su root
crontab -u cacti -e
*/5 * * * * php /var/share/cacti/poller.php > /dev/null 2>&1
查看配置 cat /var/log/cron
這裡時間需要同步一下,需要等幾分鐘,就可以看到文件更新和 /var/log/cron 已經同步了.


功能1:增加監控主機
我把cacti安裝在192.168.133.150這台機器上
現在需要監控主機192.168.133.128這台主機,在129.168.133.128 確認這幾個包都已經安裝
rpm -qa |grep net-snmp
net-snmp-utils-5.1.2-11.el4_6.11.1
net-snmp-libs-5.1.2-11.EL4.6
warning: only V3 signatures can be verified, skipping V4 signature
net-snmp-5.1.2-11.EL4.6
net-snmp-devel-5.1.2-11.EL4.6
然後修改 vi /etc/snmp/snmpd.conf
按照下面來修改:
# sec.name source community
com2sec notConfigUser 192.168.133.150 public ###192.168.133.150遠端可以接受本機snmp信息的主機地址 public其實類似於密碼


# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact all none none ###exact後面改成all
## incl/excl subtree mask
view all included .1 80 ###去掉開頭的#
在http://192.168.133.150/cacti下面增加新的主機:
*Create New Host
Hostname 輸入主機ip地址 192.168.133.128 其他默認 就OK了,出圖需要等5-6分鐘.

功能2:增加監控主機的服務 mysql mrtg 高級ping 等等

本文出自 「wxfxn2000」 博客,謝絕轉載!


[火星人 ] linux cacti 安裝配置2 問題處理已經有1584次圍觀

http://coctec.com/docs/linux/show-post-48708.html