nagios core的安装与配置

[b]安装[/b]
./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


[b]配置nagios[/b]
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
}


添加监控service
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并访问
[url]http://localhost/nagios[/url]

你可能感兴趣的:(linux应用)