设为首页收藏本站

LinuxTone | 运维专家网论坛 - 最棒的Linux运维与开源架构技术交流社区!

 找回密码
 注册

用新浪微博连接

一步搞定

QQ登录

只需一步,快速开始

查看: 6595|回复: 12

LVS 状态监控图 [复制链接]

LT管理团队

社区首席勤杂工

Rank: 9Rank: 9Rank: 9

签到
81
注册时间
2008-5-19
最后登录
2012-5-3
在线时间
1762 小时
阅读权限
200
积分
14979
帖子
2524
主题
1200
精华
25
UID
1

LT总司令

发表于 2008-10-22 14:45:23 |显示全部楼层
官方网站: http://tepedino.org/lvs-rrd/
脚本软件包下载: http://tepedino.org/lvs-rrd/lvs-rrd-v0.7.tar.gz




Setup:
~~~~~~

** Important **
If you are upgrading from earlier than version 0.3 (anyone?)
read the upgrade section below first!
**

You can get the latest version of the script at:
http://tepedino.org/lvs-rrd/

Extract the file to your web root. It will create a directory
called 'lvs-rrd'.

Check the top of both scripts (lvs.rrd.update and graph-lvs.sh)
and change the variables there to match your setup.

Add this line to your crontab (It is no longer necessary to do this
as root, as /proc/net/ip_vs is world readable) changing WEBROOT to
the appropriate path.

* * * * * WEBROOT/lvs-rrd/lvs.rrd.update 2> /dev/null > /dev/null

This update script should collect data from any real servers in the cluster.

Change the permissions on the 'graphs' directory to be writable by your
webserver. It will write the graphs here when the graphing script is
called by PHP. If you're using some other method to display the graphs,
this step may or may not be necessary.

That's it!
You'll have to wait a few minutes to start seeing data, so be patient.

** Upgrading **
~~~~~~~~~~~~~~~

From v0.5 through v0.3 to this version
Because of the addition of the protocol (TCP/UDP) in the rrd file names,
to prevent same port, different protocol problems (Thanks Xavier!), I have
the update script check for old filenames and copy them to the new filename
format. I only copy them as a 'just in case' measure. Once you're satisfied
that it's all working well, you can run:

rm `ls lvs.????????.????.????????.????.???.rrd|cut -f1,2,3,4,5,7 -d.`

to remove your old files. You might notice some files still in the old
file format. These are machines that were in your cluster at one point,
but arn't now (Temporarily down... whatever). You can delete them if they
have no useful data, or just leave them there for when the machine comes
back up, or keep them cause you've grown fond of them. Doesn't matter. The
script will ignore them. There was no change to the actual data contained in
the rrd files, just the naming of them.

Ealier than v0.3:

Some things have changed since versions earlier than 0.3, so you'll need to
make some changes so as to not lose your collected data.

The names of the update script and the rrd files have changed to allow for
more finely grained graphing of the data.

First, (after extracting the scripts to your lvs-rrd directory) you'll need
to figure out what the new names of your rrd files will be. The easiest way
to do this is to run the new lvs.rrd.update script (the new name of the
connections.rrd.update script). It will create new files in the form of:

lvs.VIP.VIPport.RIP.Rport.rrd

where VIP is (Obviously) the VIP, VIPport is the associated port, RIP is
the real server IP, and Rport, the associated real server port.
So, for example, a real server 10.1.1.10 on port 80 in a virtual server
with a VIP of 192.169.1.10 and a port of 80 would have the name:

lvs.C0A9010A.0050.0A01010A.0050.rrd

So, find the corresponding connections rrd file, delete the new lvs.XXX.rrd
file, and hard link the old file to the new name. ie:

ln connections.1.10.rrd lvs.C0A9010A.0050.0A01010A.0050.rrd

Once that is done, change your crontab to run lvs.rrd.update instead of
connections.rrd.update.

Now go read the Changelog to see what other changes there were.

Usage:
~~~~~~
The update script should just do it's job. No need to worry about it.
The graphing script will, by default, graph all of the rrd file's
data in one graph (well, 5 graphs, but all the data is in each graph).

The graphing script breaks down like this:

graph-lvs.sh [-lH] [-I VIP] [-P port] [-i IP] [-p port]
        -l                 Lazy (Generate graphs at most once per 5 minutes)
        -H                 Output an HTML page.
        -I VIP                Graph only servers in this virtual server
        -P port                Graph only VIPs on this port
        -i IP                Graph only this real server IP
        -p port                Graph only this real server port
        -r                Reverse (flip) active and inactive (positive to negative)
        -s                Separate Active/Inactive graphs (nullifies -r)

-l will greaty reduce the loading time of very complicated graphs that
are viewed by more than one person, or if you hit reload alot, as the
graphs will only be regenerated at most once ever 5 minutes, or whenever
the graphs are viewed, whichever is longer. Normally they're generated
each time the graphing script is run, and it's suggested to leave
lazy off while you are testing the script and changing colors or
what have you, and to turn it on when you've got everything settled,
to reduce the load on the graphing server.

-H will output an HTML page specific for the graphs that were generated.
This is useful for when you want to run the script from within a simple
php page (as included) and you have several graphs you want to create, as
all you will need to do is change the options to the script.

-I -P -i and -p are for the VIP, it's port, the real server, and it's port.
They're used to limit the rrd files used to generate the graphs. So if you
want to graph all connections going to a specific VIP, or a specific real
server, or to a particular port, you can. These options are additive in their
restrictions. Meaning, if you use them all, you are essentially specifying
one rrd file to use (assuming it exists).
If you supply an invalid IP or port, that particular option will be ignored,
and an error will be output, and the script will then assume all servers
are to be included.

-r Will swap positive and negative ends of the graph, in case your setup
produces more inactive than active connections, or you just like it that way.

-s outputs a separate graph (the second named with a "-I" just before
the ".gif") for active and inactive connections. This is useful
for people with lopsided data (ie: 7000 inactive and 5 active) which is
common w/ masq setups.

Example:

graphs-lvs.sh -lH -I 192.168.1.10

will graph connections to that VIP on all ports for all real servers
that are in that virtual server, at most once every 5 minutes and it
will output an HTML page to display those graphs.

The supplied php page has just one line. All you have to do is add
command line options as you like and make copies for each service
or servers you want to graph.

Optional changes:
~~~~~~~~~~~~~~~~~
Right now the colors for each server are created by adding or
subtracting the specified colors the base color, an amount which is
determined by how many real servers are in the cluster.
The actual equation is simply 255/(# of RSs).
As it is currently set up, the servers start off with the base
color and after the first server is graphed, the selected colors are
added or subtracted from the base.

At the top of the graphing script you'll see 6 variables:
ARED, AGREEN, ABLUE, IRED, IGREEN and IBLUE.
You can set these variables to either a two digit hex number or
either A or S. "A" will add color to each successive server, where
"S" will subtract color.

Also, there are variables for various other colors on the graphs.
Play around with them to find what you like.
感谢大家对linuxtone的支持!

Rank: 1

注册时间
2008-12-16
最后登录
2011-4-28
在线时间
6 小时
阅读权限
10
积分
47
帖子
21
主题
1
精华
0
UID
718
发表于 2008-12-26 11:52:51 |显示全部楼层
这个使用nagios监控的吗??

使用道具 举报

LT管理团队

社区首席勤杂工

Rank: 9Rank: 9Rank: 9

注册时间
2008-5-19
最后登录
2012-5-3
在线时间
1762 小时
阅读权限
200
积分
14979
帖子
2524
主题
1200
精华
25
UID
1

LT总司令

发表于 2008-12-26 13:36:50 |显示全部楼层
不是用,是利用rrdtool 具体请看http://tepedino.org/lvs-rrd/http://tepedino.org/lvs-rrd/
感谢大家对linuxtone的支持!

使用道具 举报

Rank: 1

注册时间
2009-1-13
最后登录
2011-8-18
在线时间
40 小时
阅读权限
10
积分
49
帖子
64
主题
3
精华
0
UID
829

LT粉丝

发表于 2009-4-6 15:39:52 |显示全部楼层
请问在生产环境中,也是用这个软件吗。

使用道具 举报

LT资深版主

犯强汉者,虽远必诛!

Rank: 8Rank: 8

注册时间
2009-2-1
最后登录
2012-5-15
在线时间
538 小时
阅读权限
150
积分
4254
帖子
836
主题
89
精华
3
UID
1215

LT同学

发表于 2009-4-6 17:40:07 |显示全部楼层
顶啊!

使用道具 举报

Rank: 1

注册时间
2009-1-15
最后登录
2010-3-25
在线时间
3 小时
阅读权限
10
积分
1
帖子
2
主题
0
精华
0
UID
1001
发表于 2009-4-8 12:32:42 |显示全部楼层
请问,这个软件是否可以用来监控Piranha集群套件?如果安装是否可以安装在Piranha套件安装的服务器之上?安装后主要监控点为那些?

使用道具 举报

LT管理团队

社区首席勤杂工

Rank: 9Rank: 9Rank: 9

注册时间
2008-5-19
最后登录
2012-5-3
在线时间
1762 小时
阅读权限
200
积分
14979
帖子
2524
主题
1200
精华
25
UID
1

LT总司令

发表于 2009-4-8 14:31:20 |显示全部楼层
可以,请分析一下这个脚本:)其实也是用ipvsadm去取状态。
Piranha只是LVS的一个HA方案,还是基于LVS开发的套件。
我目前就是用这个来画图监控的,当然你也可以用cacti来监控,找到相关的模板配置一下。
感谢大家对linuxtone的支持!

使用道具 举报

Rank: 1

注册时间
2009-1-13
最后登录
2011-8-18
在线时间
40 小时
阅读权限
10
积分
49
帖子
64
主题
3
精华
0
UID
829

LT粉丝

发表于 2009-4-9 14:55:35 |显示全部楼层
现在知道了。rrdtool就是mrtg的升级版,但是它和mrtg有很大的不同。如果想了解更关于rrdtool可以搜rrdtool教学。

使用道具 举报

Rank: 2

注册时间
2008-11-21
最后登录
2011-4-11
在线时间
66 小时
阅读权限
20
积分
182
帖子
99
主题
14
精华
0
UID
596

LT粉丝

发表于 2009-4-13 15:20:46 |显示全部楼层
不错的!学习了

使用道具 举报

论坛元老

神马头衔

Rank: 8Rank: 8

注册时间
2009-6-5
最后登录
2012-5-22
在线时间
84 小时
阅读权限
90
积分
5494
帖子
78
主题
5
精华
0
UID
3418
发表于 2010-10-8 17:36:12 |显示全部楼层
怎么安装啊

使用道具 举报

Rank: 1

注册时间
2010-10-9
最后登录
2011-7-7
在线时间
0 小时
阅读权限
10
积分
10
帖子
1
主题
0
精华
0
UID
10552
发表于 2010-10-9 12:26:52 |显示全部楼层
谢谢分享,但是有点看不懂啊

使用道具 举报

Rank: 6Rank: 6

注册时间
2009-1-22
最后登录
2012-5-21
在线时间
45 小时
阅读权限
70
积分
1398
帖子
85
主题
5
精华
0
UID
1152
发表于 2010-10-9 13:11:12 |显示全部楼层
很好。。。

使用道具 举报

Rank: 6Rank: 6

注册时间
2010-6-5
最后登录
2012-5-15
在线时间
10 小时
阅读权限
70
积分
2325
帖子
19
主题
1
精华
0
UID
9455
发表于 2012-1-11 11:13:34 |显示全部楼层
看上去RRD还不错。

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

IT运维专家网感谢红之盟网络提供带宽支持

合作联系: QQ:67888954/MSN:cnseek@msn.com/mail:netseek@linuxtone.org

Archiver|手机版|感谢所有关心和支持过LinuxTone的朋友们 转载本站内容请注明原作者名及出处 ( 京ICP备08103151 )   |

GMT+8, 2012-5-22 20:35 , Processed in 0.137561 second(s), 12 queries , Memcache On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部