nagios服务配置

2024-04-13 14:47:17
yum -y install  httpd mysql-server php php-mysql

4526  useradd nagios
4527  groupadd nagcmd
4528  usermod -G nagcmd nagios
4529  usermod -G nagcmd apache
4525  tar -zxvf nagios-3.2.0.tar.gz
4530  cd nagios-3.2.0
运行Nagios配置脚本并使用先前开设的用户及用户组:

./configure --with-command-group=nagcmd

configure: creating ./config.status
config.status: creating Makefile
config.status: creating subst
config.status: creating pkginfo
config.status: creating base/Makefile
config.status: creating common/Makefile
config.status: creating contrib/Makefile
config.status: creating cgi/Makefile
config.status: creating html/Makefile
config.status: creating module/Makefile
config.status: creating xdata/Makefile
config.status: creating daemon-init
config.status: creating t-tap/Makefile
config.status: creating include/config.h
config.status: creating include/snprintf.h
config.status: creating include/cgiutils.h

Creating sample config files in sample-config/ ...

*** Configuration summary for nagios 3.2.0 08-12-2009 ***:

General Options:
-------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagcmd
            Embedded Perl:  no
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
                Lock file:  ${prefix}/var/nagios.lock
   Check result directory:  ${prefix}/var/spool/checkresults
           Init directory:  /etc/rc.d/init.d
  Apache conf.d directory:  /etc/httpd/conf.d
             Mail program:  /bin/mail
                  Host OS:  linux-gnu

Web Interface Options:
------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
Traceroute (used by WAP):  /bin/traceroute

Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

编译Nagios程序包源码

make all
======================================
*** Compile finished ***

If the main program and CGIs compiled without any errors, you
can continue with installing Nagios as follows (type 'make'
without any arguments for a list of 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

make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

make install-config
     - This installs *SAMPLE* config files in /usr/local/nagios/etc
       You'll have to modify these sample files before 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 they determine what/how
       things get monitored!

make install-webconf
     - This installs the Apache config file for the Nagios
       web interface

*** Support Notes *******************************************

If you have questions about configuring or running Nagios,
please make sure that you:

- Look at the sample config files
     - Read the HTML documentation
     - Read the FAQs online at http://www.nagios.org/faqs

before you post a question to one of the mailing lists.
Also make sure to include pertinent information that could
help others help you.  This might include:

- What version of Nagios you are using
     - What version of the plugins you are using
     - Relevant snippets from your config files
     - Relevant error messages from the Nagios log file

For more information on obtaining support for Nagios, visit:

http://www.nagios.org/support/

*************************************************************

Enjoy.

[root@localhost /usr/local/src/nagios-3.2.0]#
======================================

安装二进制运行程序、初始化脚本、配置文件样本并设置运行目录权限

make install
====================================
*** Main program, CGIs and HTML files installed ***

You can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

make install-init
     - This installs the init script in /etc/rc.d/init.d

make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

make install-config
     - This installs sample config files in /usr/local/nagios/etc

make[1]: Leaving directory `/usr/local/src/nagios-3.2.0'
[root@localhost /usr/local/src/nagios-3.2.0]#
=====================================
make install-init
make install-config
make install-commandmode

现在还不能启动Nagios-还有一些要做的...

4)客户化配置

样例配置文件默认安装在这个目录下/usr/local/nagios/etc,这些样例文件可以配置Nagios使之正常运行,只需要做一个简单的修改...

用你擅长的编辑器软件来编辑这个/usr/local/nagios/etc/objects/contacts.cfg配置文件,更改email地址nagiosadmin的联系人定义信息中的EMail信息为你的EMail信息以接收报警内容。

vi /usr/local/nagios/etc/objects/contacts.cfg

5)配置WEB接口

安装Nagios的WEB配置文件到Apache的conf.d目录下

make install-webconf

创建一个nagiosadmin的用户用于Nagios的WEB接口登录。记下你所设置的登录口令,一会儿你会用到它。

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

重启Apache服务以使设置生效。

service httpd restart

6)编译并安装Nagios插件

展开Nagios插件的源程序包

cd ~/downloads tar xzf nagios-plugins-1.4.11.tar.gz cd nagios-plugins-1.4.11

编译并安装插件

./configure --with-nagios-user=nagios --with-nagios-group=nagios make make install

7)启动Nagios

把Nagios加入到服务列表中以使之在系统启动时自动启动

chkconfig --add nagios chkconfig nagios on

验证Nagios的样例配置文件

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

如果没有报错,可以启动Nagios服务

service nagios start

8)更改SELinux设置

Fedora与SELinux(安全增强型Linux)同步发行与安装后将默认使用强制模式。这会在你尝试联入Nagios的CGI时导致一个"内部服务错误"消息。

如果是SELinux处于强制安全模式时需要做

getenforce

令SELinux处于容许模式

setenforce 0

如果要永久性更变它,需要更改/etc/selinux/config里的设置并重启系统。

不关闭SELinux或是永久性变更它的方法是让CGI模块在SELinux下指定强制目标模式:

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/ chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

更多有关Nagios的CGI模块增加目标策略的强制权限方式见NagiosCommunity.org的维基百科http://www.nagioscommunity.org/wiki。

9)登录WEB接口

你现在可以从WEB方式来接入Nagios的WEB接口了,你需要在提示下输入你的用户名(nagiosadmin)和口令,你刚刚设置的,这里用系统默认安装的浏览器,用下面这个超链接

http://localhost/nagios/

点击“服务详情”的引导超链来查看你本机的监视详情。你可能需要给点时间让Nagios来检测你机器上所依赖的服务因为检测需要些时间。

10)其他的变更

确信你机器的防火墙规则配置允许你可以从远程登录到Nagios的WEB服务。

配置EMail的报警项超出了本文档的内容,指向你的系统档案用网页查找或是到这个站点NagiosCommunity.org wiki来查找更进一步的信息,以使你的系统上可以向外部地址发送EMail信息。更多有关通知的信息可以查阅这篇文档。 更多内容可访问www.xinqiaoren.com

转载于:https://blog.51cto.com/beibei2008/209200

nagios服务配置相关推荐

  1. CentOS7安装Nagios并配置出图详解

    目录 开始之前 系统环境 监控内容 所需软件包 CentOS7重要变化 配置开发环境 同步时间 关闭Selinux 使用CRT上传软件包 安装邮件服务 监控主机安装 常用到的命令 安装nagios所需 ...

  2. nagios 服务端与客户端监控安装与详细配置,各配置文件详解

    nagios 安装与部署------ 1.安装前准备 (1)创建nagios用户和用户组    [root@localhost ~]#groupadd nagios                us ...

  3. 浅谈 nagios监控配置

    该文档只针对于配置   打乱了commands.cfg templates.cfg contacts.cfg localhost.cfg  timeperiods.cfg  resource.cfg ...

  4. Nagios—服务和性能监控

    Nagios-服务和性能监控 简介: Nagios是一个监视系统运行状态和网络信息的监视系统.Nagios能监视所指定的本地或远程主机以及服务,同时提供异常通知功能等. Nagios可运行在Linux ...

  5. 详细介绍nagios基本配置

    配置文件路径/usr/local/nagios/etc/objects 类型名                包含文件             作用 基类配置文件    templates.cfg   ...

  6. CentOS6.5下的Nagios安装配置详解(图文)

    最近因为,科研需要,接触上了Nagios,这里,我将安装笔记做个详解.为自己后续需要和博友们学习! VMware workstation 11 的下载 VMWare Workstation 11的安装 ...

  7. nagios系列(一)centos6.5环境部署nagios服务端

    nagios软件安装包存放目录:/home/oldboy/tools nagios服务安装目录:/usr/local/nagios 1.配置yum源 echo "------ step 1: ...

  8. Nagios之配置介绍

    再配置本文之前请先阅读http://blog.csdn.net/u010257584/article/details/56278009点击打开链接,关于Nagios的其他内容请关注作者陆续更新! 1. ...

  9. nagios监控安装配置文档+139邮箱报警

    Linux+apache+mysql+php+nagios监控服务搭建 参考了很多文档总结出来的一个比较完整的nagios服务的搭建: nagios是一款开源监控软件,运行在LINUX/UNIX平台, ...

最新文章

  1. mysql dump 参数_mysqldump常用参数
  2. centos 删除crontab_centos crontab(定时任务) 使用
  3. 华裔教授教你写论文2.引言的逻辑解析
  4. 《Drupal实战》——1.4 常见配置
  5. 编译原理笔录(1)-编译程序基本构成
  6. 【实战 Ids4】║ 控制台密码模式搭配Ocelot网关
  7. LeetCode 1390. 四因数
  8. java 双重检查锁 有序_Java中的双重检查锁(double checked locking)
  9. easyui使用心得
  10. python操作各种excel库
  11. require('module') 是什么?
  12. 程序员,建立你的商业意识
  13. js设置radio单选框值选中
  14. 基于mvc架构的劳务管理系统
  15. Java常用类--日期时间相关的类
  16. 快速了解 CMYK印刷色与三原色,CMY三原色为什么要加K黑色?
  17. 整合NGFW和威胁分析后,防火墙这是要上天?
  18. 需要达到什么水平才能找到一份计算机实习?
  19. 如何修改大商创头部色调
  20. python爬取淘宝销量_python爬取淘宝排名

热门文章

  1. Go 的新关键字 any 是个啥
  2. 【Spring源码】AOP切面源码
  3. DFS走迷宫问题(非最短路径)
  4. 浅析ReentrantLock重入锁
  5. Free Mybatis plugin
  6. 值得一生收藏的网站资源 没用过就太可惜了
  7. vtkSuperquadricSource:创建以原点为中心的多边形超二次曲面
  8. 需求迭代:迭代需求矩阵
  9. Linux第三方软件仓库
  10. ASP.NET MVC +EasyUI 权限设计(三)基础模块