Class: RedisMemoryMonitor
- Inherits:
-
Object
- Object
- RedisMemoryMonitor
- Defined in:
- lib/slugly/redis_memory_monitor.rb
Constant Summary collapse
- CMD_REDIS_MEM_CURRENT =
"/usr/local/bin/redis-cli -a $(grep requirepass /etc/redis.conf | cut -d ' ' -f 2) info | grep used_memory: | cut -d : -f 2"- CMD_REDIS_MEM_MAX =
"grep 'maxmemory ' /etc/redis.conf | cut -d ' ' -f 2"- CACHE_TIME =
15
Instance Method Summary collapse
-
#initialize(options) ⇒ RedisMemoryMonitor
constructor
A new instance of RedisMemoryMonitor.
- #redis_mem_alert ⇒ Object
- #status ⇒ Object
Constructor Details
#initialize(options) ⇒ RedisMemoryMonitor
Returns a new instance of RedisMemoryMonitor.
8 9 10 11 12 13 |
# File 'lib/slugly/redis_memory_monitor.rb', line 8 def initialize() @hostname = ['hostname'] @username = ['username'] @alert_percent = ['alert_percent'].to_f @last_update = Time.now - 2*CACHE_TIME end |
Instance Method Details
#redis_mem_alert ⇒ Object
15 16 17 18 |
# File 'lib/slugly/redis_memory_monitor.rb', line 15 def redis_mem_alert update @_redis_mem_alert end |
#status ⇒ Object
20 21 22 |
# File 'lib/slugly/redis_memory_monitor.rb', line 20 def status redis_mem_alert ? "above" : "below" end |