日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

nagios 监控配置介绍(二)

發(fā)布時(shí)間:2023/12/10 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nagios 监控配置介绍(二) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

#配置服務(wù)端監(jiān)控客戶端


[root@nagios etc]# cd objects/


[root@nagios objects]# vi hosts.cfg

# Define a host for the local machine


define host{

? ? ? ? use ? ? ? ? ? ? ? ? ? ? linux-server

? ? ? ? host_name ? ? ? ? ? ? ? 1.3-samba

? ? ? ? alias ? ? ? ? ? ? ? ? ? 1.3-samba

? ? ? ? address ? ? ? ? ? ? ? ? 10.89.1.3

? ? ? ? }



define host{

? ? ? ?use ? ? ? ? ? ? ? ? ? ? ?linux-server

? ? ? ?host_name ? ? ? ? ? ? ? ?1.2-nagios

? ? ? ?alias ? ? ? ? ? ? ? ? ? ?1.2-nagios

? ? ? ?address ? ? ? ? ? ? ? ? ?10.89.1.2

? ? ? ?}



define host{

? ? ? ?use ? ? ? ? ? ? ? ? ? ? ?linux-server

? ? ? ?host_name ? ? ? ? ? ? ? ?1.34-web-lnmp

? ? ? ?alias ? ? ? ? ? ? ? ? ? ?1.34-web-lnmp

? ? ? ?address ? ? ? ? ? ? ? ? ?10.89.1.34

? ? ? ?}


define host{

? ? ? ?use ? ? ? ? ? ? ? ? ? ? ?linux-server

? ? ? ?host_name ? ? ? ? ? ? ? ?1.34-web

? ? ? ?alias ? ? ? ? ? ? ? ? ? ?1.34-web

? ? ? ?address ? ? ? ? ? ? ? ? ?10.89.1.34

? ? ? ?}


# Define an optional hostgroup for Linux machines


define hostgroup{

? ? ? ? hostgroup_name ?linux-servers ; The name of the hostgroup

? ? ? ? alias ? ? ? ? ? Linux Servers ; Long name of the group

? ? ? ? members ? ? ? ? 1.3-samba,1.2-nagios,1.34-web-lnmp,1.34-web

? ? ? ? }


保存退出


檢查語法,先編輯nagios文件,使出錯(cuò)信息顯示出來

[root@nagios objects]# vim /etc/init.d/nagios +183

?$NagiosBin -v $NagiosCfgFile > /dev/null 2>&1; ? 修改為:

?$NagiosBin -v $NagiosCfgFile

保存退出


檢查語法,如果報(bào)錯(cuò)如下:

[root@nagios objects]# /etc/init.d/nagios checkconfig

Checking services...

Error: There are no services defined!

? ? ? ? Checked 0 services.


解決方法:

[root@nagios objects]# vi services.cfg?


define service {

? ? ? ? use ? ? ? ? ? ? ? ? ? ? generic-service

? ? ? ? host_name ? ? ? ? ? ? ? 1.3-samba

? ? ? ? service_description ? ? Disk Partition

? ? ? ? check_command ? ? ? ? ? check_nrpe!check_disk

}?



再檢查語法

[root@nagios objects]# /etc/init.d/nagios checkconfig


Total Warnings: 1

Total Errors: ? 0


Things look okay - No serious problems were detected during the pre-flight check

?OK.

[root@nagios objects]#?


如果報(bào)下面錯(cuò)誤:


Error:Service check command 'check_nrpe' specified in service 'Disk Partition' for

?host '10-client01' not defined anywhere!

則編輯commands.cfg 文件:

[root@nagios objects]# vi commands.cfg


再末尾加上


# 'check_nrpe' command definition

define command{

? ? ? ? command_name ? ?check_nrpe

? ? ? ? command_line ? ?$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

? ? ? ? }


注意:command_line ? ?$USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ 實(shí)際上就是使用這個(gè)命令探測:

[root@nagios objects]#/usr/local/nagios/libexec/check_nrpe -H 10.89.1.3 -c check_disk


保存并退出

再檢查語法

[root@nagios objects]# /etc/init.d/nagios checkconfig


沒有錯(cuò)誤的情況下:


[root@nagios objects]# /etc/init.d/nagios reload

Running configuration check...done.

Reloading nagios configuration...done

[root@nagios objects]#?


http://10.89.1.2/nagios



如果登錄后提示錯(cuò)誤:

It appears as though you do not have permission to view information for any of the hosts you requested...



If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI

and check the authorization options in your CGI configuration file.


編輯 cgi.cfg

[root@nagios objects]# cd ../

[root@nagios etc]# vi cgi.cfg


# PHYSICAL HTML PATH

# This is the path where the HTML files for Nagios reside. ?This

# value is used to locate the logo p_w_picpaths needed by the statusmap

# and statuswrl CGIs.


physical_html_path=/usr/local/nagios/share


:g/nagiosadmin/s//alvin/g ? ? ? ? ? #替換nagiosadmin 為 alvin,該用戶是我安裝的時(shí)候添加的


保存并退出

[root@nagios objects]# /etc/init.d/nagios reload


轉(zhuǎn)載于:https://blog.51cto.com/ahtornado/1885155

總結(jié)

以上是生活随笔為你收集整理的nagios 监控配置介绍(二)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。