Nagios外掛程式Nagiosgraph安裝部署

來源:互聯網
上載者:User

標籤:nagios   perl   cpan   nagiosgraph   

  Nagios是比較常用的一款開源監視軟體,Nagios靈活輕便使得在使用時可以根據自己的實際情況靈活運用,但是Nagios有一個缺點是對繪圖做的不夠完善,所以在對監控資料用來做分析時Nagios就有短板了。不過因為Nagios的靈活所以Nagios可以藉助其他的方式實現圖形報表的展示,今天在此就簡要的說一說官方的Nagiosgraph外掛程式,Nagiosgraph外掛程式是用過Perl來實現的,所以在使用用Nagiosgraph外掛程式時就要確保系統中安裝了Perl以及配置好相應的cpan源,這樣才能進行安裝,至於cpan的源配置以前有提及過,這裡就不做說明,需要可以參看:http://jim123.blog.51cto.com/4763600/1895093 。Nagiosgraph外掛程式的官方:https://sourceforge.net/projects/nagiosgraph/files/ ,建議下載最新穩定版,安裝部署前需要先檢查系統中是否有安裝外掛程式所需的依賴包:

[[email protected] nagiosgraph-1.5.2]# perl install.pl --check-prereq#像這樣就是所有的外掛程式都有安裝了checking required PERL modules  Carp...1.11  CGI...3.51  Data::Dumper...2.124  Digest::MD5...2.39  File::Basename...2.77  File::Find...1.14  MIME::Base64...3.08  POSIX...1.17  RRDs...1.3008  Time::HiRes...1.9721checking optional PERL modules  GD...2.44  Nagios::Config...36checking nagios installation  found nagios exectuable at /usr/local/nagios/bin/nagios  found nagios init script at /etc/init.d/nagioschecking web server installation  found apache executable at /usr/sbin/httpd  found apache init script at /etc/init.d/httpd

如果找到那一沒有安裝就安裝下,建議在配置好yum源或者是apt源後進行安裝如GD繪圖安裝:

[[email protected] nagiosgraph-1.5.2]# yum -y install perl-GD

這裡一般都會缺少安裝Perl下的Nagios::Config模組,在配置好cpan源後使用cpan安裝

[[email protected] nagiosgraph-1.5.2]# cpan Nagios::Config#注意有的時候還會缺少Digest::MD5模組等同理依次安裝即可

在解決所有的依賴關係後就可以開始安裝配置,在安裝時會有提示預設選項直接按斷行符號就進行下一步

[[email protected] nagiosgraph-1.5.2]# perl install.pl

在安裝好後需要注意,最後會有提示需要在Nagios中做一些配置更改配置及操作方法,如:

# process nagios performance data using nagiosgraphprocess_performance_data=1service_perfdata_file=/tmp/perfdata.logservice_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$service_perfdata_file_mode=aservice_perfdata_file_processing_interval=30service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph#修改Nagios的設定檔,在nagios.cfg添加/bin/systemctl restart  httpd.service  * In the nagios commands file (command.cfg),    add these lines:# command to process nagios performance data for nagiosgraphdefine command {  command_name process-service-perfdata-for-nagiosgraph  command_line /usr/local/nagiosgraph/bin/insert.pl}#添加修改command.cfg設定檔  * In the apache configuration file (httpd.conf),    add this line:Include /usr/local/nagiosgraph/etc/nagiosgraph-apache.conf#在Nagios的用的httpd設定檔中添加nagiosgraph的包含  * Check the nagios configuration:/usr/local/nagios/bin/nagios -v /path/to/nagios.cfg  * Restart nagios to start data collection:/etc/init.d/nagios restart  * Restart apache to enable display of graphs:/etc/init.d/httpd restart#最後在多項檢查重啟後完成配置  * To enable graph links and mouseovers, see README sections:       Displaying Per-Service and Per-Host Graph Icons and Links       Displaying Graphs in Nagios Mouseovers

同Nagios一樣開啟頁面配置檢查頁面:http://IP/nagiosgraph/cgi-bin/showconfig.cgi650) this.width=650;" src="https://s4.51cto.com/wyfs02/M01/9E/80/wKiom1mRvMWxYUThAABZ5H2rJ4g901.png-wh_500x0-wm_3-wmp_4-s_4178348816.png" title="Nagiosgraph配置檢查頁面" alt="wKiom1mRvMWxYUThAABZ5H2rJ4g901.png-wh_50" />

確認沒有問題後再到Nagios的share檔案夾下修改Nagios的php分頁檔side.php添加Nagiosgraph的連結製作偽靜態頁:

<?php $nagiosgraph_path = ‘/nagiosgraph/cgi-bin‘;?><li><a >Nagios圖表</a></li><ul><li><a href="<?php echo $nagiosgraph_path;?>/show.cgi" target="<?php echo $link_target;?>">圖表</a></li><li><a href="<?php echo $nagiosgraph_path;?>/showhost.cgi" target="<?php echo $link_target;?>">主機圖表</a></li><li><a href="<?php echo $nagiosgraph_path;?>/showservice.cgi" target="<?php echo $link_target;?>">服務圖表</a></li><li><a href="<?php echo $nagiosgraph_path;?>/showgroup.cgi" target="<?php echo $link_target;?>">主機群組圖表</a></li></ul></li>

最後在Nagios的頁面下就有Nagiosgraph的圖錶鏈接650) this.width=650;" src="https://s1.51cto.com/wyfs02/M00/9E/81/wKiom1mRvtuDO8zTAAOki0Wprh8171.png-wh_500x0-wm_3-wmp_4-s_4248651793.png" title="Nagiosgraph圖錶鏈接" alt="wKiom1mRvtuDO8zTAAOki0Wprh8171.png-wh_50" />

650) this.width=650;" src="https://s3.51cto.com/wyfs02/M02/9E/6F/wKioL1mRv3bioD3QAABG8rI7VSo809.png-wh_500x0-wm_3-wmp_4-s_286579915.png" title="Nagiosgraph使用" alt="wKioL1mRv3bioD3QAABG8rI7VSo809.png-wh_50" />

根據要選定的主機和服務組建圖表,總之Nagiosgraph的配置是依賴於Perl配置起來還是比較簡單的,但是產生的圖表並不是非常的完美,不過也能滿足日常的一些簡單的分析,但是如果需要更好可以藉助替他軟體或外掛程式實現,Nagios的圖表展示。

本文出自 “技術隨筆” 部落格,謝絕轉載!

Nagios外掛程式Nagiosgraph安裝部署

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.