采用RedisLive监控Redis服务

时间:2021-04-20 23:11:30

1、基础环境安装
https://pypi.python.org/packages/source/b/backports.ssl_match_hostname/backports.ssl_match_hostname-3.4.0.2.tar.gz
# tar xvzf backports.ssl_match_hostname-3.4.0.2.tar.gz 
# cd backports.ssl_match_hostname-3.4.0.2
# python setup.py install

https://github.com/facebook/tornado/archive/v3.2.0.tar.gz

# tar xvzf tornado-3.2.0.tar.gz

# cd tornado-3.2.0
# python setup.py install

-----------------------------------------------------------------------------------------------------------------------------------------------
https://pypi.python.org/packages/source/r/redis/redis-2.9.1.tar.gz
# tar xvzf redis-py-2.9.1.tar.gz
# cd redis-py-2.9.1
# python setup.py install

-----------------------------------------------------------------------------------------------------------------------------------------------
https://pypi.python.org/packages/source/s/six/six-1.5.2.tar.gz
# tar xvzf six-1.5.2.tar.gz
# cd six-1.5.2
# python setup.py install

https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.2.tar.gz
# tar xvzf python-dateutil-2.2.tar.gz
# cd python-dateutil-2.2
# python setup.py install

-----------------------------------------------------------------------------------------------------------------------------------------------
http://argparse.googlecode.com/files/argparse-1.2.1.tar.gz
# tar xvzf argparse-1.2.1.tar.gz
# cd argparse-1.2.1
# python setup.py install

-----------------------------------------------------------------------------------------------------------------------------------------------
https://codeload.github.com/nkrode/RedisLive/zip/master
# unzip RedisLive-master.zip
# mv RedisLive-master RedisLive

=========================================================================================
2、RedisLive配置

# cd RedisLive/src

# vim redis-live.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
    "RedisServers":
    [
        {
            "server""172.17.138.180",
            "port" 6379,
            "password" "tenredis2356"
        },
                                                      
        {
            "server""172.17.132.228",
            "port" 6379,
            "password" "tenredis2356"
        }
    ],
                                                  
    "DataStoreType" "sqlite",
                                                  
    "RedisStatsServer":
    {
        "server" "127.0.0.1",
        "port" 6381
    },
                                                  
    "SqliteStatsStore":
    {
        "path""/data/Redis-Monitor/RedisLive/src/db/redislive.sqlite"
    }
}

在RedisServers中设置需要监控的redis-server;

DataStoreType决定使用那种类型的数据存储,
如果是redis,使用RedisStatsServer作为数据存储的目标;
如果是sqlite,使用SqliteStatsStore作为数据存储的目标。

RedisLive的功能分两个部分:
一个部分是redis-server状态数据的采集,通过src/redis-monitor.py来执行;
另外一部分功能是提供对状态数据的查询服务,通过src/redis-live.py来提供web服务。

===================================================================================================

3、初始化DB
# cd db
# cat schema.sql | sqlite3 redislive.sqlite

===================================================================================================

4、配置RedisLive的定期监控
*/5 * * * * cd /data/Redis-Monitor/RedisLive/src; ./redis-monitor.py --duration 20 >/dev/null 2>&1

===================================================================================================

5、服务启动
# ./redis-live.py &

===================================================================================================

6、效果展示
http://172.24.18.65:8888/index.html

采用RedisLive监控Redis服务

转载:http://sofar.blog.51cto.com/353572/1369266/