nagios監控故障排除

1、安裝完nagios及nagios-plugins時,卡在這了,forbidden 禁止訪問

apache日誌顯示如下

Directory index forbidden by Options directive: /usr/local/nagios/share/

1、apache的配置問題默認頁面是否是index.php,還有是否支持php模塊(ll /etc/httpd/conf.d/php.conf

2、相應目錄的權限問題 是否可讀

3、是否正確配置的賬戶驗證,

如下示例:

配置http驗證 【配置驗證時注意驗證用戶的名字,建議爲nagiosadmin,不然就記得修改cgi.cfg及contact.cfg保持賬號的一致,不然就會遇到下面的錯誤5.】

兩種方式

第一種方式,在安裝nagios的時候,直接makeinstall –webconf

這個會在/etc/httpd/conf.d/生成一個nagios.conf文件

htpasswd-c /etc/nagios/htpasswd.users  nagiosadmin

第二種方式

直接自行配置nagioshttp驗證,可直接在主配置文件nagios.conf中添加如下

ScriptAlias/nagios/cgi-bin /usr/local/nagios/sbin

<Directory "/usr/local/nagios/sbin">

Options ExecCGI

AllowOverride None

Order allow,deny

Allow from all

AuthName "Nagios Access"

AuthType Basic

AuthUserFile/etc/nagios/htpasswd

//用於此目錄訪問身份驗證的文件

Require valid-user

</Directory>


Alias /nagios/usr/local/nagios/share

<Directory"/usr/local/nagios/share">

Options None

AllowOverride None

Order allow,deny

Allow from all

AuthName "Nagios Access"

AuthType Basic

AuthUserFile/etc/nagios/htpasswd

#//用於此目錄訪問身份驗證的文件

Require valid-user

</Directory>

htpasswd-c /etc/nagios/htpasswdnagios

2、The requested URL/nagios/cgi-bin/statusmap.cgi was not found on this server.

沒有map圖形,

yuminstall gd-devel -y

重新編譯,

若是源碼安裝gd-devel,需要手動來指明gd-lib的存放,通過yum安裝的不需要,可以自動加載到

./configure --with-gd-lib=/usr/lib  --with-gd-inc=/usr/include

make install; makeinstall-init; make install-config; make install-commandmode; make install-webconf

重啓nagios服務


3、錯誤:

Error: Service check command'check_nrpe' specified in service 'check_total_procs' for host '192.168.15.183'not defined anywhere!

沒有定義nagios的命令模板

編輯commands.cfg 添加即可

例:define command {
       command_name  check_nrpe
       command_line     $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}


4、安裝nrpe,編譯的時候提示以下信息checkingfor SSL headers... configure: error: Cannot find ssl headers原因是缺少openssl-devel包,yum -yinstall openssl-devel 問題解決!


5It appears as thoughyou do not have permission to view information for any of the hosts yourequested...

If you believe this is an error, check the HTTP serverauthentication requirements for accessing this CGI
and check the authorization options in your CGI configuration file.

解決:

第一種:

配置cgi.cfg

78 use_authentication=1默認值爲1,改爲0,即取消賬號驗證

第二種:同樣也是配置cgi.cfg中的參數,

在末行模式下執行 %s/nagiosadmin/username/g

username是你在htpasswd生成的自定義驗證用戶


開啓認證認證的用戶必須是 cgi.cfg 配置文件裏有的默認是 nagiosadmin
  如果你新建的其他用戶需要添加進去多用戶用逗號分開
   authorized_for_system_information=nagiosadmin
   authorized_for_configuration_information=nagiosadmin
   authorized_for_system_commands=nagiosadmin
   authorized_for_all_services=nagiosadmin
   authorized_for_all_hosts=nagiosadmin
   authorized_for_all_service_commands=nagiosadmin
   authorized_for_all_host_commands=nagiosadmin
  如果不是 nagiosadmin 需要到後面添加
  例子 authorized_for_system_information=nagiosadmin,username


願積極跟貼,共建nagios故障解決手冊。。。。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章