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

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

1) Create Account Information
Become the root user.
[quote]# su -l[/quote]
Create a new nagios user account and give it a password.
[quote]#/usr/sbin/useradd -m nagios
#passwd nagios[/quote]

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

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.
[quote]#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[/quote]


3) Compile and Install Nagios
进入nagios-3.0.5.tar.gz所在的目录
[quote]#tar zxvf nagios-3.0.5.tar.gz
#cd nagios-3.0.5[/quote]
Run the Nagios configure script, passing the name of the group you created earlier like so:
[quote]#./configure --with-command-group=nagcmd [/quote]
Compile the Nagios source code.
[quote]#make all[/quote]
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
[quote]#make install-init //- This installs the init script in /etc/rc.d[/quote]
[quote]#make install-commandmode //- This installs and configures permissions on the directory for holding the external command file[/quote]
[quote]#make install-config //- This installs *SAMPLE* config files in /usr/local/nag ios/etc[/quote]


[color=red]注意:[/color]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.
[quote]#vi /usr/local/nagios/etc/objects/contacts.cfg //更改email地址nagiosadmin的联系人定义信息中的EMail信息为你的EMail信息以接收报警内容。[/quote]

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

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you
assign to this account - you’ll need it later.
[quote]#/usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin[/quote]
[color=red]输入密码(这一步很重要)[/color]
[color=red]注:此处输入的用户名和密码也就是管理员登录Web界面的时候要输入的用户名和密码。[/color]

Restart Apache to make the new settings take effect.
[quote]# /etc/init.d/apachectl restart[/quote]

6) Compile and Install the Nagios Plugins
Extract the Nagios plugins source code tarball.
进到nagios-plugins-1.4.11.tar.gz所在的目录
[quote]#tar xzf nagios-plugins-1.4.11.tar.gz
#cd nagios-plugins-1.4.11[/quote]
Compile and install the plugins.
[quote]#./configure --with-nagios-user=nagios --with-nagios-group=nagios
#make
#make install[/quote]

7) Start Nagios
Add Nagios to the list of system services and have it automatically start when the system boots.
[quote]#chkconfig --add nagios
#chkconfig nagios on[/quote]
Verify the sample Nagios configuration files.
[quote]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg[/quote]
If there are no errors, start Nagios.
[quote]#/usr/local/nagios/bin/nagios start[/quote]

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

8)编辑apache 的httpd.conf最后面添加:
[quote]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>[/quote]

9)再验证下
[quote]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg[/quote]
没有出错的话!
重新启动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.
[url]http://localhost/nagios/[/url]
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.
[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
水利改革发展 中国政府高度重视水利建设,将水利作为国家基础设施建设的优先领域。政策文件强调了防洪抗旱、水资源管理、水环境保护和水生态修复等方面的全面要求,推动了水利信息化的发展。 智慧水利建设目标 智慧水利的建设目标是通过数据共享、应用惠民、应急预警等手段,打破信息孤岛,提升应急抢险协作能力,加强水利数据在惠民信息化方面的应用。同时,提出了共享联动化、解决信息安全问题、提高水利信息科技创新能力等目标。 智慧水利建设模式 智慧水利的建设模式包括构建统一平台、数据中心、信息整合平台、决策支持系统等,以实现水利、海洋、环保等政府部门和公众的信息共享和服务。此外,还包括了云计算虚拟化、网络传输、采集工程等多个方面的技术应用。 智慧水利应用实例 智慧水利的应用实例包括视频水文工程监控、多要素一体化检测设备、汛情预警智能联动、防决策指挥、河长综合信息展示等。这些应用通过集成GIS、互联网地图服务、物联网设备等技术,实现了对水利设施的实时监控、数据分析和应急响应。 成功案例与展望 智慧水利的成功案例展示了通过视频监控、预警信息发布、移动办公信息APP等技术,有效提升了灾害应对能力、水资源管理和河长制的实施效果。这些案例表明,智慧水利的建设不仅提高了水利管理的效率和水平,也为未来的水利信息化发展提供了方向。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值