xymon 网络监控 - 2011

更新时间:2023-09-09 22:26:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

下面开始在CentOS上安装Xymon Server, 本部分内容参考了Xymon的官方安装说明:http://www.xymon.com/hobbit/help/install.html 以及网上搜到另一份教

程:http://en.wikibooks.org/wiki/System_Monitoring_with_Xymon/Administration_Guide/Compiling_on_CentOS

安装Apache Http 服务。

http://labs.renren.com/apache-mirror//httpd/mod_fcgid/mod_fcgid-2.3.6.tar.gz

1. 登入系统,用户名:root 再输入安装系统设置的密码,登入成功后进入命令操作状态;

login as: root root@192.168.1.50's password: Last login: Mon Dec 14 14:29:51 2009 from 192.168.1.2 [root@xymonsvr ~]# 2. 这里有一点小问题, 当时安装OS时选择的语言是简体中文, 在通过终端操作时可能会出现乱码, 在这里把语言改成美国英语,如安装系统时选择是的英语则略过此步;

[root@xymonsvr ~]# echo $LANG #查看当前默认语言 zh_CN.UTF-8 [root@xymonsvr ~]# echo 'LANG=\#更改默认语言为美国英语 [root@xymonsvr ~]# echo $LANG #再次查看当前默认语言,可以看到已经变成美国英语 en_US.UTF-8 3. 添加rpmforge软件源;

[root@xymonsvr ~]# wget http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm #下载安装文件 [root@xymonsvr ~]# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt #导入验证文件 [root@xymonsvr ~]# rpm -K rpmforge-release-0.3.6-1.el5.rf.i386.rpm [root@xymonsvr ~]# rpm -i rpmforge-release-0.3.6-1.el5.rf.i386.rpm #安装 4. 下载Xymon的源代码文件包备用,这里我们下载的是最新的稳定版,

[root@xymonsvr ~]# wget http://ncu.dl.sourceforge.net/project/xymon/Xymon/4.3.7/xymon-4.3.7.tar.gz --15:08:54-- http://ncu.dl.sourceforge.net/project/xymon/Xymon/4.3.7/xymon-4.3.7.tar.gz http://sourceforge.net/projects/xymon/files/Xymon/4.2.3/xymon-4.2.3.tar.gz http://ncu.dl.sourceforge.net/project/xymon/Xymon/4.3.7/xymon-4.3.7.tar.gz Resolving ncu.dl.sourceforge.net... 140.115.17.45 Connecting to ncu.dl.sourceforge.net|140.115.17.45|:80... connected.yumi HTTP request sent, awaiting response... 200 OK Length: 2313567 (2.2M) [application/x-gzip] Saving to: `xymon-4.2.3.tar.gz' 10% [===> ] 253,933 24.2K/s eta 85s <以下省略> 5. 安装Xymon需要用到的组件,这里通CentOS的软件管理软件yum从软件源直接下载并安装;

[root@xymonsvr ~]# yum install fping #安装fping Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile ?<中间省略>... Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 40 k Is this ok [y/N]: y #输入y确认安装 Downloading Packages: fping-2.4-1.b2.2.el5.rf.i386.rpm | 40 kB 00:02 ?<中间省略>... Installed: fping.i386 0:2.4-1.b2.2.el5.rf Complete! [root@xymonsvr ~]# yum install rrdtool-devel #安装rrdtool-devel Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * rpmforge: fr2.rpmfind.net * base: ftp.isu.edu.tw * updates: ftp.isu.edu.tw * addons: ftp.isu.edu.tw * extras: mirrors.163.com Setting up Install Process ?<中间省略>... Install 5 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 2.8 M Is this ok [y/N]: y #输入y确认安装 Downloading Packages: (1/5): rrdtool-devel-1.3.8-2.el5.rf.i386.rpm | 6.8 kB 00:00 (2/5): perl-rrdtool-1.3.8-2.el5.rf.i386.rpm | 51 kB 00:01 (3/5): ruby-1.8.5-5.el5_3.7.i386.rpm | 274 kB 00:14 (4/5): rrdtool-1.3.8-2.el5.rf.i386.rpm | 913 kB 00:16 (5/5): ruby-libs-1.8.5-5.el5_3.7.i386.rpm | 1.6 MB 01:56 ?<中间省略>... Installed: rrdtool-devel.i386 0:1.3.8-2.el5.rf Dependency Installed: perl-rrdtool.i386 0:1.3.8-2.el5.rf rrdtool.i386 0:1.3.8-2.el5.rf ruby.i386 0:1.8.5-5.el5_3.7 ruby-libs.i386 0:1.8.5-5.el5_3.7 Complete! [root@xymonsvr ~]# yum install pcre-devel #安装pcre Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * rpmforge: fr2.rpmfind.net * base: mirror.centos.net.cn * updates: mirror.centos.net.cn * addons: mirror.centos.net.cn * extras: mirror.centos.net.cn Setting up Install Process ?<中间省略>... Total download size: 176 k Is this ok [y/N]: y #输入y确认安装 Downloading Packages: pcre-devel-6.6-2.el5_1.7.i386.rpm | 176 kB 02:44 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : pcre-devel [1/1] Installed: pcre-devel.i386 0:6.6-2.el5_1.7 Complete! 6. 创建一个用户:xymon 以用于运行Xymon Monitor Server;

[root@xymonsvr ~]# useradd xymon #创建用户 [root@xymonsvr ~]# passwd xymon #创建密码(无密码将无法登入) Changing password for user xymon. New UNIX password: #输入一个密码吧 BAD PASSWORD: it is too simplistic/systematic #说密码太简单?无视 Retype new UNIX password: #再输入一次 admin@123 passwd: all authentication tokens updated successfully. 7. OK,万事俱备, 开始动手安装了, 解压缩源代码

[root@xymonsvr ~]# tar -zxvf xymon-4.2.3.tar.gz 8. 查看一下当前目录, 多了一个\的文件夹哦, 进去;

[root@xymonsvr ~]# ll #查看当前目录中的文件和文件的详细信息,等于ls -l total 2340 -rw------- 1 root root 1308 Dec 4 04:40 anaconda-ks.cfg -rw-r--r-- 1 root root 26738 Dec 4 04:40 install.log -rw-r--r-- 1 root root 4740 Dec 4 04:39 install.log.syslog -rw-r--r-- 1 root root 16698 Mar 9 2007 rpmforge-release-0.3.6-1.el5.rf.i386.rpm drwxr-xr-x 15 xymon xymon 4096 Dec 14 16:08 xymon-4.2.3 -rw-r--r-- 1 root root 2313567 Feb 22 2009 xymon-4.2.3.tar.gz [root@xymonsvr ~]# cd xymon-4.2.3 #切换目录到xymon-4.2.3 [root@xymonsvr xymon-4.2.3]# #提示符变咯 9. 运行\检验系统环境,生成Makefile

[root@xymonsvr xymon-4.2.3]# ./configure #运行configure,一定要加./ 因为当前目录没有加入至系统的环境变量 Configuration script for Xymon This script asks a few questions and builds a Makefile to compile Xymon Checking your make-utility Checking pre-requisites for building Xymon Checking for fping ... Hobbit has a built-in ping utility (hobbitping) However, it is not yet fully stable and therefore it may be best to use the external fping utility instead. I found fping in /usr/sbin/fping Do you want to use it [Y/n] ? #输入y确认 y Checking to see if '/usr/sbin/fping 127.0.0.1' works ... 127.0.0.1 is alive ?<中间省略>... Checking for RRDtool ... ?<中间省略>... Do you want to be able to test SSL-enabled services (y) ? #输入y确认 y Checking for LDAP ... Found LDAP include files in /usr/include Found LDAP libraries in /usr/lib Xymon can use your OpenLDAP LDAP client library to test LDAP servers. Do you want to be able to test LDAP servers (y) ? #输入y确认 y Enable experimental support for LDAP/SSL (OpenLDAP 2.x only) (y) ? #回车应用默认值 Checking for clock_gettime() requiring librt ... clock_gettime() requires librt Checking for Large File Support ... Large File Support OK Setting up for a Xymon server What userid will be running Xymon [xymon] ? #回车应用默认值 Found passwd entry for user xymon:x:500:500::/home/xymon:/bin/bash Where do you want the Xymon installation [/home/xymon] ? #回车应用默认值 OK, will configure to use /home/xymon as the Xymon toplevel directory What URL will you use for the Xymon webpages [/xymon] ? #回车应用默认值 Where to put the Xymon CGI scripts [/home/xymon/cgi-bin] ? #回车应用默认值 (Note: This is the filesystem directory - we will get to the URL shortly) What is the URL for the Xymon CGI directory [/xymon-cgi] ? #回车应用默认值 (Note: This is the URL - NOT the filesystem directory) ?<中间省略>... Where to put the Xymon Administration CGI scripts [/home/xymon/cgi-secure] ? #回车应用默认值 (Note: This is the filesystem directory - we will get to the URL shortly) What is the URL for the Xymon Administration CGI directory [/xymon-seccgi] ? #回车应用默认值 (Note: This is the URL - NOT the filesystem directory) ** Note that you may need to modify your webserver configuration. ** After installing, see /home/xymon/server/etc/hobbit-apache.conf for an example configuration. To generate Xymon availability reports, your webserver must have write-access to a directory below the Xymon top-level directory. I can set this up if you tell me what group-ID your webserver runs with. This is typically 'nobody' or 'apache' or 'www-data' What group-ID does your webserver use [nobody] ? #回车应用默认值 Where to put the Xymon logfiles [/var/log/xymon] ? #回车应用默认值

What is the name of this host [xymonsvr.contoso.com] ? #s输入你的网络域名test.com What is the IP-address of this host [127.0.0.1] ? 192.168.198.128 #输入当前Server的IP Where should I install the Xymon man-pages (/usr/local/man) ? #回车应用默认值 Using Linux Makefile settings Created Makefile with the necessary information to build Xymon Some defaults are used, so do look at the Makefile before continuing. Configuration complete - now run make (GNU make) to build the tools 10. 运进make进行编译, 此过程约需5,6分钟;

[root@xymonsvr xymon-4.2.3]# make ?<中间省略>... Build complete. Now run 'make install' as root 11. 编译好后, 输入make install进行安装;

[root@xymonsvr xymon-4.2.3]# make install ?<中间省略>... Installation complete. You must configure your webserver for the Hobbit webpages and CGI-scripts. A sample Apache configuration is in /home/xymon/server/etc/hobbit-apache.conf If you have your Administration CGI scripts in a separate directory, then you must also setup the password-file with the htpasswd command. To start Hobbit, as the xymon user run '/home/xymon/server/bin/hobbit.sh start' To view the Hobbit webpages, go to http://xymonsvr.contoso.com/xymon 12. 设置Apache (Web service)开机自动启动;

[root@xymonsvr ~]# chkconfig httpd on [root@xymonsvr ~]# chkconfig --list httpd #查看httpd启动状态,可以看到runlevel为on,设定成功 httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off 13. 将Xymon Monitor Server的配置文件添加Apache配置文件的底部, 重启httpd生效

[root@xymonsvr ~]# cat /home/xymon/server/etc/hobbit-apache.conf >>/etc/httpd/conf/httpd.conf #添加配置文件 如果是4.3.7版本的文件是xymon-apache.conf [root@xymonsvr ~]# /etc/init.d/httpd restart #重启服务 Stopping httpd: [ OK ] Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using xymonsvr.contoso.com for ServerName [ OK ] 14. 修改xymon主目录权限, 否则网页将无法访问;

[root@xymonsvr ~]# chmod 755 /home/xymon #更改权限 [root@xymonsvr home]# ll –d /home/xymon #查看,可以看到other的权限有读和执行 drwxr-xr-x 8 xymon xymon 4096 Dec 14 16:14 xymon 我这里看到是9 注意修改httpd.conf配置文件 大约在1021行 [root@localhost /]# ls

bin cgroup etc lib media opt root selinux sys usr boot dev home lost+found mnt proc sbin srv tmp var [root@localhost /]# cd /etc/httpd/conf [root@localhost conf]# ls httpd.conf magic

[root@localhost conf]#vim httpd.conf #切换到大约1021行

取消DocumentRoot /home/xymon/server/www 前面的“#”号

15. 切换到xymon用登入并进入Xymon的安装目录运行服务端;

[root@xymonsvr ~]# su – xymon #切换到xymon [xymon@xymonsvr ~]$ cd server [xymon@xymonsvr server]$ ls bin download etc ext hobbit.sh tmp web www [xymon@xymonsvr server]$ ./hobbit.sh start #启动服务端,一定要加./ 原因同前 Hobbit started 注意:如果是4.3.7的版本,hobbit.sh 应该是xymon.sh,所以要执行./xymon.sh start 注意,要修改Centos的安全等级,使用文本编辑工具打开 /etc/selinux/config

把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:SELINUX=disabled

保存,关闭。重启系统。

执行setup 关闭防火墙。

16. OK了, 找一台可能访问到xymonsvr的电脑打开浏览器访问网页检验成果, 我这里在

gw.contoso.com将xymonsvr的80端口映射出来了, 所以直接在宿主机上访问所以我的访问地址为gw.contoso.com 的outside网卡的地址, 当然用虚拟机访问也可以.

因为还没有安装任何客户端,所以只看Server自已.绿色的笑脸表示正常,黄色就是警告,红色就是报警咯; 各个图标还可以点开查看详情哦,下面是对各个项目的解释:

? ? ? ? ? ? ? ?

bbd 表示Xymon网络服务的可用性.

bbgen表示bbgen tool的状态, 它是用来更新网页的.

bbtest表示bbtest-net 的状态, 它是用来执行Xymon中配置的所有网络测试. conn是对主机的Ping测试.

hobbitd是表示Xymon服务的状态. http是HTTP-Server的运行状态

info包含此主机在Xymon中的配置, 例如IP地址等. trends包含此主所有状态的曲线图.

17. 最后我们设置Xymon能够开机自启动, 这样就不用每次手机启动hobbit.sh了;

[root@xymonsvr ~]# cd /etc/init.d #进入/etc/init.d [root@xymonsvr init.d]# wget http://iam8up.com/xymon-initd/hobbit #到网上下一个别人写好的脚本 [root@xymonsvr init.d]# vim hobbit #使用vim打开它编辑,vim不熟悉的同学也可用\#将以下三行改成如下所示 ?<省略>... STARTBIN=xymon.sh STARTDIR=/home/xymon/server/ USERNAME=xymon ?<以下省略>... [root@xymonsvr init.d]# chmod 755 hobbit #修改它的权限,让它可执行 [root@xymonsvr init.d]# ln -s /etc/init.d/hobbit /etc/rc3.d/S70hobbit #创建一个软链接(快捷方式)到的启动目录 [root@xymonsvr init.d]# init 6 #重启Server

本文来源:https://www.bwwdw.com/article/uqlh.html

Top