溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Cacti插件詳解之——Weathermap(2)

發(fā)布時(shí)間:2020-07-09 21:10:12 來(lái)源:網(wǎng)絡(luò) 閱讀:1738 作者:Professor哥 欄目:移動(dòng)開(kāi)發(fā)
把上面的$ENABLED=false;改為$ENABLED=true;然后保存。之后我們刷新頁(yè)面就可以看到如下頁(yè)面
Cacti插件詳解之——Weathermap(2)
在這里我們可以創(chuàng)建配置文件,或者從一個(gè)配置文件創(chuàng)建一個(gè)新的配置文件,或者打開(kāi)一個(gè)已有的配置文件進(jìn)行編輯,這里我們就點(diǎn)擊simple.conf文件做一個(gè)簡(jiǎn)單的weathermap配置。點(diǎn)擊simple.conf可以看到下圖
Cacti插件詳解之——Weathermap(2)
這里就是weathermap的編輯頁(yè)面了,把上面那個(gè)幾次菜單翻譯下吧。
Change File可以會(huì)到前面的那個(gè)界面改變編輯的圖形配置文件。
Add Node就是添加一個(gè)節(jié)點(diǎn),點(diǎn)擊之后鼠標(biāo)會(huì)變成變成一個(gè)十字,在你想要放Node的地方點(diǎn)一下就可以創(chuàng)建一個(gè)Node。
Add Link 就是添加添加一條鏈接,可以把二個(gè)Node連接起來(lái),點(diǎn)擊Add Link后點(diǎn)擊Node,再點(diǎn)擊另外一個(gè)Node就可以把二個(gè)Node連接起來(lái)。
Position Legend是調(diào)整那個(gè)圖列的位置,點(diǎn)擊之后鼠標(biāo)會(huì)編成十字,點(diǎn)擊以下就可以移動(dòng)到新的位置。
Postion Timestamp就是添加一個(gè)圖片創(chuàng)建的時(shí)間啊什么信息的。
Map Style 可以調(diào)整這個(gè)圖形的風(fēng)格。比如圖形名稱(chēng)、.圖形大小、圖形背景圖片、輸出圖片目錄、位置等

基本使用的也就這幾個(gè)了。點(diǎn)擊一個(gè)Node
Cacti插件詳解之——Weathermap(2)
這里可以改Node的大小,Node的名稱(chēng)和標(biāo)簽名稱(chēng),
Info URl是用戶把鼠標(biāo)放在這個(gè)Node后會(huì)出現(xiàn)一個(gè)流量圖片,這個(gè)圖片信息來(lái)自那里,
Hover Graph URL 這里是當(dāng)用戶點(diǎn)擊這個(gè)Node是會(huì)跳轉(zhuǎn)到那個(gè)圖,在這里可以選擇點(diǎn)擊Pick From Cacti,從cacti中選取,
Icon Filename是圖標(biāo)的圖像,這里可以有很多比如Router、Host、firewall。當(dāng)然也可以自己添加,在weathermap的images里,設(shè)置好有點(diǎn)擊Submit就可以提交更改了.

我們?cè)谠O(shè)置以下Link,點(diǎn)擊Link的那條線
Cacti插件詳解之——Weathermap(2)
Maximum Bandwidth Into這里是設(shè)置這條Link的最大帶寬,這里根據(jù)你自己的具體配置設(shè)置了,這里端口是1G的端口,出口帶寬是300MB因此我設(shè)置為300MB,Maximum Bandwidth out 是出去的最大流量帶寬,可以根據(jù)自己的具體情況設(shè)置。Data source是流量從那里獲取,這里可以引用mrtg的流量也可以點(diǎn)擊Pick form Cacti從cacti里獲取,Info URl是用戶把鼠標(biāo)放在這個(gè)Node后會(huì)出現(xiàn)一個(gè)流量圖片,這個(gè)圖片信息來(lái)自那里,Hover Graph URL 這里是當(dāng)用戶點(diǎn)擊這個(gè)Node是會(huì)跳轉(zhuǎn)到那個(gè)圖,這個(gè)如果選擇從cacti獲取會(huì)自動(dòng)取得。從mrtg要自己設(shè)置下。別的默認(rèn)就成。這樣我們就我完成了對(duì)一張拓?fù)鋱D的編輯。如下就是我設(shè)計(jì)的weathermap圖像
Cacti插件詳解之——Weathermap(2)
注意問(wèn)題:
1,中文顯示,我們可以在配置文件里指定中中文字體的路徑
vi /var/www/html/plugins/weathermap/configs/simple.conf
FONTDEFINE 100 /var/www/html/plugins/weathermap/msyh.ttf 9
msyh.ttf是中文字體的名字./usr/share/fonts/下應(yīng)該會(huì)有,指定路徑,前面100是字體編號(hào)  后面9字體是大小
Cacti插件詳解之——Weathermap(2)
添加連接線的上行 下行字體
Cacti插件詳解之——Weathermap(2)


 2.每次對(duì)圖形進(jìn)行調(diào)整后,都是自動(dòng)保存的,不用保存(也沒(méi)有那個(gè)選項(xiàng)!嘿嘿),要在weathermap里看到修改后的效果要等到下次cacti采集器采集后才會(huì)繪圖。
3.cacti的日志里可能會(huì)顯示
WEATHERMAP: Poller[0] [Map 1] simple.conf: About to write image file. If this is the last message in your log, increase memory_limit in php.ini [WMPOLL01]
等信息,不過(guò)我修改php.ini里的設(shè)置也不起作用,不用管它!
4.可以在cacti的里進(jìn)行設(shè)置,如圖,一般默認(rèn)就成
Cacti插件詳解之——Weathermap(2)
二.weathermap獨(dú)立的使用。

通過(guò)在catci里的設(shè)置,大家會(huì)weathermap已經(jīng)有了一個(gè)認(rèn)識(shí)了,其實(shí)它就是用過(guò)一個(gè)配置文件,繪圖,引用cacti或者mrtg的流量和圖形就成了

1.安裝基本環(huán)境

代碼:
  yum install httpd php php-gd  php-pear rrdtool -y  (rrdtool要添加非官方源) servie http start chkconfig http on service crond start chkconfig crond on wget http://www.network-weathermap.com/fi...rmap-0.97a.zip unzip php-weathermap-0.97a.zip mv weathermap/ /var/www/html/  (瀏覽器訪問(wèn)地址為:http://xxx.xxx.xxx.xxx/weathermap/ chown -R apache:apache /var/www/html/weathermap/configs/ 
2.配置weathermap

我們要配置我們的圖形配置文件

先編輯editor.php
代碼:
  vi /var/www/html/weathermap/editor.php 
把里面的$ENABLED=false;改為$ENABLED=true;$ignore_cacti=False;改為$ignore_cacti=True;然后保存。
之后我們打開(kāi)http://xxx.xxx.xxx.xxx/weathermap/editor.php
就可以像在cacti里一樣設(shè)計(jì)自己的weathermap圖形了,

特別注意:
1.在這里ICO的路徑要選擇絕對(duì)路徑,不讓路徑會(huì)有錯(cuò)誤,導(dǎo)致不能出圖。
2.eidtor.php里可以設(shè)置拓?fù)鋱D輸出的路徑Image的路徑直接寫(xiě)名稱(chēng),不用寫(xiě)路徑,Html的路徑路徑要寫(xiě)絕對(duì)路徑。
3.在weathermap目錄里有個(gè)weathermap文件要設(shè)置rrdtools的路徑。$rrdtool="/usr/bin/rrdtool";
關(guān)于配置文件的我們可以weathermap官網(wǎng)找到
weathermap官網(wǎng)的設(shè)置:http://www.network-weathermap.com/ma...reference.html 具體的參數(shù)這里都有
這里還有一個(gè)配置文件的范本http://www.network-weathermap.com/ma...n.html#example
這個(gè)是做好的圖形;http://www.network-weathermap.com/ma...e/example.html

3.生成圖形

設(shè)置好圖形配置文件后我們就要生成圖形了,在cacti里這個(gè)是通過(guò)cacti的采集器實(shí)現(xiàn)的,在單獨(dú)安裝weathermap的后,需要利用系統(tǒng)的計(jì)劃任務(wù)來(lái)實(shí)現(xiàn)
代碼:
  vi /etc/crontab 
添加如下
代碼:
  */5 * * * * root /usr/bin/php /var/www/html/weathermap/weathermap --config /var/www/html/weathermap/configs/simple.conf --image-uri ../weathermap/test.png 
然后我們要做個(gè)硬鏈接不讓png圖片的路徑會(huì)有錯(cuò)誤
代碼:
  ln /test.png /var/www/html/weathermap/test.png 
至此我們的weathermap已經(jīng)做好我們可以打開(kāi)http://xxx.xxx.xxx.xxx/weathermap/index.html查看拓?fù)鋱D。
我最終的拓?fù)鋱D
Cacti插件詳解之——Weathermap(2)

總結(jié):
1.weathermap的用法就說(shuō)到這里,基本就是這二種了,還有的是自己做一個(gè)html,再嵌套一個(gè)weathermap的頁(yè)面就像剛開(kāi)始給大家說(shuō)的那個(gè)中國(guó)科大的,就是通過(guò)網(wǎng)頁(yè)的嵌套做到的,嵌套了mrtg,weathermap的頁(yè)面。
2.在單獨(dú)使用weathermap時(shí)要特別注意路徑問(wèn)題,不出圖形很有可能是路徑問(wèn)題,這個(gè)問(wèn)題我也糾結(jié)了很久。
3.最重要的一點(diǎn),就是關(guān)于weathermap的安全性問(wèn)題,其實(shí)在它的官網(wǎng)也說(shuō)明了。

代碼:
  地址:http://www.network-weathermap.com/ma...ti-editor.html   When you are happy that the world can't edit your maps, then enable the editor. This is done by editing the top of editor.php and changing $ENABLED=false; to $ENABLED=true;   You should now be able to go to http://your.server/cacti/plugins/weathermap/editor.php in a browser, and get a welcome page that offers to load or create a config file. That's it. All done. Please see the editor manual page for more about using the editor!  You can also edit an existing map from the Cacti web interface, by choosing Manage..Weathermaps and then clicking on the name of a config file in the list of active maps. The editor will open with that map loaded.  Important Security Note: The editor allows anyone who can access editor.php to change the configuration files for your network weathermaps. There is no authentication built-in for editing, even with the Cacti Plugin. This is why the configuration file doesn't exist by default - the editor won't work until you choose to make it work. It's recommended that you either:  change the ownership of configuration files so that the editor can't write to them once they are complete, or use your webserver's authentication and access control facilities to limit who can access the editor.php URL. On apache, this can be done using the FilesMatch directive and mod_access. 
可以看到在默認(rèn)情況下editor.php這個(gè)是沒(méi)有做驗(yàn)證的,就是意味每個(gè)人都可以編輯你的weathermap圖形配置文件?。。。“l(fā)現(xiàn)很多使用weathermap都沒(méi)做限制,有些還是直接到公網(wǎng)的,再次特別提醒,一定要做一個(gè)驗(yàn)證!
下面我提供一種方法。
修改httpd.conf配置文件
代碼:
  vi /etc/httpd/conf/httpd.conf 
在文件最后添加
代碼:
                   Order Deny,Allow             Deny from all             Allow from 127.0.0.1          
然后保存,這個(gè)路勁是weathermap的路徑.這樣就可以限制別人訪問(wèn)editor.php的訪問(wèn).設(shè)置好后重啟apache,再訪問(wèn)那個(gè)頁(yè)面就會(huì)出現(xiàn)這個(gè)頁(yè)面
Cacti插件詳解之——Weathermap(2)
當(dāng)然也可以做一個(gè)基于.htaccess的驗(yàn)證。

本文內(nèi)容都是本人自己理解,如有錯(cuò)誤之處,請(qǐng)大牛指正啊,不勝感謝?。?/div>
向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI