freebsd 入门 nagios 基本安装

1.安装apache ,顺带也安装了php5
#cd /usr/ports/www/apache
#make install

#cd /usr/ports/www/php5-session
# make install /*选择要安装的组件*/

2.安装nagios
#cd /usr/ports/net-mgmt/nagios
# make install

3.添加nagios到自启动
#echo ‘nagios_enable="YES" ’ >>/etc/rc.conf

4.了解nagios目录结构
#locate nagios | less /*从这里可以看到一些nagios的文件目录*/
/usr/local/bin/nagios /*主程序*/
/usr/local/bin/nagiostats /*状态*/
/usr/local/etc/nagios
/usr/local/etc/nagios/cgi.cfg-sample /**/
/usr/local/etc/nagios/nagios.cfg-sample /*主配置文件*/
/usr/local/etc/nagios/objects /*配置文件目录*/
/usr/local/etc/nagios/objects/commands.cfg-sample
/usr/local/etc/nagios/objects/contacts.cfg-sample
/usr/local/etc/nagios/objects/localhost.cfg-sample
/usr/local/etc/nagios/objects/printer.cfg-sample
/usr/local/etc/nagios/objects/switch.cfg-sample
/usr/local/etc/nagios/objects/templates.cfg-sample
/usr/local/etc/nagios/objects/timeperiods.cfg-sample
/usr/local/etc/nagios/resource.cfg-sample
/usr/local/etc/rc.d/nagios /*自启动文件*/
/usr/local/libexec/nagios /*监控要用到的一些小程序*/
/usr/local/www/nagios/cgi-bin
/usr/local/www/nagios/ /*网站目录*/

5.建立nagios虚拟目录
# locate nagios |grep httpd
/usr/ports/net-mgmt/nagios/work/nagios-3.0.5/sample-config/httpd.conf
#cp /usr/ports/net-mgmt/nagios/work/nagios-3.0.5/sample-config/httpd.conf /usr/local/etc/apache22/Includes /*可以到apache目录下查看httpd.conf里有没有调用 /Includes 目录*/

6.
#htpasswd -c /usr/local/etc/nagios/htpasswd.users nagiosadmin /*创建登录验证账户*/

7.建立配置文件
#cd /usr/local/etc/nagios 把目录下的cgi.cfg-sample,nagios.cfg-sample后的‘-sample’去掉,还有objects下的也是一样去掉 -sample

#cd /usr/local/etc/nagios/objects
#/usr/local/bin/nagios -v /usr/local/etc/nagios/nagios.cfg /*测试有没有配置错误

8.试试能不能登录
#/usr/local/bin/nagios -d /usr/local/etc/nagios/nagios.cfg
#/usr/local/etc/rc.d/apache22 restart
http://localhost/nagios/ /*(localhost)或者填写你的ip,还有上面设置的账户*/

如果能登录,看到nagios的画面,就先告一段落了。

你可能感兴趣的:(apache,.net,cgi,FreeBSD,nagios)