亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

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

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

nagios監控(三)

發布時間:2020-05-27 08:45:45 來源:網絡 閱讀:585 作者:dgz1124 欄目:移動開發

 

同理添加要監控的服務配置到service.cfg

vi service.cfg

define service {

use generic-service

host_name 197-etiantian-1-1

service_description Current Load

check_command check_nrpe!check_load

max_check_attempts 2

normal_check_interval 4

retry_check_interval 4

check_period 24x7

notification_interval 1440

notification_period 24x7

notification_options w,u,c,r

contact_groups admins

process_perf_data 1

}

define service {

use generic-service

host_name 197-etiantian-1-1

service_description MEM Useage

check_command check_nrpe!check_mem

max_check_attempts 2

normal_check_interval 4

retry_check_interval 4

check_period 24x7

notification_interval 1440

notification_period 24x7

notification_options w,u,c,r

contact_groups admins

process_perf_data 1

}

define service {

use generic-service

host_name 197-etiantian-1-1

service_description Swap Useage

check_command check_nrpe!check_swap

max_check_attempts 10

normal_check_interval 3

retry_check_interval 4

check_period 24x7

notification_interval 480

notification_period workhours

notification_options w,u,c,r

contact_groups admins

process_perf_data 1

}

define service {

use generic-service

host_name 197-etiantian-1-1

service_description Disk Partition

check_command check_nrpe!check_disk

max_check_attempts 8

normal_check_interval 3

retry_check_interval 2

check_period 24x7

notification_interval 360

notification_period 24x7

notification_options w,u,c,r

contact_groups admins

process_perf_data 1

}

define service {

use generic-service

host_name 197-etiantian-1-1

service_description Disk Iostat

check_command check_nrpe!check_iostat!5!11

max_check_attempts 2

normal_check_interval 4

retry_check_interval 4

check_period 24x7

notification_interval 1440

notification_period 24x7

notification_options w,u,c,r

contact_groups admins

process_perf_data 1

}

#*:

1.以上service.cfg 中添加了對磁盤分區、LoadMemSwap、磁盤io 的監控

2.以上hots.cfg service 的內容的詳細解釋見附錄八

 

 

若此時執行如下檢查nagios 語法命令:

檢查語法:

/etc/init.d/nagios checkconfig

會發現報錯:

Checking services...

Error: Service check command 'check_nrpe' specified in service 'Swap Useage' for host '197-etiantian-1-1' not

defined anywhere!

省略若干。。

Total Warnings: 0

Total Errors: 5

根據錯誤提示,我們可以知道,是check_nrpe 插件沒有定義導致。

 

#注意沒有出現

Total Warnings: 0

Total Errors: 5

而是出現的

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

Running configuration check...

Nagios Core 3.2.0

……………………….

Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...

Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...

Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...

Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...

Processing object config directory '/usr/local/nagios/etc/commands'...

Error: Could not open config directory '/usr/local/nagios/etc/commands' for reading.

………………………….

 CONFIG ERROR!  Check your Nagios configuration.

#配置文件沒有改IP

 

 

 

需要在commands.cfg 中加入check_nrpe 的插件配置

#vi commands.cfg 進入后按shift+g 切到結尾加入下面內容。

# 'check_nrpe' command definition

define command{

command_name check_nrpe

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

}

此時重新執行檢查語法命令:

檢查語法:

/etc/init.d/nagios checkconfig

Total Warnings: 0

Total Errors: 0

*:修改配置不需要restart

 

打開網頁會出現

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

解決方法

[root@nagiosserver objects]#cd /usr/local/nagios/etc

[root@nagiosserver objects]#vi cgi.cfg +119

#把在1.6 節建立的用戶oldboy 加到后面,注意用逗號隔開。

#default_user_name=oldboy

authorized_for_system_information=nagiosadmin,oldboy

authorized_for_configuration_information=nagiosadmin,oldboy

authorized_for_system_commands=nagiosadmin,oldboy

authorized_for_all_services=nagiosadmin,oldboy

authorized_for_all_hosts=nagiosadmin,oldboy

authorized_for_all_service_commands=nagiosadmin,oldboy

authorized_for_all_host_commands=nagiosadmin,oldboy

 

 

記得reload nagios 命令為:/etc/init.d/nagios reload

 

 

 

增加從nagios 服務器端發起的監控:如url 地址,端口監控

1.添加要監控的服務配置到service.cfg

########check url

#check_weburl (http://blog.etiantian.org) 197-etiantian-1-1

define service{

use generic-service

host_name 197-etiantian-1-1

service_description blog_url

check_command check_weburl!-H blog.etiantian.org

max_check_attempts 3

normal_check_interval 2

retry_check_interval 1

check_period 24x7

notification_interval 30

notification_period 24x7

notification_options w,u,c,r

contact_groups admins

}

#check_weburl(http://blog.etiantian.org/oldboy/) 197-etiantian-1-1

define service{

use generic-service

host_name 197-etiantian-1-1

service_description blog_oldboy_url

check_command check_weburl!-H blog.etiantian.org -u /oldboy/

max_check_attempts 3

normal_check_interval 2

retry_check_interval 1

check_period 24x7

notification_interval 30

notification_period 24x7

notification_options w,u,c,r

contact_groups admins

}

#請注意看以上監控URL 的不同

# 如果你的機器沒有blog.etiantian.org WEB 配置, 可以直接用我的博客的公網地址

http://blog.etiantian.org/oldboy/,這樣下面就不需要本地解析了。

 

 

檢查語法:

/etc/init.d/nagios checkconfig

會發現報錯:

Checking services...

Error: Service check command 'check_weburl' specified in service 'blog_oldboy_url' for host '197-etiantian-1-1' not defined

anywhere!

Error: Service check command 'check_weburl' specified in service 'blog_url' for host '197-etiantian-1-1' not defined anywhere!

省略若干

Total Warnings: 0

Total Errors: 2

根據錯誤可以知道,是check_weburl 插件沒有定義導致。

 

 

 

、需要在commands.cfg 中加入check_weburl 的插件配置

# 'check_weburl' command definition

define command{

command_name check_weburl

command_line $USER1$/check_http $ARG1$ -w 10 -c 30

}

注意還要添加本地監控的插件:

# 'check_mem' command definition

define command{

command_name check_mem

command_line $USER1$/check_mem -w $ARG1$ -c $ARG2$

}

# 'check_load' command definition

define command{

command_name check_load

command_line $USER1$/check_load -w $ARG1$ -c $ARG2$

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

}

# 'check_disk' command definition

define command{

command_name check_disk

command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$

}

注意:以上三個插件命令沒加也是正常的,這點有空偶在細看看

 

如果是測試,注意在nagios 服務器端的/etc/hosts 下加

192.168.1.106 blog.etiantian.org

192.168.1.107 www.etiantian.org

 

檢查語法:

/etc/init.d/nagios checkconfig

Total Warnings: 0

Total Errors: 0

使配置文件生效命令/etc/init.d/nagios reload

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

岫岩| 灵武市| 遂平县| 大竹县| 北碚区| 平武县| 闵行区| 彭水| 新田县| 呼伦贝尔市| 武邑县| 陆丰市| 闻喜县| 犍为县| 麦盖提县| 独山县| 扶风县| 竹北市| 栾城县| 涞源县| 东港市| 五台县| 嘉荫县| 长治市| 高邑县| 两当县| 綦江县| 黄冈市| 静安区| 五峰| 钟祥市| 宿迁市| 景东| 连州市| 额济纳旗| 遵化市| 蓬溪县| 高邑县| 六安市| 丹寨县| 大城县|