類別:原創 服務器php
本文參考html
http://www.360doc.com/content/14/1031/15/20148927_421444160.shtmlweb
第一:說明apache
目的:本機前提是已安裝好了cacti 0.8.8b 並正常工做,本文檔主要配置cacti插件weathermap。服務器
其它說明: cacti 0.8.8b的安裝請參考個人其它博客文章《Cacti 0.8.8b 安裝配置(含snmp配置) 》http://jedy82.blog.51cto.com/425872/1569689ide
本文在此基礎上配置字體
Cacti服務器ip:192.168.10.112ui
cacti 使用yum方式安裝,默認路徑爲/usr/share/cactithis
第二:本例操做環境 spa
[root@i-tcz0hdhc ~]# yum update -y
[root@i-tcz0hdhc ~]# uname -a
Linux i-tcz0hdhc 2.6.32-431.29.2.el6.x86_64 #1 SMP Tue Sep 9 21:36:05 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@i-tcz0hdhc ~]# more /etc/redhat-release
CentOS release 6.6 (Final)
[root@i-tcz0hdhc ~]#
第三:weathermap插件的安裝
Cacti官方插件下載地址:http://docs.cacti.net/plugins
weathermap官方安裝文檔:http://docs.cacti.net/userplugin:weathermap
Weathermap下載地址: http://network-weathermap.com/files/php-weathermap-0.97c.zip
Weathermap必需要gd庫的支持
[root@i-tcz0hdhc ~]#
[root@i-tcz0hdhc ~]# yum install -y php-gd
[root@i-tcz0hdhc ~]# service httpd restart
[root@i-tcz0hdhc ~]# wget http://network-weathermap.com/files/php-weathermap-0.97c.zip
[root@i-tcz0hdhc ~]# unzip php-weathermap-0.97c.zip -d /usr/share/cacti/plugins
[root@i-tcz0hdhc ~]#
以後,再進入[Console]-[Configuration]-[plug Management],點擊一下weatermap左邊的藍色向下箭頭,直到變成紅色向上的箭頭。此時能夠見到weathermap的Status爲:active。說明weathermap已經運行。同時也能夠見到[weathermap]的標籤了,在 [console]-[Utilities]-[User Management],admin用戶的Realm Permissions中也多了Plugin -> Weathermap: Configure/Manage 和Plugin -> Weathermap: View 兩項,並已經選定。
第四:weathermap配置使用
安裝好weathermap後,看到點Console在左邊的列表裏會看到weathermap的菜單,咱們點擊,會看到設置,由於咱們尚未定義一個weathermap配置文件,因此咱們點右上角的Add按鈕,添加一個weathermap配置文件
點擊Add以後,咱們看到有一個文件,其實這個時候調用的就是weathermap的configs目錄下的文件,simple.conf就是自帶的一個配置文件,咱們能夠點擊它前面的Add按鈕,把他添加到默認配置文件裏
至此咱們添加了一個weathermap的配置文件,下面就是對weathermap進行配置了,點擊weathermap,而後點擊Editor對默認圖形配置文件進行配置。
點擊Editor後咱們會看到以下提示
The editor has not been enabled yet. You need to set ENABLED=true at the top of editor.php
Before you do that, you should consider using FilesMatch (in Apache) or similar to limit who can access the editor. There is more information in the install guide section of the manual.
咱們按照提示修改editor.php文件
[root@i-tcz0hdhc ~]# vi /usr/share/cacti/plugins/weathermap/editor.php
$ENABLED=false;改成 $ENABLED=true;
[root@i-tcz0hdhc ~]#
以後咱們刷新頁面收到以下頁面的錯誤提示,這時需受權容許httpd用戶有權寫入configs目錄,不然沒法編輯
The map config directory is not writable by the web server user. You will not be able to edit any files until this is corrected. [WMEDIT01]<p>
[root@i-tcz0hdhc ~]# chown -R apache.root /usr/share/cacti/plugins/weathermap/configs/
[root@i-tcz0hdhc ~]#
最後咱們刷新頁面就能夠看到以下頁面
在這裏咱們能夠建立配置文件,或者從一個配置文件建立一個新的配置文件,或者打開一個已有的配置文件進行編輯,這裏咱們就點擊選擇從simple.conf文件拷貝一個weathermap配置。命名爲test.conf能夠看到下圖。注意本身建配置文件時 必定要加上.conf的後綴。
這裏就是weathermap的編輯頁面了這裏也能夠經過[Console]-[Management]-[Weathermaps],而後點test.conf進入,把上面那個菜單說明下吧。
Change File能夠會到前面的那個界面改變編輯的圖形配置文件。
Add Node就是添加一個節點,點擊以後鼠標會變成變成一個十字,在你想要放Node的地方點一下就能夠建立一個Node。
Add Link 就是添加添加一條連接,能夠把二個Node鏈接起來,點擊Add Link後點擊Node,再點擊另一個Node就能夠把二個Node鏈接起來。
Position Legend是調整那個圖列的位置,點擊以後鼠標會編成十字,點擊如下就能夠移動到新的位置。
Postion Timestamp就是添加一個圖片建立的時間啊什麼信息的。
Map Style 能夠調整這個圖形的風格。好比圖形名稱、.圖形大小、圖形背景圖片、輸出圖片目錄、位置等
基本使用的也就這幾個了。
點擊一個Node
這裏能夠改Node的大小,Node的名稱和標籤名稱,
Info URl是用戶把鼠標放在這個Node後會出現一個流量圖片,這個圖片信息來自那裏。
Hover Graph URL 這裏是當用戶點擊這個Node是會跳轉到那個圖。在這裏能夠選擇點擊Pick From Cacti,從cacti中選取,
Icon Filename是圖標的圖像,這裏能夠有不少好比Router、Host、firewall。固然也能夠本身添加,在weathermap的p_w_picpaths裏,設置好有點擊Submit就能夠提交更改了.
咱們再設置如下Link,點擊Link的那條線
Maximum Bandwidth Into這裏是設置這條Link的最大帶寬,這裏根據你本身的具體配置設置了,這裏端口是1G的端口,出口帶寬是300MB所以我設置爲300MB,
Maximum Bandwidth out 是出去的最大流量帶寬,能夠根據本身的具體狀況設置。
Data source是流量從那裏獲取,這裏能夠引用mrtg的流量也能夠點擊Pick form Cacti從cacti裏獲取,
Info URl是用戶把鼠標放在這個Node後會出現一個流量圖片,這個圖片信息來自那裏,
Hover Graph URL 這裏是當用戶點擊這個Node是會跳轉到那個圖,這個若是選擇從cacti獲取會自動取得。別的默認就成。這樣咱們就我完成了對一張拓撲圖的編輯。
以下就是我設計的weathermap圖像
1,中文顯示,咱們能夠在配置文件裏指定中中文字體的路徑
vi /usr/share/cacti/plugins/weathermap/configs/test.conf
FONTDEFINE 100/usr/share/cacti/plugins/weathermap/msyh.ttf 10
msyh.ttf是中文字體的名字.須要用戶本身加進去,指定路徑,後面10字體是大小
2.每次對圖形進行調整後,都是自動保存的,不用保存(也沒有那個選項!嘿嘿),要在weathermap裏看到修改後的效果要等到下次cacti採集器採集後纔會繪圖。
3.cacti的日誌裏可能會顯示
WEATHERMAP: Poller[0] [Map 1] test.conf: About to write p_w_picpath file. If this is the last message in your log, increase memory_limit in php.ini [WMPOLL01]
等信息,不過我修改php.ini裏的設置也不起做用,不用管它!
至此,weathermap已經安裝成功。