重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
基本准备
创新互联成立与2013年,先为钟楼等服务建站,钟楼等地企业,进行企业商务咨询服务。为钟楼企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。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
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。