参考nagios文档进行,
开始学习监控。
0.安装apache等必须的东东
开始学习监控。
0.安装apache等必须的东东
1.创建用户sudo apt-get install apache2
sudo apt-get install build-essential
sudo apt-get install libgd2-dev
libgd2-dev 在7.04中是 libgd2-noxpm-dev 2.0.34~rc1-2ubuntu1.1
执行后会被默认增加到nagios的group下sudo useradd nagios
sudo passwd nagios
不想多创建用户,也可以,config时增加一些参数就好了。
2.下载nagios和pluginwget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0b3.tar.gz
wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.9.tar.gz
3.编译安装
解压配置tar xzf nagios-3.0b3.tar.gz
cd nagios-3.0b3
./configure --with-command-group=nagios --prefix=/home/zhaofw/work/mon/nagios
或者在指定用户下安装
./configure --with-command-group=zhaofw --with-command-user=zhaofw --with-nagios-group=zhaofw
--with-nagios-user=zhaofw --prefix=/home/zhaofw/work/mon/nagios
将得到如下结果:*** Configuration summary for nagios 3.0b3 08-30-2007 ***:
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: zhaofw,zhaofw
Command user/group: zhaofw,zhaofw
Embedded Perl: no
Event Broker: yes
Install ${prefix}: /home/zhaofw/work/mon/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/init.d
Apache conf.d directory: /etc/apache2/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP):
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
编译安装:make all
make install
sudo make install-init
make install-config
make install-commandmode
4. 修改一下报警的email地址,在安装目录下的 etc/objects/contacts.cfg文件中。define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email dd@dd.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
5.web interface配置sudo make install-webconf
创建一个用户,记住密码哦。htpasswd -c ../etc/htpasswd.users nagiosadmin
重启一下apachesudo /etc/init.d/apache2 reload
6.安装plugin./configure --with-nagios-user=nagios --with-nagios-group=nagios
或者,指定用户./configure --with-command-group=zhaofw --with-command-user=zhaofw --with-nagios-group=zhaofw
--with-nagios-user=zhaofw --prefix=/home/zhaofw/work/mon/nagiosmake
make install
7.安装结束,可以启动了
sudo /etc/init.d/nagios start
8.登录就能看到基本的东西了
http://localhost/nagios/