温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

安装配置nagios

发布时间:2020-05-27 09:57:19 来源:网络 阅读:590 作者:佛哒 栏目:移动开发

一、安装nagios前的准备工作

1.解决安装Nagios的依赖关系:Nagios基本组件的运行依赖于httpd、gcc和gd

2. 所需要安装组件:

服务端所用的安装包为 nagios nagios-plugins

linux客户端 nrpe

windows客户端 NSClient++

二.下载需求软件

nagios主程序wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz

nagios插件程序:wget http://down1.chinaunix.net/distfiles/nagios-plugins-1.4.13.tar.gz

apache程序:wget http://autosetup1.googlecode.com/files/httpd-2.2.11.tar.gz

php程序:wget http://museum.php.net/php5/php-5.3.0.tar.gz

三.编译安装nagios

1.tar zxf nagios-3.1.2.tar.gz

[root@localhost nagios-3.1.2]#   cd nagios-3.1.2

[root@localhost nagios-3.1.2]#./configure --enable-event-broker--prefix=/usr/local/nagios

[root@localhost nagios-3.1.2]#make all

[root@localhost nagios-3.1.2]#make install

[root@localhost nagios-3.1.2]#make install-init

[root@localhost nagios-3.1.2]#make install-config

[root@localhost nagios-3.1.2]#make install-commandmode

httpd的配置文件目录(conf.d)中创建NagiosWeb程序配置文件

  [root@localhost nagios-3.1.2]# make install-webconf

创建一个登录nagiosweb程序的用户,这个用户帐号在以后通过web登录nagios认证时所用:

# htpasswd -c/var/www/nagios/etc/htpasswd.users nagiosadmin

2.编译安装nagios-plugins

nagios的所有监控工作都是通过插件完成的,因此,在启动nagios之前还需要为其安装官方提供的插件。

tar zxf nagios-plugins-1.4.13.tar.gz

[root@localhost nagios-plugins-1.4.13]#cd nagios-plugins-1.4.13

[root@localhost nagios-plugins-1.4.13]#./configure --with-nagios-user=nagios --with-[root@localhost nagios-plugins-1.4.13]#nagios-group=nagios -with-mysql

[root@localhost nagios-plugins-1.4.13]#make

[root@localhost nagios-plugins-1.4.13]#make install

4.配置并启动Nagios

/etc/init.d/nagios start

注:如果启动时会报错

Error: Cannot open main configuration file '/root/nagios-plugins-1.4.13/start' for reading!

Nagios 3.1.2 starting... (PID=14327)

Local time is Fri Feb 28 02:52:22 CST 2014

Bailing out due to one or more errors encountered in the configuration files. Run Nagios from the command line with the -v option to verify your config before restarting. (PID=14327)

使用: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg检查配置文件没有发现错误

可使用:/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg 尝试启动

启动成功之后 可以使用top命令查看是否有nagios进程(有nagios进程说明启动成功)

注: service nagios restart 启动时再次失败

Running configuration check...done.

Stopping nagios: done.

Starting nagios:su: warning: cannot change directory to /home/nagios: No such file or directory

This account is currently not available.

done.

可以使用: mkdir /home/nagios 解决

service nagios restart 如果启动时仍然失败 但错误提示是:  

Running configuration check...done.

Stopping nagios: done.

Starting nagios:This account is currently not available.

done.

可以在:vi  /etc/passwd

找到此行:nagios:x:500:500::/home/nagios:/sbin/nologin(注意红色字体),把此行改成如下一行

       nagios:x:500:500::/home/nagios:/bin/bash

修改后再次重启 ,启动成功

[root@localhost nagios-3.1.2]# service nagios restart

Running configuration check...done.

Stopping nagios: done.

Starting nagios: done.













向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI