精品伊人久久大香线蕉,开心久久婷婷综合中文字幕,杏田冲梨,人妻无码aⅴ不卡中文字幕

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Cacti插件詳解——Weathermap

 

 

 

        這些漂亮的網絡拓撲都是用weathermap畫出來的!
這么長時間了沒有發出來,今天就寫以下weathermap的用法,以下都是我自己的理解,如有錯誤之處請諒解!
weathermap是用來做網絡拓撲圖的,其中可以調用mrtg和cacti的流量圖,可以生成靜態的html頁面。具體的例子大家可以中國科大的這個http://linux.ustc.edu.cn/
weathermap的官方網站為 http://www.network-weathermap.com/ weathermap有二種用法。第一種就是作為cacti的插件使用,第二種就是獨立出來,可以獨立安裝一個weathermapm,當然要php,php-gd支持,weathermap最新版本為weathermap-0.97a.

一.weathermap作為cacti插件的用法

1.安裝weathermap插件

12345
wget http://www.network-weathermap.com/files/php-weathermap-0.97a.zipunzip php-weathermap-0.97a.zipmv weathermap/ /var/www/html/plugins/chown -R apache:apache /var/www/html/plugins/weathermap/configs/chown -R apache:apache /var/www/html/plugins/weathermap/output/
下面我們打開cacti,點console——Plugin Management,就可以看到weathermap了,點前面那個點就可以安裝weathermap

 

 

點擊安裝weathermap后

至此,weathermap已經安裝成功。

2.配置使用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

1
vi /var/www/html/plugins/weathermap/editor.php
12345678910111213141516171819202122
<php  require_once 'editor.inc.php';require_once 'Weathermap.class.php'; // so that you can't have the editor active, and not know about it.$ENABLED=true; if(! $ENABLED){print " The editor has not been enabled yet. You need to set ENABLED=true at the top of editor.php ";print " 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. ";exit();}
把上面的$ENABLED=false;改為$ENABLED=true;然后保存。之后我們刷新頁面就可以看到如下頁面

 

在這里我們可以創建配置文件,或者從一個配置文件創建一個新的配置文件,或者打開一個已有的配置文件進行編輯,這里我們就點擊simple.conf文件做一個簡單的weathermap配置。點擊simple.conf可以看到下圖
這里就是weathermap的編輯頁面了,把上面那個幾次菜單翻譯下吧。
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的images里,設置好有點擊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獲取會自動取得。從mrtg要自己設置下。別的默認就成。這樣我們就我完成了對一張拓撲圖的編輯。如下就是我設計的weathermap圖像

注意問題

1,中文顯示,我們可以在配置文件里指定中中文字體的路徑
12
vi /var/www/html/plugins/weathermap/configs/simple.confFONTDEFINE 100 /var/www/html/plugins/weathermap/msyh.ttf 10
msyh.ttf是中文字體的名字.需要用戶自己加進去,指定路徑,后面10字體是大小
2.每次對圖形進行調整后,都是自動保存的,不用保存(也沒有那個選項!嘿嘿),要在weathermap里看到修改后的效果要等到下次cacti采集器采集后才會繪圖。
<>
>3.cacti的日志里可能會顯示
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]
等信息,不過我修改php.ini里的設置也不起作用,不用管它!
4.可以在cacti的里進行設置,如圖,一般默認就成

二.weathermap獨立的使用。

通過在catci里的設置,大家會weathermap已經有了一個認識了,其實它就是用過一個配置文件,繪圖,引用cacti或者mrtg的流量和圖形就成了

1.安裝基本環境

123456789
yum install httpd php php-gd  php-pear rrdtool -yservie http startchkconfig http onservice crond startchkconfig crond onwget http://www.network-weathermap.com/files/php-weathermap-0.97a.zipunzip php-weathermap-0.97a.zipmv weathermap/ /var/www/html/chown -R apache:apache /var/www/html/weathermap/configs/

2.配置weathermap

 

我們要配置我們的圖形配置文件
先編輯editor.php
1
vi /var/www/html/weathermap/editor.php
把里面的$ENABLED=false;改為$ENABLED=true;$ignore_cacti=False;改為$ignore_cacti=True;然后保存。
之后我們打開http://xxx.xxx.xxx.xxx/weathermap/editor.php
就可以像在cacti里一樣設計自己的weathermap圖形了,

 

特別注意:

 

1.在這里ICO的路徑要選擇絕對路徑,不讓路徑會有錯誤,導致不能出圖。
2.eidtor.php里可以設置拓撲圖輸出的路徑Image的路徑直接寫名稱,不用寫路徑,Html的路徑路徑要寫絕對路徑。
3.在weathermap目錄里有個weathermap文件要設置rrdtools的路徑。$rrdtool=”/usr/bin/rrdtool”;
關于配置文件的我們可以weathermap官網找到
weathermap官網的設置:http://www.network-weathermap.com/manual/latest/pages/config-reference.html 具體的參數這里都有
這里還有一個配置文件的范本http://www.network-weathermap.com/manual/latest/pages/main.html#example
這個是做好的圖形;http://www.network-weathermap.com/manual/latest/example/example.html

 

3.生成圖形

 

設置好圖形配置文件后我們就要生成圖形了,在cacti里這個是通過cacti的采集器實現的,在單獨安裝weathermap的后,需要利用系統的計劃任務來實現
我們先執行一次
1
/usr/bin/php /var/www/html/weathermap/weathermap --config /var/www/html/weathermap/configs/simple.conf --image-uri ../weathermap/test.png
就可以在/下生成一個test.png圖片,然后我們編輯
1
vi /etc/crontab
添加如下
1
*/5 * * * * root /usr/bin/php /var/www/html/weathermap/weathermap --config /var/www/html/weathermap/configs/simple.conf --image-uri ../weathermap/test.png
然后我們要做個硬鏈接不讓png圖片的路徑會有錯誤
1
ln /test.png /var/www/html/weathermap/test.png
至此我們的weathermap已經做好我們可以打開http://xxx.xxx.xxx.xxx/weathermap/index.html查看拓撲圖。
我最終的拓撲圖

 

總結:

 

1.weathermap的用法就說到這里,基本就是這二種了,還有的是自己做一個html,再嵌套一個weathermap的頁面就像剛開始給大家說的那個中國科大的,就是通過網頁的嵌套做到的,嵌套了mrtg,weathermap的頁面。
2.在單獨使用weathermap時要特別注意路徑問題,不出圖形很有可能是路徑問題,這個問題我也糾結了很久。

3.最重要的一點,就是關于weathermap的安全性問題,其實在它的官網也說明了。

地址:http://www.network-weathermap.com/manual/latest/pages/install-cacti-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.
可以看到在默認情況下editor.php這個是沒有做驗證的,就是意味每個人都可以編輯你的weathermap圖形配置文件!!!!發現很多使用weathermap都沒做限制,有些還是直接到公網的,再次特別提醒,一定要做一個驗證!
下面我提供一種方法。
修改httpd.conf配置文件
1
vi /etc/httpd/conf/httpd.conf
在文件最后添加
1234567
<Directory /var/www/html/weathermap>   <Files editor.php>            Order Deny,Allow            Deny from all            Allow from 127.0.0.1        </Files></Directory>
 然后保存,這個路勁是weathermap的路徑.這樣就可以限制別人訪問editor.php的訪問.設置好后重啟apache,再訪問那個頁面就會出現這個頁面
當然也可以做一個基于.htaccess的驗證。
本站僅提供存儲服務,所有內容均由用戶發布,如發現有害或侵權內容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
centos6.5下Zabbix系列之Zabbix安裝搭建及漢化
手把手實現企業級開源監控軟件cacti nagios ntop整合(圖解)
cacti安裝與配置
CentOS 7系統上yum搭建LAMPcentos
關于 Apache 的 25 個初中級面試題
CentOS Apache配置詳解
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯系客服!

聯系客服

主站蜘蛛池模板: 来凤县| 大名县| 中方县| 潜山县| 韶关市| 泽州县| 班戈县| 克山县| 河池市| 永济市| 防城港市| 龙海市| 甘肃省| 闽清县| 定结县| SHOW| 尉氏县| 阿坝县| 平遥县| 正镶白旗| 海口市| 仁寿县| 新乐市| 灌南县| 汝阳县| 扶沟县| 望谟县| 曲周县| 外汇| 扎鲁特旗| 长葛市| 枞阳县| 阜城县| 宝丰县| 牡丹江市| 临朐县| 襄樊市| 柳河县| 政和县| 松原市| 和硕县|