`
walsh
  • 浏览: 431456 次
  • 性别: Icon_minigender_1
  • 来自: 郑州
社区版块
存档分类
最新评论

Nagios实践之路(三)—-Nagios基本平台的安装

阅读更多
Nagios基本平台的安装

           这里所说的基础平台安装是指Nagios软件包的安装,它是监控体系的框架,也是所有监控的基础。
        首先到官方网站(http://www.nagios.org/)去下载最新的nagios软件包,本文中使用的是nagios-3.0.5.tar.gz 。顺便把官方文档也下载下来,以备不时之需。
        你安装Nagios平台的环境必须是Linux或是Unix系统。所以以下的操作都是在该系统中进行。本人使用的系统是SUSE 企业版 10.0。里面本来已经有Apache和Nagios安装包,可为了使用上的方便,所以就自己重装了这两个东西。下面就开始我们的Nagios的安装之旅吧。。。。

1) Create Account Information
Become the root user.
引用
# su -l

Create a new nagios user account and give it a password.
引用
#/usr/sbin/useradd -m nagios
#passwd nagios


Create a new nagios group. Add the nagios user to the group.
引用
#/usr/sbin/groupadd nagios
#/usr/sbin/usermod -G nagios nagios
#/usr/sbin/usermod -G nagios apache2 //apache2是在Apache2的时候你设置的用户名


2)Download the source code tarballs of both Nagios and the Nagios plugins (visit
http://www.nagios.org/download/ for links to the latest versions). At the time of writing, the latest
versions of Nagios and the Nagios plugins were 3.0.5 and 1.4.11, respectively.
引用
#wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.5.tar.gz
#wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz



3) Compile and Install Nagios
进入nagios-3.0.5.tar.gz所在的目录
引用
#tar zxvf nagios-3.0.5.tar.gz
#cd nagios-3.0.5

Run the Nagios configure script, passing the name of the group you created earlier like so:
引用
#./configure --with-command-group=nagcmd

Compile the Nagios source code.
引用
#make all

Install binaries, init script, sample config files and set permissions on the external command directory.
#make install  // - This installs the main program, CGIs, and HTML files
引用
#make install-init  //- This installs the init script in /etc/rc.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/nag ios/etc



注意:Don’t start Nagios yet - there’s still more that needs to be done...

4) Customize Configuration
Sample configuration files have now been installed in the  /usr/local/nagios/etc directory. These sample  files should work fine for getting started with Nagios. You’ll need to make just one change before you
proceed...
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving  alerts.
引用
#vi /usr/local/nagios/etc/objects/contacts.cfg  //更改email地址nagiosadmin的联系人定义信息中的EMail信息为你的EMail信息以接收报警内容。


5) Configure the Web Interface
Install the Nagios web config file in the Apache conf.d directory.
引用
#make install-webconf  //- This installs the Apache config file for the Nagios web interface


Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you
assign to this account - you’ll need it later.
引用
#/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

输入密码(这一步很重要)
注:此处输入的用户名和密码也就是管理员登录Web界面的时候要输入的用户名和密码。

Restart Apache to make the new settings take effect.
引用
# /etc/init.d/apachectl restart


6) Compile and Install the Nagios Plugins
Extract the Nagios plugins source code tarball.
进到nagios-plugins-1.4.11.tar.gz所在的目录
引用
#tar xzf nagios-plugins-1.4.11.tar.gz
#cd nagios-plugins-1.4.11

Compile and install the plugins.
引用
#./configure --with-nagios-user=nagios --with-nagios-group=nagios
#make
#make install


7) Start Nagios
Add Nagios to the list of system services and have it automatically start when the system boots.
引用
#chkconfig --add nagios
#chkconfig nagios on

Verify the sample Nagios configuration files.
引用
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios.
引用
#/usr/local/nagios/bin/nagios start


注:也可以将该服务设置为开启自动运行,方法:
 
引用
# cp /usr/local/nagios/bin/nagios /etc/init.d
  # chmod 755 /etc/init.d/nagios


8)编辑apache 的httpd.conf最后面添加:
引用
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>


9)再验证下
引用
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

没有出错的话!
重新启动nagios和apache

10) Login to the Web Interface
You should now be able to access the Nagios web interface at the URL below. You’ll be prompted for the username (nagiosadmin) and password you specified earlier.
http://localhost/nagios/
Click on the "Service Detail" navbar link to see details of what’s being monitored on your local machine.
It will take a few minutes for Nagios to check all the services associated with your machine, as the
checks are spread out over time.


分享到:
评论

相关推荐

    nagios安装和配置全过程

    - 解压缩nagios-plugins-1.4.9.tar.gz,配置并编译插件,确保所有插件被安装到正确的位置,如/usr/local/nagios/libexec。 - 如果在配置阶段遇到问题,可能需要添加特定的参数,例如`--enable-redhat-pthread-work...

    nagios 中文帮助文档+nagios-3.3.2.tar.gz

    - **源码编译**:使用`tar -zxvf nagios-3.3.2.tar.gz`解压,然后进入目录执行`./configure`进行配置,`make`编译,`make install`安装。 - **配置文件**:修改`/etc/nagios/nagios.cfg`等配置文件,定义主机、服务...

    Nagios企业级监控部署最佳实践

    Nagios的核心部分仅提供了基本的监控功能,因此需要安装额外的插件来实现更加完善的监控。插件可以从Nagios官网下载,也可以根据具体需求自行编写。Nagios必须运行在Linux/Unix平台上,而且它还提供了一个Web监控...

    nagios配置全攻略

    在这个例子中,实验环境有三台主机:一台运行Red Hat 9的Nagios-server(192.168.0.111)作为监控机,两台分别运行Red Hat 9和Windows XP的dbpi和yahoo作为被监控机。监控机安装Nagios软件,处理监控数据并提供Web...

    Nagios系统监控实践(第2版)

    本书详细介绍了Nagios的基本概念、安装配置、监控对象的定义、插件的使用、报警机制以及性能优化等方面的知识。以下是其中的关键知识点: 1. **Nagios概述**:Nagios的核心功能包括服务监控、主机监控、网络监控和...

    Nagios系统监控实践

    nagios系统监控实践,nagios告警在大数据领域用得比较多

    nagios-3.0.3.tar.gz

    `nagios-3.0.3.tar.gz`是一个压缩包文件,其中包含了Nagios 3.0.3版本的所有源代码和相关文档,用户可以通过编译源代码在本地系统上安装和配置Nagios。 首先,让我们详细了解一下Nagios的核心功能和特点: 1. **...

    nagios安装文档.doc

    在被监控主机上,安装NRPE和Nagios-plugins,配置NRPE以允许监控主机连接并执行远程检查。 对于监控数据的可视化,PNP4Nagios提供了强大的性能图表功能。下载并解压PNP4Nagios,按照官方文档的指引进行编译和安装,...

    Nagios Core Administration Cookbook

    Nagios是一款开源的网络监控工具,用于监控网络中各种服务和主机的状态。其核心产品Nagios Core,能够实现对计算机系统、网络和...对于希望深入学习和实践Nagios Core的系统管理员来说,这是一本不可多得的参考书籍。

    nagios完全详解监控系统[参照].pdf

    Nagios的强大之处还在于其高度的可扩展性。通过编写自定义插件,可以监控几乎任何类型的服务,包括HTTP、SMTP、DNS、FTP等。此外,Nagios社区提供了大量的插件和模板,使得系统监控更加灵活和全面。 总的来说,...

    nagios全套安装包和配置教程

    这涉及到在远程服务器上安装`nagios-plugins`和`nrpe`,以及在Nagios主服务器上配置NRPE客户端。 8. 创建插件:Nagios通过插件检查服务状态。安装如`check_http`,`check_disk`等基本插件,并确保它们可执行。 9. ...

    搭建nagios监控服务器最佳实践

    搭建Nagios监控服务器,首先需要在Linux环境下安装Nagios核心以及相关的插件。搭建过程中,需要配置主机和服务的定义文件,确定监控对象,设定阈值,以及设置通知方式等。而搭建完成后,将通过Nagios Web界面展示被...

    nagios-install.rar_nagios_nagios install.txt_网络监控

    - **插件**:Nagios的强大之处在于其丰富的插件生态,能监控各种网络设备和服务。 四、Nagios的进一步优化 1. **资源分配**:合理分配Nagios服务器的硬件资源,如内存、CPU和磁盘空间,以应对大量监控数据的处理。 ...

    开源监控利器nagios实战

    1. **基本概念**:Nagios由Nagios Core(主程序)和Nagios Plugins(插件)组成。Core负责整体调度和报警,而Plugins则执行具体的检查任务,两者协同工作实现全面监控。 2. **监控范围**:Nagios可监控硬件状态、...

    nagios core 指南

    ### Nagios Core 指南:全面解析安装、配置与监控 #### 一、Nagios Core概述 Nagios Core是一款开源的网络监控系统,主要用于监控计算机服务器、网络设备和其他IT基础设施的状态。通过Nagios Core,可以实时监控...

Global site tag (gtag.js) - Google Analytics