2015-11-29 69 views
1

我在同一臺服務器上安裝了Nagios和NRPE插件(CentOs 7)。Nagios:NRPE:無法讀取輸出

預裝服務,如check_disk做工精細,但我的手動龍頭安裝插件總是以下面的錯誤結束了:

/usr/local/nagios/libexec/check_nrpe -H localhost -c check_cpu -a 20 10 
NRPE: Unable to read output 

/usr/local/nagios/etc/objects/localhost.cfg:

define service{ 
    use        local-service 
    host_name      localhost 
    service_description    CPU 
    check_command     check_cpu!20!10 
    notifications_enabled   0 
    } 

/usr/local/nagios/etc/objects/commands.cfg

define command { 
    command_name check_cpu 
    command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_cpu -t 30 -a $ARG1$ $ARG2$ 
} 

在/ usr /本地/ Nagios的在/ etc/NRP e.cfg

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10 
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 
command[check_procs]=/usr/local/nagios/libexec/check_procs -w 30 -c 200 
command[check_cpu]=/usr/local/nagios/libexec/check_cpu_perf.sh -w $ARG1$ -c $ARG2$ 
command[check_procs_cron]=/usr/local/nagios/libexec/check_procs -a cron 
command[check_mem]=/usr/local/nagios/libexec/check_mem_ng.sh -w $ARG1$ -c $ARG2$ 

輸出messages.log

Nov 29 19:52:03 localhost xinetd[25346]: START: nrpe pid=25575 from=::ffff:127.0.0.1 
Nov 29 19:52:03 localhost nrpe[25575]: INFO: SSL/TLS initialized. All network traffic will be encrypted. 
Nov 29 19:52:03 localhost xinetd[25346]: EXIT: nrpe status=0 pid=25575 duration=0(sec) 

其他信息:輸出的

/etc/xinetd.d/nrpe

# default: on 
# description: NRPE (Nagios Remote Plugin Executor) 
service nrpe 
{ 
    flags   = REUSE 
    socket_type  = stream 
    port   = 5666 
    wait   = no 
    user   = nagios 
    group   = nagios 
    server   = /usr/local/nagios/bin/nrpe 
    server_args  = -c /usr/local/nagios/etc/nrpe.cfg --inetd 
    log_on_failure += USERID 
    disable   = no 
    only_from  = 127.0.0.1 
} 

輸出從netstat -at | grep nrpe

tcp  0  0 localhost:51424   localhost:nrpe   TIME_WAIT 
tcp6  0  0 [::]:nrpe    [::]:*     LISTEN 

有沒有人有提示?由於

回答

0

在命令配置文件的/usr/local/nagios/etc/objects/commands.cfg 代替 $ USER1 $嘗試用絕對路徑 - 在/ usr /本地/ Nagios的/的libexec/

重啓Nagios的服務和檢查。

一件事我在你的問題中發現是你說的「check_disk做工精細,但我的手動龍頭安裝插件總是以錯誤結束」,並在你的/usr/local/nagios/etc/nrpe.cfg文件中有是check_disk命令command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20 -c 10的配置,但沒有配置check_cpu命令。所以當你試圖執行這個/usr/local/nagios/libexec/check_nrpe -H localhost -c check_cpu -a 20 10它實際上會諮詢你的nrpe.cfg文件,發現沒有check_cpu命令配置。 只需將check_cpu的配置添加到nrpe.cfg文件中即可。

+0

謝謝,我試過了,但沒有幫助。就像我剛纔提到的那樣,下面的方法不起作用: '/ usr/local/nagios/libexec/check_nrpe -H localhost -c check_mem' 默認的check_disk工作,只是我的附加插件check_cpu_perf.sh和/或check_mem_ng.sh不工作。那些shell腳本需要特殊處理嗎? – user3193317

+0

你可以用'/ etc/xinetd.d/nrpe'文件配置和'netstat -at | grep nrpe'輸出 –

+0

另請參閱我更新的答案。 –