[Nagios] Web管理画面から操作するための設定方法

Nagios のWeb管理画面から操作するための設定方法をご紹介します。

Nagios | ナギオス

エラーメッセージ

Sorry Dave, I can’t let you do that…

It seems that you have chosen to not use the authentication functionality of the CGIs.

I don’t want to be personally responsible for what may happen as a result of allowing unauthorized users to issue commands to Nagios,so you’ll have to disable this safeguard if you are really stubborn and want to invite trouble.

Read the section on CGI authentication in the HTML documentation to learn how you can enable authentication and why you should want to.

原因としては、下記の2点です。

  • Nagios のウェブ管理画面のプロセスを起動させている nginx ユーザーを nagios グループに追加していなかった
  • nagios グループに nagios の設定変更を行う command を許可していなかった

nginx ユーザーを nagios グループに追加します。

usermod -G nagios nginx

そして、use_authentication を有効にして、nagios グループのユーザーのみコマンドを実行できるような設定に変更します。

# diff cgi.cfg cgi.cfg.2014-05-28 
78c78
< use_authentication=1
---
> use_authentication=0
107c107
< default_user_name=nagios
---
> #default_user_name=guest
119c119
< authorized_for_system_information=nagios
---
> authorized_for_system_information=nagiosadmin
131c131
< authorized_for_configuration_information=nagios
---
> authorized_for_configuration_information=nagiosadmin
144c144
< authorized_for_system_commands=nagios
---
> authorized_for_system_commands=nagiosadmin
157,158c157,158
< authorized_for_all_services=nagios
< authorized_for_all_hosts=nagios
---
> authorized_for_all_services=nagiosadmin
> authorized_for_all_hosts=nagiosadmin
171,172c171,172
< authorized_for_all_service_commands=nagios
< authorized_for_all_host_commands=nagios
---
> authorized_for_all_service_commands=nagiosadmin
> authorized_for_all_host_commands=nagiosadmin

以上、Nagios を Web管理画面から操作したい、現場からお送りしました。

参考情報