-
Notifications
You must be signed in to change notification settings - Fork 8
/
gitlab_redis_used_memory
executable file
·29 lines (22 loc) · 1003 Bytes
/
gitlab_redis_used_memory
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
#!/usr/bin/env python
# inspired by the redis munin plugin found at
# http://munin-monitoring.org/browser/munin-contrib/plugins/redis/redis_,
# written 2009 by Gleb Voronich <http://stanly.net.ua/>
from lib import get_gitlab_instance
import sys
gitlab = get_gitlab_instance()
if len(sys.argv) >= 2 and sys.argv[1] == 'config':
maxmemory = gitlab.get_redis_max_memory()
print('graph_title Redis: Used memory')
print('graph_vlabel Used memory')
print('graph_category gitlab')
print('graph_args -l 0 --base 1024')
print('used_memory.line ' + maxmemory + ':ff0000:Limit')
print('used_memory.label used memory')
print('used_memory_peak.label used memory in peak')
print('used_memory_rss.label Resident set size memory usage')
sys.exit(0)
redis_info = gitlab.get_redis_info()
print('used_memory.value ' + redis_info['used_memory'])
print('used_memory_rss.value ' + redis_info['used_memory_rss'])
print('used_memory_peak.value ' + redis_info['used_memory_peak'])