溫馨提示×

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

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

nagios 圖形化界面之三 (nagiosgraph)

發(fā)布時(shí)間:2020-07-23 17:05:10 來源:網(wǎng)絡(luò) 閱讀:9601 作者:wushank 欄目:移動(dòng)開發(fā)

   如今,監(jiān)控系統(tǒng)是琳瑯滿目,有NagiosCacti、ZabbixCentreon、Munin等,也有系統(tǒng)集成如FAN等。個(gè)人在經(jīng)過不同監(jiān)控的安裝測(cè)試后,還是比較傾向于Nagios的監(jiān)控,簡(jiǎn)單命令;而且結(jié)合nagios和pnp4nagios等插件可以實(shí)現(xiàn)圖表的功能。

    Nagios、Nagiosgraph 使用的是RRDtool工具來實(shí)現(xiàn)畫圖的。


1:安裝依賴

            (1) .  rrdtool  安裝rrdtool-1.4.5.tar.gz

            (2) .  GD的perl模塊

                       nagios 圖形化界面之三 (nagiosgraph)

         GD模塊依賴于gd-devel等開發(fā)包。


2:  解壓安裝nagiosgraph-1.4.4.tar.gz


           tar  zxvf nagiosgraph-1.4.4.tar.gz

           cd   nagiosgraph-1.4.4

       以下都是在nagiosgraph-1.4.4目錄下完成的,安裝前檢測(cè)安裝環(huán)境


[root@localhostnagiosgraph-1.4.4]# perl install.pl--check-prereq

checking required PERL modules

Carp...1.20

CGI... ***FAIL***

Data::Dumper...2.130_02

File::Basename...2.82

File::Find...1.19

MIME::Base64...3.13

POSIX...1.24

RRDs...1.4004

Time::HiRes...1.972101

checking optional PERL modules

GD...***FAIL***

checking nagios installation

found nagios at /usr/local/nagios/bin/nagios

checking web server installation

found apache at /usr/sbin/httpd


*** one or more problems were detected!


以上是我的結(jié)果,錯(cuò)誤是perlcgi模塊沒有安裝

使用yum 安裝,如下

yum install perl-CGI

重新檢驗(yàn)

perl install.pl --check-prereq

結(jié)果就正確了


安裝

perl install.pl//安裝命令

出現(xiàn)的結(jié)果如下,注意后面最好不要一路回車,自己多注意一下都是什么要求


checking required PERL modules

Carp...1.20

CGI...3.52

Data::Dumper...2.130_02

File::Basename...2.82

File::Find...1.19

MIME::Base64...3.13

POSIX...1.24

RRDs...1.4004

Time::HiRes...1.972101

checking optional PERL modules

GD...2.44

checking nagios installation

found nagios at /usr/local/nagios/bin/nagios

checking web server installation

found apache at /usr/sbin/httpd

Destination directory (prefix)?[/usr/local/nagiosgraph] /usr/local/nagios/nagiosgraph//此處是nagiosgraph的目錄,這個(gè)可以自己選擇一下

Location of configuration files (etc-dir)?[/usr/local/nagios/nagiosgraph/etc]

Location of executables?[/usr/local/nagios/nagiosgraph/bin]

Location of CGI scripts?[/usr/local/nagios/nagiosgraph/cgi]

Location of documentation (doc-dir)?[/usr/local/nagios/nagiosgraph/doc]

Location of examples?[/usr/local/nagios/nagiosgraph/examples]

Location of CSS and JavaScript files?[/usr/local/nagios/nagiosgraph/share]

Location of utilities?[/usr/local/nagios/nagiosgraph/util]

Location of state files (var-dir)?[/usr/local/nagios/nagiosgraph/var]

Location of RRD files?[/usr/local/nagios/nagiosgraph/var/rrd]

Location of log files (log-dir)?[/usr/local/nagios/nagiosgraph/var]

Path of log file?[/usr/local/nagios/nagiosgraph/var/nagiosgraph.log]

Path of CGI log file?[/usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log]

URL of CGI scripts? [/nagiosgraph/cgi-bin]

URL of CSS file?[/nagiosgraph/nagiosgraph.css]

URL of JavaScript file?[/nagiosgraph/nagiosgraph.js]

Path of Nagios performance data file?[/tmp/perfdata.log]

URL of Nagios CGI scripts?[/nagios/cgi-bin]

username or userid of Nagios user? [nagios]//此處注意你選擇的用戶

username or userid of web server user? [apache]nagios////此處注意你選擇的用戶


Modify the Nagios configuration? [n]

Modify the Apache configuration? [n]

configuration:

ng_layoutstandalone

ng_prefix/usr/local/nagios/nagiosgraph

ng_etc_dir/usr/local/nagios/nagiosgraph/etc

ng_bin_dir/usr/local/nagios/nagiosgraph/bin

ng_cgi_dir/usr/local/nagios/nagiosgraph/cgi

ng_doc_dir/usr/local/nagios/nagiosgraph/doc

ng_examples_dir/usr/local/nagios/nagiosgraph/examples

ng_www_dir/usr/local/nagios/nagiosgraph/share

ng_util_dir/usr/local/nagios/nagiosgraph/util

ng_var_dir/usr/local/nagios/nagiosgraph/var

ng_rrd_dir/usr/local/nagios/nagiosgraph/var/rrd

ng_log_dir/usr/local/nagios/nagiosgraph/var

ng_log_file/usr/local/nagios/nagiosgraph/var/nagiosgraph.log

ng_cgilog_file/usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log

ng_url/nagiosgraph

ng_cgi_url/nagiosgraph/cgi-bin

ng_css_url/nagiosgraph/nagiosgraph.css

ng_js_url/nagiosgraph/nagiosgraph.js

nagios_cgi_url/nagios/cgi-bin

nagios_perfdata_file /tmp/perfdata.log

nagios_usernagios

www_usernagios

modify_nagios_config n

nagios_config_file

nagios_commands_file

modify_apache_config n

apache_config_dir

apache_config_file

Continue with this configuration? [y]

mkdir /usr/local/nagios/nagiosgraph

mkdir /usr/local/nagios/nagiosgraph/etc

copy etc/nagiosgraph.conf to/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf

copy etc/access.conf to/usr/local/nagios/nagiosgraph/etc/access.conf

copy etc/nagiosgraph_fr.conf to/usr/local/nagios/nagiosgraph/etc/nagiosgraph_fr.conf

copy etc/servdb.conf to/usr/local/nagios/nagiosgraph/etc/servdb.conf

copy etc/nagiosgraph_es.conf to/usr/local/nagios/nagiosgraph/etc/nagiosgraph_es.conf

copy etc/hostdb.conf to/usr/local/nagios/nagiosgraph/etc/hostdb.conf

copy etc/groupdb.conf to/usr/local/nagios/nagiosgraph/etc/groupdb.conf

copy etc/nagiosgraph_de.conf to/usr/local/nagios/nagiosgraph/etc/nagiosgraph_de.conf

copy etc/datasetdb.conf to/usr/local/nagios/nagiosgraph/etc/datasetdb.conf

copy etc/labels.conf to/usr/local/nagios/nagiosgraph/etc/labels.conf

copy etc/rrdopts.conf to/usr/local/nagios/nagiosgraph/etc/rrdopts.conf

copy etc/map to/usr/local/nagios/nagiosgraph/etc/map

copy etc/ngshared.pm to/usr/local/nagios/nagiosgraph/etc

replace text in/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf

move/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf-bak to/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf

replace text in/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf

move/usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf-bak to /usr/local/nagios/nagiosgraph/etc/nagiosgraph.conf

write stub to/usr/local/nagios/nagiosgraph/etc/nagiosgraph-nagios.cfg

write stub to/usr/local/nagios/nagiosgraph/etc/nagiosgraph-commands.cfg

write stub to/usr/local/nagios/nagiosgraph/etc/nagiosgraph-apache.conf

mkdir /usr/local/nagios/nagiosgraph/cgi

copy cgi/showhost.cgi to/usr/local/nagios/nagiosgraph/cgi

replace text in/usr/local/nagios/nagiosgraph/cgi/showhost.cgi

move/usr/local/nagios/nagiosgraph/cgi/showhost.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/showhost.cgi

chmod 755 on/usr/local/nagios/nagiosgraph/cgi/showhost.cgi

copy cgi/showgroup.cgi to/usr/local/nagios/nagiosgraph/cgi

replace text in/usr/local/nagios/nagiosgraph/cgi/showgroup.cgi

move/usr/local/nagios/nagiosgraph/cgi/showgroup.cgi-bak to /usr/local/nagios/nagiosgraph/cgi/showgroup.cgi

chmod 755 on/usr/local/nagios/nagiosgraph/cgi/showgroup.cgi

copy cgi/testcolor.cgi to/usr/local/nagios/nagiosgraph/cgi

replace text in/usr/local/nagios/nagiosgraph/cgi/testcolor.cgi

move /usr/local/nagios/nagiosgraph/cgi/testcolor.cgi-bakto /usr/local/nagios/nagiosgraph/cgi/testcolor.cgi

chmod 755 on/usr/local/nagios/nagiosgraph/cgi/testcolor.cgi

copy cgi/showconfig.cgi to/usr/local/nagios/nagiosgraph/cgi

replace text in/usr/local/nagios/nagiosgraph/cgi/showconfig.cgi

move/usr/local/nagios/nagiosgraph/cgi/showconfig.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/showconfig.cgi

chmod 755 on/usr/local/nagios/nagiosgraph/cgi/showconfig.cgi

copy cgi/show.cgi to/usr/local/nagios/nagiosgraph/cgi

replace text in/usr/local/nagios/nagiosgraph/cgi/show.cgi

move/usr/local/nagios/nagiosgraph/cgi/show.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/show.cgi

chmod 755 on/usr/local/nagios/nagiosgraph/cgi/show.cgi

copy cgi/showgraph.cgi to/usr/local/nagios/nagiosgraph/cgi

replace text in/usr/local/nagios/nagiosgraph/cgi/showgraph.cgi

move/usr/local/nagios/nagiosgraph/cgi/showgraph.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/showgraph.cgi

chmod 755 on/usr/local/nagios/nagiosgraph/cgi/showgraph.cgi

copy cgi/showservice.cgi to/usr/local/nagios/nagiosgraph/cgi

replace text in/usr/local/nagios/nagiosgraph/cgi/showservice.cgi

move/usr/local/nagios/nagiosgraph/cgi/showservice.cgi-bak to/usr/local/nagios/nagiosgraph/cgi/showservice.cgi

chmod 755 on /usr/local/nagios/nagiosgraph/cgi/showservice.cgi

mkdir /usr/local/nagios/nagiosgraph/bin

copy lib/insert.pl to/usr/local/nagios/nagiosgraph/bin

replace text in/usr/local/nagios/nagiosgraph/bin/insert.pl

move/usr/local/nagios/nagiosgraph/bin/insert.pl-bak to/usr/local/nagios/nagiosgraph/bin/insert.pl

chmod 755 on/usr/local/nagios/nagiosgraph/bin/insert.pl

mkdir /usr/local/nagios/nagiosgraph/share

copy share/nagiosgraph.css to/usr/local/nagios/nagiosgraph/share/nagiosgraph.css

copy share/nagiosgraph.js to/usr/local/nagios/nagiosgraph/share

mkdir /usr/local/nagios/nagiosgraph/doc

copy AUTHORS to/usr/local/nagios/nagiosgraph/doc

copy CHANGELOG to/usr/local/nagios/nagiosgraph/doc

copy INSTALL to/usr/local/nagios/nagiosgraph/doc

copy README to /usr/local/nagios/nagiosgraph/doc

copy TODO to/usr/local/nagios/nagiosgraph/doc

mkdir/usr/local/nagios/nagiosgraph/examples

copy examples/map_1_3 to/usr/local/nagios/nagiosgraph/examples

copy examples/nagiosgraph.1.css to/usr/local/nagios/nagiosgraph/examples

copy examples/nagiosgraph.2.css to/usr/local/nagios/nagiosgraph/examples

copy examples/nagiosgraph-logrotate to/usr/local/nagios/nagiosgraph/examples

copy examples/nagiosgraph-commands.cfg to/usr/local/nagios/nagiosgraph/examples

copy examples/map_1_4_4 to/usr/local/nagios/nagiosgraph/examples

copy examples/map_examples to/usr/local/nagios/nagiosgraph/examples

copy examples/map_mwall to/usr/local/nagios/nagiosgraph/examples

copy examples/map_1_4_3 to/usr/local/nagios/nagiosgraph/examples

copy examples/map_minimal to/usr/local/nagios/nagiosgraph/examples

copy examples/nagiosgraph-nagios.cfg to/usr/local/nagios/nagiosgraph/examples

copy examples/nagiosgraph-apache.conf to/usr/local/nagios/nagiosgraph/examples

copy share/graph.gif to /usr/local/nagios/nagiosgraph/examples

copy share/nagiosgraph.ssi to/usr/local/nagios/nagiosgraph/examples

mkdir /usr/local/nagios/nagiosgraph/util

copy utils/testentry.pl to/usr/local/nagios/nagiosgraph/util

copy utils/upgrade.pl to/usr/local/nagios/nagiosgraph/util

chmod 755 on/usr/local/nagios/nagiosgraph/util/testentry.pl

chmod 755 on/usr/local/nagios/nagiosgraph/util/upgrade.pl

mkdir /usr/local/nagios/nagiosgraph/var/rrd

chmod 755 on/usr/local/nagios/nagiosgraph/var/rrd

chown nagios,- on /usr/local/nagios/nagiosgraph/var/rrd

touching/usr/local/nagios/nagiosgraph/var/nagiosgraph.log

chmod 644 on/usr/local/nagios/nagiosgraph/var/nagiosgraph.log

chown nagios,- on/usr/local/nagios/nagiosgraph/var/nagiosgraph.log

touching /usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log

chmod 644 on/usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log

chown nagios,- on/usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log




To complete theinstallation, do the following:


* In the nagios configuration file (e.g.nagios.cfg),

add these lines:


# process nagiosperformance data using nagiosgraph

process_performance_data=1

service_perfdata_file=/tmp/perfdata.log

service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$

service_perfdata_file_mode=a

service_perfdata_file_processing_interval=30

service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph


* In the nagios commands file (e.g.command.cfg),

add these lines:


# command to processnagios performance data for nagiosgraph

define command {

command_nameprocess-service-perfdata-for-nagiosgraph

command_line/usr/local/nagios/nagiosgraph/bin/insert.pl

}


* In the apache configuration file (e.g.httpd.conf),

add this line:


include/usr/local/nagios/nagiosgraph/etc/nagiosgraph-apache.conf


* Restart nagios to start data collection:


/etc/init.d/nagiosrestart


* Restart apache to enable display of graphs:


/etc/init.d/apacherestart


* To enable graph links and mouseovers, seeREADME sections:

Displaying Per-Service and Per-HostGraph Icons and Links

Displaying Graphs in Nagios Mouseovers


注意最后出現(xiàn)的這幾行,這是對(duì)于以后nagiosgraph的配置信息

  (1):在nagios的配置文件(nagios.cfg)中加入以下幾行



# process nagiosperformance data using nagiosgraph

process_performance_data=1

service_perfdata_file=/tmp/perfdata.log

service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$

service_perfdata_file_mode=a

service_perfdata_file_processing_interval=30

service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph



 (2):在nagios命令文件(command.cfg)中加入以下幾行



# command to processnagios performance data for nagiosgraph

define command {

command_nameprocess-service-perfdata-for-nagiosgraph

command_line/usr/local/nagios/nagiosgraph/bin/insert.pl

}



  (3):在apache配置文件httpd.conf中加入

include/usr/local/nagios/nagiosgraph/etc/nagiosgraph-apache.conf

注意include第一個(gè)字母大寫


  (4):重啟nagiohttpd后登錄nagiosgraph

http://localhost/nagiosgraph/cgi-bin/show.cgi

出現(xiàn)以下結(jié)果

nagios 圖形化界面之三 (nagiosgraph)



可以先選擇host然后點(diǎn)擊update graphs 然后,在左上角再點(diǎn)擊data for host……中的主機(jī)名稱就可以了


 (5)把nagiosgraph路徑加到nagios系統(tǒng)內(nèi)


/usr/local/nagios/share/side.php加入如下內(nèi)容
<?php$nagiosgraph_path='/nagiosgraph/cgi-bin';?>
<li><a >Nagiosgraph</a>
<ul>
<li><a href="<?phpecho$nagiosgraph_path;?>/show.cgi" target="<?phpecho$link_target;?>">Graphs</a></li>
<li><a href="<?phpecho$nagiosgraph_path;?>/showhost.cgi" target="<?phpecho$link_target;?>">Graphs by Host</a
></li>
<li><a href="<?phpecho$nagiosgraph_path;?>/showservice.cgi" target="<?phpecho$link_target;?>">Graphs by Serv
ice</a></li>
<li><a href="<?phpecho$nagiosgraph_path;?>/showgroup.cgi" target="<?phpecho$link_target;?>">Graphs by Group<
/a></li>
</ul>
</li>




其實(shí)就是nagiosweb 界面的reports欄加入了trends如下

nagios 圖形化界面之三 (nagiosgraph)



向AI問一下細(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