Jul 022011
 

Amazon Linux AMIでNagiosを動かそうと思ったら、そのままではExternal Commandが動作しませんでした。

Error: Could not open command file '/var/spool/nagios/cmd/nagios.cmd' for update!

ファイルのパーミッションは以下でした。

[root@localhost ~]# ls -l /var/spool/nagios/cmd/nagios.cmd
prw-rw---- 1 nagios nagios 0 Jul  1 03:13 /var/spool/nagios/cmd/nagios.cmd

初期状態ではApacheの実行ユーザーが上記ファイルを読み書きできないので、nagiosグループに入れてあげると実行できるようになります。

[root@localhost ~]# id apache
uid=48(apache) gid=48(apache) groups=48(apache)
[root@localhost ~]# usermod -a -G nagios apache
[root@localhost ~]# id apache
uid=48(apache) gid=48(apache) groups=48(apache),498(nagios)
[root@localhost ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@localhost ~]#

システム情報は以下。

[root@localhost ~]# cat /etc/system-release
Amazon Linux AMI release 2011.02.1.8 (beta)
[root@localhost ~]# yum info nagios
Loaded plugins: fastestmirror, priorities, security
Loading mirror speeds from cached hostfile
Installed Packages
Name       : nagios
Arch       : i686
Version    : 3.2.2
Release    : 1.2.amzn1
Size       : 7.0 M
Repo       : installed
From repo  : amzn-main
Summary    : Nagios monitors hosts and services and yells if somethings breaks
URL        : http://www.nagios.org/
License    : GPLv2
Description: Nagios is a program that will monitor hosts and services on your
           : network.  It has the ability to send email or page alerts when a
           : problem arises and when a problem is resolved.  Nagios is written
           : in C and is designed to run under Linux (and some other *NIX
           : variants) as a background process, intermittently running checks
           : on various services that you specify.
           :
           : The actual service checks are performed by separate "plugin"
           : programs which return the status of the checks to Nagios. The
           : plugins are available at
           : http://sourceforge.net/projects/nagiosplug.
           :
           : This package provides the core program, web interface, and
           : documentation files for Nagios. Development files are built as a
           : separate package.

[root@localhost ~]#

Sorry, the comment form is closed at this time.