nagios 安裝配置(5)——check_nrpe傳參

現象:

監控主機:

[root@xxx ~]# /usr/local/nagios/libexec/check_nrpe -H 2.xx.xx.xx -c  check_pingtest  -a " -H 1.2.3.4   -w 150,30%  -c 200,50% -p 5"

CHECK_NRPE: Received 0 bytes from daemon.  Check the remote server logs for error messages.

被監控主機

tail -f /var/log/messages

Jun  5 07:41:31 xxx nrpe[10807]: Error: Request contained command arguments!

Jun  5 07:41:31 xxx nrpe[10807]: Client request was invalid, bailing out...

解決:

被監控主機:

  1. 重新編譯安裝nrpe 帶這個參數 --enable-command-args ; make all ;make install    #####allows clients to specify command arguments.  *** THIS IS A SECURITY RISK! *** Read the SECURITY file before using this option!
  2. /usr/local/nagios/etc/nrpe.cfg : dont_blame_nrpe=1 #打開參數傳遞
  3. 編輯 /usr/local/nagios/etc/nrpe.cfg : command[check_pingtest]=/usr/local/nagios/libexec/check_ping -H $ARG1$ -w 1500,100%  -c 2000,100% -p  $ARG2$  -t  10

監控主機

  1. 測試:[root@xxx ~]# /usr/local/nagios/libexec/check_nrpe -H 2.xx.xx.xx -c  "check_pingtest"  -a 1.2.3.4  10 
  2. 結果:PING OK - Packet loss = 0%, RTA = 53.43 ms|rta=53.426998ms;1500.000000;2000.000000;0.000000 pl=0%;100;100;0
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章