Skip to content

Commit

Permalink
decrease memory use
Browse files Browse the repository at this point in the history
  • Loading branch information
LittlePeng committed Aug 24, 2013
1 parent 77c8c32 commit cc0da4d
Show file tree
Hide file tree
Showing 23 changed files with 834 additions and 441 deletions.
275 changes: 275 additions & 0 deletions dasdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
commit 5ee1c988b6c77dde854ed7c210326a3c9bb132ad
Author: LittlePeng <[email protected]>
AuthorDate: Sat May 11 23:18:14 2013 +0800
Commit: LittlePeng <[email protected]>
CommitDate: Sat May 11 23:18:14 2013 +0800

delete`

commit 47b6c5b717f04110dac5f66f675e3bd65391197a
Author: LittlePeng <[email protected]>
AuthorDate: Sat May 11 22:26:14 2013 +0800
Commit: LittlePeng <[email protected]>
CommitDate: Sat May 11 22:26:14 2013 +0800

Update README.md

commit e95c8a34c1b8b16badaa09edb8775872cbae6564
Author: pengjilu <[email protected]>
AuthorDate: Sat May 11 22:16:44 2013 +0800
Commit: pengjilu <[email protected]>
CommitDate: Sat May 11 22:16:44 2013 +0800

iasdf

commit f5a53fb7d42796fda81e87092fe04bec6991f195
Author: pengjilu <[email protected]>
AuthorDate: Sat May 11 21:46:55 2013 +0800
Commit: pengjilu <[email protected]>
CommitDate: Sat May 11 21:46:55 2013 +0800

aa

commit 88b16161c429c0ef87b98f918e0a6f7191ced503
Author: pengjilu <[email protected]>
AuthorDate: Sat May 11 21:45:37 2013 +0800
Commit: pengjilu <[email protected]>
CommitDate: Sat May 11 21:45:37 2013 +0800

readme

commit 4f8a708f775a1fdfd70a408323addcff50c1c4b7
Author: pengjilu <[email protected]>
AuthorDate: Sat May 11 21:34:55 2013 +0800
Commit: pengjilu <[email protected]>
CommitDate: Sat May 11 21:34:55 2013 +0800

pic

commit 3fd9ea1c4241ed1496f965ee9c5b6a69f1177252
Author: pengjilu <[email protected]>
AuthorDate: Sat May 11 21:30:36 2013 +0800
Commit: pengjilu <[email protected]>
CommitDate: Sat May 11 21:30:36 2013 +0800

two

commit 33f93016da193f9f53cbc68f83a14cc8f49970d1
Author: pengjilu <[email protected]>
AuthorDate: Sat May 11 21:29:14 2013 +0800
Commit: pengjilu <[email protected]>
CommitDate: Sat May 11 21:29:14 2013 +0800

first

commit 285fc4b1c8e3a3438e7a9cdbd13a2f826baa8032
Merge: f328e53 f8a31a3
Author: Nitin Kumar <[email protected]>
AuthorDate: Mon Oct 29 11:34:10 2012 -0700
Commit: Nitin Kumar <[email protected]>
CommitDate: Mon Oct 29 11:34:10 2012 -0700

Merge pull request #38 from josegonzalez/requirements

Added a requirements.txt

commit f328e539c8345a2972a1921d7ee7751560914743
Author: Nitin Kumar <[email protected]>
AuthorDate: Mon Oct 29 11:08:34 2012 -0700
Commit: Nitin Kumar <[email protected]>
CommitDate: Mon Oct 29 11:08:34 2012 -0700

added support for tornado's command line options

commit f8a31a3c0a5b9be5989638d155523490c44bf88d
Author: Jose Diaz-Gonzalez <[email protected]>
AuthorDate: Wed Aug 8 12:02:21 2012 -0400
Commit: Jose Diaz-Gonzalez <[email protected]>
CommitDate: Wed Aug 8 12:02:21 2012 -0400

Added a requirements.txt

Note that the redis version is not specified, so it is possible to
setup a virtualenv with whatever redis version you see fit.

commit 3f1160f6b517d3606c13554cdb44346a1a3b62fe
Author: kumarnitin <[email protected]>
AuthorDate: Sat Aug 4 04:41:08 2012 -0700
Commit: kumarnitin <[email protected]>
CommitDate: Sat Aug 4 04:41:08 2012 -0700

Update README.md

commit 46aa122e5d5527f49a08189ed2150bb31791ca9e
Author: kumarnitin <[email protected]>
AuthorDate: Mon Jul 16 19:22:11 2012 -0700
Commit: kumarnitin <[email protected]>
CommitDate: Mon Jul 16 19:22:11 2012 -0700

Update master

commit 5cac95816fb5c436d9024b2b44405e9cbd0c0508
Merge: f2bfb80 555f261
Author: kumarnitin <[email protected]>
AuthorDate: Mon Jul 16 19:19:22 2012 -0700
Commit: kumarnitin <[email protected]>
CommitDate: Mon Jul 16 19:19:22 2012 -0700

Merge pull request #30 from quiver/cmd_option

add support for passing logging options to redis-live.py

commit 555f261d26acc473a2e9aa6f85e615f290c4b104
Author: george <george@ubu1204.(none)>
AuthorDate: Mon Jul 16 18:33:34 2012 +0900
Commit: george <george@ubu1204.(none)>
CommitDate: Mon Jul 16 18:33:34 2012 +0900

add support for passing logging options to redis-live.py

* example usage
$ ./redis-live.py --logging=debug

commit f2bfb80d969ea8ce0a0c5e922407cf52680da4b0
Author: Nitin Kumar <[email protected]>
AuthorDate: Sun Jul 15 18:39:54 2012 -0700
Commit: Nitin Kumar <[email protected]>
CommitDate: Sun Jul 15 18:39:54 2012 -0700

fixed a bug

commit 1ef583150fe30c55de05cb884823d4666cb232e2
Author: kumarnitin <[email protected]>
AuthorDate: Sun Jul 15 17:54:19 2012 -0700
Commit: kumarnitin <[email protected]>
CommitDate: Sun Jul 15 17:54:19 2012 -0700

Update master

commit a4bb6c7228f077a972b648c241c88abc3f5b8d09
Author: Nitin Kumar <[email protected]>
AuthorDate: Sun Jul 15 17:39:50 2012 -0700
Commit: Nitin Kumar <[email protected]>
CommitDate: Sun Jul 15 17:39:50 2012 -0700

Fixed a few bugs

commit 1bbbf16ab8c50ddc60f46be5dc9264e05bc9978c
Author: Lee McFadden <[email protected]>
AuthorDate: Sun Jul 15 13:27:16 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Sun Jul 15 13:27:16 2012 -0700

Fixed a few bugs.

commit f7911212ce05a4d47f4f3e4c34046e86b9099225
Author: Lee McFadden <[email protected]>
AuthorDate: Sun Jul 15 13:09:23 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Sun Jul 15 13:09:23 2012 -0700

Last few tweaks in controllers

commit 84efb5ae98b09599b0756f6ad99fc1c26387ccae
Author: Lee McFadden <[email protected]>
AuthorDate: Sun Jul 15 13:02:54 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Sun Jul 15 13:02:54 2012 -0700

PEP8 for sqliteprovider

commit 75dd0bcdcb87139bd47d3df932961c5f9b2c36c6
Author: Lee McFadden <[email protected]>
AuthorDate: Sun Jul 15 11:40:01 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Sun Jul 15 11:40:01 2012 -0700

PEP8 method names and a few tweaks

commit 5bc87ce3a4ef8577b2d7605a74e3bf75e14bdfd7
Author: Lee McFadden <[email protected]>
AuthorDate: Sun Jul 15 11:16:42 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Sun Jul 15 11:16:42 2012 -0700

PEP8 for TopKeysController

commit 84280468997fa4f3a2e85e1fef55f043b104052b
Author: Lee McFadden <[email protected]>
AuthorDate: Sun Jul 15 11:13:12 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Sun Jul 15 11:13:12 2012 -0700

PEP8 for TopCommandsController

commit 95f3c67bbd7d4ff1283d7eec0462e24c4690f63b
Author: Lee McFadden <[email protected]>
AuthorDate: Sun Jul 15 11:09:48 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Sun Jul 15 11:09:48 2012 -0700

Missed a few spots.

commit d145c7da870a0162fb97d117b30364b99e65b381
Author: Lee McFadden <[email protected]>
AuthorDate: Sun Jul 15 11:08:52 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Sun Jul 15 11:08:52 2012 -0700

PEP8 for MemoryController

commit 9b991dd158399ea16db5352567c8b001f2be1072
Author: Lee McFadden <[email protected]>
AuthorDate: Fri Jul 13 19:01:19 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Fri Jul 13 19:01:19 2012 -0700

PEP8 for InfoController

commit 74495c0683c933db3a3d7541811dc52c610dec67
Author: Lee McFadden <[email protected]>
AuthorDate: Fri Jul 13 18:42:51 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Fri Jul 13 18:42:51 2012 -0700

Missed a spot...

commit 0e3f9142abedee4557960346314b3dde85695225
Author: Lee McFadden <[email protected]>
AuthorDate: Fri Jul 13 18:41:22 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Fri Jul 13 18:41:22 2012 -0700

PEP8'ed BaseController and dependencies

commit db720a69c8ec3b78b1882bafa2750991f889ce04
Author: Lee McFadden <[email protected]>
AuthorDate: Fri Jul 13 17:53:50 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Fri Jul 13 17:53:50 2012 -0700

PEP8'ed the internal code of this handler. Methods are up next.

commit 24205a36e7526cad329f1fa97b69478b9619a412
Author: Lee McFadden <[email protected]>
AuthorDate: Fri Jul 13 17:27:50 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Fri Jul 13 17:27:50 2012 -0700

Made RedisLiveSettings and dependencies more pythonic

commit 205e7d995ae68a9e3ec1a235779738554201773e
Author: Lee McFadden <[email protected]>
AuthorDate: Fri Jul 13 15:09:00 2012 -0700
Commit: Lee McFadden <[email protected]>
CommitDate: Fri Jul 13 15:09:00 2012 -0700

Fixed whitespace

commit ed2041c4b103c2b9e9c95d90d3a904208c124918
Author: Nitin Kumar <[email protected]>
AuthorDate: Sun Jul 1 00:43:12 2012 -0700
Commit: Nitin Kumar <[email protected]>
CommitDate: Sun Jul 1 00:43:12 2012 -0700

fix for sqlite database lock issue. closed #7
22 changes: 22 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
redis-monitor
---------

base RedisLive,monitor multiple redis-server in product enviroment:
* 1. monitor multiple redis-instance in one page
* 2. monitor memory,comand per sec,HitRate,keyspace, master-slave change,expire
* 3. sms alert when crash , master-slave stats changed

### install
in src/script/redis-monitor.sh add redis-monitor as a startup service for redhat
python redis_live.py #start web with port 8888
python redis_monitor.py # start info collector
#start daemon
python redis_live_daemon.py
python redis_monitor_daemon.py

### ÑÝʾµØÖ·
[Redis-monitor](http://10.10.209.104:8888/index.html)
### overview
![Redis Live](https://raw.github.com/LittlePeng/redis-monitor/master/design/redis-live.png)
![Redis Live](https://raw.github.com/LittlePeng/redis-monitor/master/design/overview.png)

2 changes: 1 addition & 1 deletion src/api/controller/BaseController.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BaseController(tornado.web.RequestHandler):

def getStatsPerServer(self, server):
try:
connection = redis.Redis(host=server[0], port=(int)(server[1]), db=0)
connection = redis.Redis(host=server[0], port=(int)(server[1]), db=0,socket_timeout=0.1)
info = connection.info()
# when instances down ,this maybe slowly...
info.update({
Expand Down
2 changes: 1 addition & 1 deletion src/api/controller/CommandsController.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get(self):

if from_date==None or to_date==None or len(from_date)==0:
end = datetime.datetime.now()
delta = datetime.timedelta(seconds=300)
delta = datetime.timedelta(seconds=900)
start = end - delta
else:
start = dateutil.parser.parse(from_date)
Expand Down
32 changes: 12 additions & 20 deletions src/api/controller/InfoListController.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,26 @@
class InfoListController(BaseController):

def get(self):
group = self.get_argument("group", None)

response = {}
response['data']=[]
for server in self.read_server_config():
info=self.getStatsPerServer(server)
for server in settings.get_redis_servers():
if(group !=None and group!='all' and server['group'] != group):
continue;

info=self.getStatsPerServer((server['server'],server['port']))

info.update({
"addr" : info.get("server_name")[0].replace(".", "_") + str(info.get("server_name")[1]),
info.update({"addr" : info.get("server_name")[0].replace(".", "_") + str(info.get("server_name")[1]),
})

info['show_name']=server['group']+'('+server['instance']+')'
info['group']= server['group']
screen_strategy = 'normal'
if info.get("status") == 'down':
screen_strategy = 'hidden'

info.update({
"screen_strategy": screen_strategy,
})
info.update({ "screen_strategy": screen_strategy,})

#key = info.get("addr")
response["data"].append(info)


self.write(response)

def read_server_config(self):
server_list = []
redis_servers = settings.get_redis_servers()

for server in redis_servers:
server_list.append([server['server'],server['port']])

return server_list
self.write(response)
8 changes: 2 additions & 6 deletions src/api/controller/ServerListController.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ def get(self):
self.write(servers)

def read_server_config(self):
"""Returns a list of servers with the 'id' field added.
"""
# TODO: Move this into the settings module so everything benefits.
server_list = []
redis_servers = settings.get_redis_servers()

for server in redis_servers:
server_id = "%(server)s:%(port)s" % server
s = dict(server=server['server'], port=server['port'], id=server_id)
server_list.append(s)
server['id']= "%(server)s:%(port)s" % server
server_list.append(server)

return server_list
Loading

0 comments on commit cc0da4d

Please sign in to comment.