温馨提示×

温馨提示×

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

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

Nagios安装流程(centos 5.5环境 + nagios-cn-3.2.3.tar.bz2)

发布时间:2020-04-05 07:51:52 来源:网络 阅读:1298 作者:2012木子鱼 栏目:移动开发

 Nagios安装流程(centos 5.5环境 + nagios-cn-3.2.3.tar.bz2  +

1、  更新yum

2、  安装组件

[root@localhost ~]# yum -y install httpd gettext mysql mysql-server mysql-devel php php-mysql php-pear

[root@localhost ~]# yum -y install gd gd-devel php-gd

安装nagios时需要加--with-gd-lib=/usr/lib --with-gd-inc=/usr/include  

不然不能生成statusmap.cgi  也就不能看状态图了!

3、  增加帐号

[root@localhost nagios-cn-3.2.3]# useradd nagios

[root@localhost nagios-cn-3.2.3]# passwd nagios

nagios

[root@localhost nagios-cn-3.2.3]# usermod -s /sbin/nologin nagios

[root@localhost nagios-cn-3.2.3]# groupadd nagcmd

[root@localhost nagios-cn-3.2.3]# usermod -G nagcmd nagios

[root@localhost nagios-cn-3.2.3]# usermod -G nagcmd apache

4、  解压nagios-cn文件

[root@localhost nagios-cn-3.2.3]# tar -jxvf nagios-cn-3.2.3.tar.bz2

5、  进入解压文件夹

[root@localhost nagios-cn-3.2.3]#cd nagios-cn-3.2.3

6、   运行安装命令

./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-command-group=nagcmd --with-gd-lib=/usr/lib --with-gd-inc=/usr/include

备注:提示错误

Nagios安装流程(centos 5.5环境 + nagios-cn-3.2.3.tar.bz2)

解决办法:因为是centos linux,默认可以采用yum方式安装,则采用如下命令安装gcc编译器即可:# yum -y install gcc

7、  再次运行安装命令(第6步命令),提示没有错误后运行make all 命令然后依次执行下面的命令

[root@localhost nagios-cn-3.2.3]#make all install

[root@localhost nagios-cn-3.2.3]#make install-init   //安装启动脚本到/etc/init.d

[root@localhost nagios-cn-3.2.3]#make install-commandmode

[root@localhost nagios-cn-3.2.3]#make install-config  //安装初始配置文件到/usr/local/nagios

8、  退出nagios文件夹并解压nagios-plugins并进入

[root@localhost nagios-cn-3.2.3]#cd ..

[root@localhost nagios-cn-3.2.3]# tar -zxvf nagios-plugins-1.4.15.tar.gz

[root@localhost nagios-cn-3.2.3]#cd nagios-plugins-1.4.15

9、  执行安装命令

[root@localhost nagios-plugins-1.4.15]#./configure --prefix=/usr/local/nagios-plugins --with-nagios-user=nagios --with-nagios-group=nagios

10、              然后执行以下命令

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

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

11、              安装完成以后在/usr/local/nagios-plugins 会产生一个 libexec 的目录,将该目录全部移动到/usr/local/nagios目录下即可。 

[root@localhost nagios-plugins-1.4.15]#mv /usr/local/nagios-plugins/libexec /usr/local/nagios/

12、              配置Apache:在apachehttpd.conf 文件中加入如下内容:

[root@localhost /]# vi /etc/httpd/conf/httpd.conf

###nagios

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

 

<Directory "/usr/local/nagios/sbin">

#  SSLRequireSSL

    Options ExecCGI

    AllowOverride None

    Order allow,deny

    Allow from all

#  Order deny,allow

#  Deny from all

#  Allow from 127.0.0.1

    AuthName "Nagios Access"

    AuthType Basic

    AuthUserFile /usr/local/nagios/etc/htpasswd.users

    Require valid-user

</Directory>

 

Alias /nagios "/usr/local/nagios/share"

 

<Directory "/usr/local/nagios/share">

#  SSLRequireSSL

    Options None

    AllowOverride None

    Order allow,deny

    Allow from all

#  Order deny,allow

#    Deny from all

#  Allow from 127.0.0.1

    AuthName "Nagios Access"

    AuthType Basic

    AuthUserFile /usr/local/nagios/etc/htpasswd.users

    Require valid-user

</Directory>

13、              启动Apache服务

[root@localhost /]# service httpd restart

14、              设置报报警邮箱

[root@localhost /]# vi /usr/local/nagios/etc/objects/contacts.cfg

nagios@localhost改为自己的邮箱(310475629@qq.com),保存并退出。

15、              设置登陆web密码

[root@localhost /]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

New password: nagiosadmin

Re-type new password: nagiosadmin

Adding password for user nagiosadmin

16、              启动(重启)相关服务(Apachenagios服务)

[root@localhost /]# service httpd restart

[root@localhost /]# service nagios restart

 

17、              检查配置文件是否正确

如果出现如下显示就说明配置没问题

Total Warnings: 0

Total Errors:   0

18、              现在就可以http://你的 IP/nagios/访问 nagios(实验IP地址为192.168.1.8),提示正常的界面则nagios安装成功。

向AI问一下细节

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

AI