centos nagios 安装如何添加被监控?

当前访客身份:游客 [
问,也要问出个世界!!!
:写得相当详细,学习了!!
:话说看ruby干啥?还得用这个?
:引用来自“伊森”的评论 搭起来了?比nagios如何...
:搭起来了?比nagios如何?
:引用来自“抢小孩糖吃”的评论 如果没买redhat服...
:如果没买redhat服务,建议使用centos,外网yum还...
:明日复明日,明日何其多。。
:引用来自“枫爱若雪”的评论 引用来自“伊森”的...
:引用来自“伊森”的评论 引用来自“伊森”的评论...
:引用来自“伊森”的评论领导让转到windowserver服...
今日访问:22
昨日访问:34
本周访问:383
本月访问:1484
所有访问:38643
Centos 6.2 nagios监控服务器集群 系列之安装篇
发表于2年前( 21:21)&&
阅读(108)&|&评论()
0人收藏此文章,
& & & 回想当年,不知道如何安装nagios,不知道如何监控windows,不知道如何监控网络设备(linux),网上的教程一车一车的....最终,我现在可以进行服务器监控,并且配置了pnp,道路艰辛,为各位同僚抛砖引玉了....
& & & &安装:我用的系统是Centos,所以所有步骤都基于此系统,其他的没有尝试过....
& & & 安装相关编译环境:
yum install httpd
yum install gcc
yum install glibc glibc-common
yum install gd gd-devel
yum install php(此为图形化界面必须)
创建用户:
/usr/sbin/useradd nagios
设置密码:
passwd nagios
此处设为nagiospasswd
创建一个用户组名为nagcmd用于从Web接口执行外部命令。将nagios用户和apache用户都加到这个组中。(此处网上参考均如此,保险起见,不做修改)
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
/usr/sbin/usermod -G nagcmd apache
创建文件夹:
mkdir download
cd download
下载相关软件:
nagios-3.3.1.tar.gz以及nagios-plugins-1.4.15.tar.gz
下载地址官网就有最新的,找不到留言给我...
tar xzf nagios-3.3.1.tar.gz
./configure --with-command-group=nagcmd
& make all
make install
make install-init
make install-config
make install-commandmod
vi /usr/local/nagios/etc/objects/contacts.cfg
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
创建密码和用户
设置密码为nagiospasswd
下面编译安装插件
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make install
chkconfig --add nagios
chkconfig nagios on
验证Nagios的样例配置文件
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start
更改SELinux设置
setenforce 0
如果想发送邮件还要启动邮件服务:
service sendmail start
此处还要修改http.conf 增加index.php
现在我们再配置一下才可以收到邮件
cd /usr/local/nagios/etc/objects/
localhost.cfg
将notifications_enabled 设为1
重启nagios
service nagios restart
我在安装的时候报错:
&tail nagios.log
&Error: Could not create external command file '/usr/local/nagios/var/rw/nagios.c md' as named pipe: (2) -& No such file or directory.& If this file already exists and you are
进入/usr/local/nagios/var目录,原来没有rw目录,启动nagios无法写入文件,
手动解决吧:
#chown -R nagios.nagios rw/
#chmod 777 -R rw/
给入全局权限
#service nagios start
至此,nagios初步安装成功,可以监控本机了,记得把80端口看看,如果你不想麻烦,直接service iptables stop 然后通过访问你服务器的ip地址/nagios即可访问,输入账号密码 nagiosadmin/nagiospasswd即可
若文中有任何不妥或者错误之处,请不吝zhichu
1)">1)">1" ng-class="{current:{{currentPage==page}}}" ng-repeat="page in pages"><li class='page' ng-if="(endIndex<li class='page next' ng-if="(currentPage
相关文章阅读畅游网络,点滴积累,享受交流、分享知识的快乐
一.准备工作
安装之前先将安装过程中会用到的一些服务和软件安装好
# yum install httpd httpd-devel php
# yum install gcc glibc glibc-common
# yum install gd gd-devel
二.安装Nagios软件
创建nagios用户并设置密码:
# /usr/sbin/useradd -m nagios
# passwd nagios
密码其实不设置也行,因为基本上不会通过该用户来登陆。bash也可以直接设置成/sbin/nolgoin。
接下来我们创建nagcmd用户组以执行来自web接口的命令,并添加nagios和apache用户到此用户组。
# /usr/sbin/groupadd nagcmd
# /usr/sbin/usermod -a -G nagcmd nagios
# /usr/sbin/usermod -a -G nagcmd apache
下载Nagios和插件
# wget http://iweb.dl.sourceforge.net/project/nagios/nagios-3.x/nagios-3.4.1/nagios-3.4.1.tar.gz
# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
安装Nagios
# tar xzf nagios-3.4.1.tar.gz
# cd nagios
运行Nagios配置脚本,并把nagcmd更改为之前所创建的组:
# ./configure &#8211;with-command-group=nagcmd
# make all
安装二进制,init脚本,sample配置文件和设置外部命令目录权限。
# make install
# make install-init
# make install-commandmode
联系人信息配置
#vi /usr/local/nagios/etc/objects/contacts.cfg
修改联系人邮箱等
配置web接口
安装Nagios Web配置文件在Apache的conf.d目录:
# make install-webconf
为登录Nagios Web接口创建nagiosadmin帐号和密码。
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
# service httpd restart
编译安装Nagios插件
# tar xzf nagios-plugins-1.4.14.tar.gz
# cd nagios-plugins-1.4.16
# ./configure &#8211;with-nagios-user=nagios &#8211;with-nagios-group=nagios
# make install
启动Nagios
设置开机启动:
# chkconfig &#8211;add nagios
# chkconfig nagios on
测试配置文件是否有错误:
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
启动nagios
# service nagios start
登陆Nagios
# http://192.168.0.245/nagios
账号和密码即上面设置的。Nagios监控页面截图如下:
网络任我行()原创,转载请注明出处珏石头 的BLOG
用户名:珏石头
文章数:110
评论数:304
访问量:277078
注册日期:
阅读量:30934
阅读量:1964
阅读量:738
阅读量:6053
51CTO推荐博文
配置 Nagios 监控 Oracle 服务器
环境:Oracle 10g
CentOS 5.4
一、在 Oracle 所在服务器上安装 NRPE
1.安装过程参考 Nagios NRPE 文档。
[root@ora etc]# grep -v &#& nrpe.cfg
log_facility=daemon
pid_file=/var/run/nrpe.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=192.168.0.200
dont_blame_nrpe=0
command_timeout=60
connection_timeout=300
2.给 oracle 用户在 ORACLE_HOME 目录下执行权限。
[oracle@ora ~]$ chmod -Rf 740 ${ORACLE_HOME}
3.修改 check_oracle 脚本。将 $ORACLE_HOME 以及 $PATH 手动加入,避免出现问题。
[oracle@ora ~]$ echo ${ORACLE_HOME}
/u01/oracle/database/10.2.0/db_1
[oracle@ora ~]$ echo ${PATH}
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/u01/oracle/bin:/u01/oracle/database/10.2.0/
db_1/bin:.
这么做是为了确保脚本可以正常执行 sqlplus 以及 tnsping 等命令
二、配置 nrpe 服务
在nrpe.conf文件末尾加入如下内容
#Check Oracle
command[check_oracle_tns]=/usr/local/nagios/libexec/check_oracle --tns orcl
command[check_oracle_db]=/usr/local/nagios/libexec/check_oracle --db orcl
command[check_oracle_login]=/usr/local/nagios/libexec/check_oracle --login orclc
command[check_oracle_tablespace]=/usr/local/nagios/libexec/check_oracle --tables
pace orcl system lkjsdf tab 90 80
具体参数写法请参考 check_oracle --help
重启nrpe进程
[root@ora etc]# killall nrpe
[root@ora etc]# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg Cd
三、配置 Nagios 服务端
在 nagios/etc/objects 添加oracle 主机配置文件,orac.cfg。
44 #add oracle database moniter service by jadeshow
45 define service {
46&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; use&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; generic-service
47&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; host_name&#160;&#160;&#160;&#160;&#160;&#160; database
48&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; service_description&#160;&#160;&#160;&#160; TNS Check
49&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; check_command&#160;&#160; check_nrpe!check_oracle_tns
50&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
51 define service {
52&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; use&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; generic-service
53&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; host_name&#160;&#160;&#160;&#160;&#160;&#160; database
54&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; service_description&#160;&#160;&#160;&#160; DB Check
55&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; check_command&#160;&#160; check_nrpe!check_oracle_db
56&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
58 define service {
59&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; use&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; generic-service
60&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; host_name&#160;&#160;&#160;&#160;&#160;&#160; database
61&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; service_description&#160;&#160;&#160;&#160; Login Check
62&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; check_command&#160;&#160; check_nrpe!check_oracle_login
63&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
66 define service {
67&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; use&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; generic-service
68&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; host_name&#160;&#160;&#160;&#160;&#160;&#160; database
69&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; service_description&#160;&#160;&#160;&#160; Tablespace Check
70&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; check_command&#160;&#160; check_nrpe!check_oracle_tablespace
71&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
4.验证配置文件无误后重启 nagios 服务
[root@june objects]# nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios 3.1.0
Copyright (c)
Ethan Galstad (
Last Modified: 01-25-2009
License: GPL
Reading configuration data...
&#160;&#160; Read main config file okay...
Processing object config file '/usr/local/nagios//etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios//etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios//etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios//etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios//etc/objects/test.cfg'...
Processing object config file '/usr/local/nagios//etc/objects/server1.cfg'...
Processing object config file '/usr/local/nagios//etc/objects/server2.cfg'...
Processing object config file '/usr/local/nagios//etc/objects/orac.cfg'...
Processing object config file '/usr/local/nagios//etc/objects/localhost.cfg'...
&#160;&#160; Read object config files okay...
Running pre-flight check on configuration data...
Checking services...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 38 services.
Checking hosts...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 5 hosts.
Checking host groups...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 2 host groups.
Checking service groups...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 0 service groups.
Checking contacts...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 1 contacts.
Checking contact groups...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 1 contact groups.
Checking service escalations...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 0 service escalations.
Checking service dependencies...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 0 service dependencies.
Checking host escalations...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 0 host escalations.
Checking host dependencies...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 0 host dependencies.
Checking commands...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 25 commands.
Checking time periods...
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors:&#160;&#160; 0
Things look okay - No serious problems were detected during the pre-flight check
[root@june objects]#
5.重新启动nagios服务
[root@june objects]# service nagios restart
Running configuration check...done.
Stopping nagios: done.
Starting nagios: done.
[root@june objects]#
四、验证nagios的oracle服务
oracle数据库监控如图
多吃东西多喝水,
少玩游戏少睡觉! -------
望月飞鱼(珏石头)
了这篇文章
类别:┆阅读(0)┆评论(0)
14:53:33 15:10:51 15:11:01 &&1&
&&页数 ( 1/3 ) &

我要回帖

更多关于 centos 添加网卡 的文章

 

随机推荐