部署 nagios nrdp 外掛程式過程中遇到的問題總結

來源:互聯網
上載者:User

標籤:http   io   os   ar   sp   on   問題   amp   工作   

在ubuntu 14.04 系統探索部署 nagios nrdp 外掛程式過程中,遇到如下問題?

測試 http: ip /nrdp/ 提交結果的頁面中,總是報如下錯誤:

<result><status>-1</status><message>BAD COMMAND FILE</message></result><result><status>-1</status><message>BAD CHECK RESULTS DIR</message></result>

“BAD COMMAND FILE” “BAD CHECK RESULTS DIR” 開發人員定義的這兩條運行錯誤提示資訊,語義解偏差很大,弄了兩天依然無頭緒, 無奈之下只能在閱讀外掛程式的源碼,分別找到了源碼中的位置,現在把報錯資訊出處的調用的函數寫成兩個測試指令碼

test_file_exists.php <?php  $result=file_exists("/var/lib/nagios3/spool/checkresults","c"); print $result."\n\r"; ?> test_tempnam.php <?php  $tmpname=tempnam("/var/lib/nagios3/spool/checkresults","c"); print $tmpname."\n\r"; ?>

分別以nagios www-data 使用者身份執行,會返回不同的結果,外掛程式不能工作的正常原因就這裡,請讀者自行驗證,!

sudo -u nagios  test_tempnam.php sudo -u nagios  test_file_exists.phpsudo -u www-data  test_tempnam.php sudo -u www-data  test_file_exists.php

最後給出一個臨時解決辦法,更改apache服務的運行使用者

vim /etc/apache2/envvarsexport APACHE_RUN_USER=nagiosexport APACHE_RUN_GROUP=nagios

最後測試一切OK

主機檢測發送結果

python send_nrdp.py –url=http://10.2.0.191/server/ –token=“[email protected]&d” –host=localhost –state=0 –output=“ok ok ok”

服務檢測發送結果

python send_nrdp.py –url=http://10.2.0.191/server/ –token=“[email protected]&d” –host=localhost –service=check_disk_passive –state=0 –output=“ok ok ok”

部署 nagios nrdp 外掛程式過程中遇到的問題總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.