基本准备
yum -y install httpd php mysql-devel php-mysql 安装需要的包
groupadd nagcmd 创建nagios的管理组
useradd –g nagcmd nagios 将nagios添加到组nagioscmd内
usermod -a -G nagcmd apache 将apache加入到组nagcmd内
yum –y install gcc 编译安装的需要
安装httpd【apache环境】
[root@zhangpub]# tar zxvf nagios-3.0.6.tar.gz
[root@localhosthttpd-2.2.6]# cd /var/ftp/upload/httpd-2.2.6
[root@localhosthttpd-2.2.6]# ./configure --prefix=/usr/local/apache
[root@localhosthttpd-2.2.6]# make
[root@localhosthttpd-2.2.6]# make install
[root@localhost httpd-2.2.6]#service httpd start
Starting httpd: httpd: Could notreliably determine the server's fully qualified domain name, usinglocalhost.localdomain for ServerName
(98)Address already in use:make_sock: could not bind to address [::]:80
(98)Address already in use:make_sock: could not bind to address 0.0.0.0:80
no listening sockets available,shutting down
Unable to open logs
[FAILED]
[root@localhost httpd-2.2.6]#(98)Address already in use: make_sock: could not bind to address [::]:80
-bash: syntax error nearunexpected token `Address'
[root@localhost httpd-2.2.6]#(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
-bash: syntax error nearunexpected token `Address'
启动报错:
[root@localhosthttpd-2.2.6]# netstat -lnp|grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3536/nginx
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1802/cupsd
tcp 0 0 ::1:631 :::* LISTEN 1802/cupsd
udp 0 0 0.0.0.0:631 0.0.0.0:* 1802/cupsd
unix 2 [ ACC ] STREAM LISTENING 15688 2517/gnome-power-ma /tmp/orbit-root/linc-9d5-0-e7ccb8c8800b
unix 2 [ ACC ] STREAM LISTENING 10437 1802/cupsd /var/run/cups/cups.sock
kill 掉进程。
Kill -93536
再次启动httpd服务
[root@localhosthttpd-2.2.6]#service httpd start
安装nagios
#useraddnagios –s /sbin/nologin
#tar zxvfnagios-3.0.6.tar.gz
#cdnagios-3.0.6
./configure--sysconfdir=/etc/nagios --with-commend-group=nagcmd --enable-event-broker
#make all 查看安装步骤
有如下内容
*** Compile finished ***
If the main program and CGIscompiled without any errors, you
can continue with installingNagios as follows (type 'make'
without any arguments for a listof all possible options):
make install
- This installs the main program, CGIs,and HTML files
make install-init
- This installs the init script in/etc/rc.d/init.d
makeinstall-commandmode
- This installs and configures permissionson the
directory for holding the externalcommand file
makeinstall-config
- This installs *SAMPLE* config files in/usr/local/nagios--with-nagios-user=nagios--with-nagios-group=nagios/etc
You'll have to modify these sample filesbefore you can
use Nagios. Read the HTML documentation for more info
on doing this. Pay particular attention to the docs on
object configuration files, as theydetermine what/how
things get monitored!
makeinstall-webconf
- This installs the Apache config file forthe Nagios
web interface
*** Support Notes*******************************************
编译安装
make all 安装主程序、CGI和HTML文件
make install 在/etc/rc.d/init.d 安装启动脚本
make install-init 把nagios做成一个运行脚本,使nagios随系统开机启动,这是一个很方便的措施。
make install-commendmode 来配置目录权限
make install-config 把配置文件的例子复制到nagios的安装目录
make install-webconf 创建一个nagiosadmin的用户用于nagios的web接口登录
htpasswd-c /etc/nagios/htpasswd.users nagiosadmin
Newpassword:
Re-typenew password:
Addingpassword for user nagiosadmin
配置密码。
service httpd restart 启动apache服务
chkconfig --add nagios 将nagios加入到服务中
chkconfig nagios on 开机启动
servicenagios start
Nagios-plugins 安装
[root@localhost upload]# tar zxvf nagios-plugins-1.4.13 解压
[root@localhost upload]# cd nagios-plugins-1.4.13 进入文件夹
[root@localhost nagios-plugins-1.4.13]#./configure--with-nagios-user=nagios --with-nagios-group=nagios 执行配置
[root@localhost nagios-plugins-1.4.13]# make 进行编译安装
[root@localhostnagios-plugins-1.4.13]# make install
[root@localhostnagios-plugins-1.4.13]# service nagios restart
关闭selinux
setenforce0
访问nagios
IP/nagios
输入账号密码。
默认已在监控localhost
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。