nagios coreのインストールと構成

2234 ワード

詳細
インストール
./configure --prefix=/home/sysop/services/nagios/ --with-command-user=sysop --with-command-group=sysop --with-nagios-user=sysop --with-nagios-group=sysop
make install
make install-webconf
make install-config
sudo make install-init
htpasswd -c /home/sysop/services/nagios/etc/htpasswd.users nagiosadmin
mkdir /home/sysop/services/nagios/var/rw
sudo service apache2 restart
/home/sysop/services/nagios/bin/nagios -d /home/sysop/services/nagios/etc/nagios.cfg

nagiosの構成
includeカスタムプロファイル
mkdir /home/sysop/services/nagios/etc/services
vim /home/sysop/services/nagios/etc/nagios.cfg
cfg_dir=/home/sysop/services/nagios/etc/services
cfg_file=/home/sysop/services/nagios/etc/hosts.cfg

pingモニタリングが必要なhostを追加
vim /home/sysop/services/nagios/etc/hosts.cfg
define host{
       use                     linux-server            ; Name of host template to use
       host_name               c1
       alias                   c1-192.168.1.10
       address                 192.168.1.10
       }

nagios連絡先の変更
vim /home/sysop/services/nagios/etc/objects/contacts.cfg
EDIT YOUR EMAIL

mysqlを監視するコマンドを追加
vim /home/sysop/services/nagios/etc/objects/commands.cfg 
define command{
       command_name    check_mysql_slave_consistency
       command_line    $USER1$/check_mysql -H $HOSTADDRESS$ -P $ARG1$ -u nagios -p nagiospass -S -w 3 -c 60
       }

モニタサービスの追加
vim /home/sysop/services/nagios/etc/services/check_mysql.cfg
define service{
       use                             local-service         ; Name of service template to use
       host_name                       c1
       service_description             c1-mysql-slave
       check_command                   check_mysql_slave_consistency!3310
       }

nagiosを再起動してアクセス
http://localhost/nagios