Permalink
Browse files

Got rid of donotalert, now you specifiy the warning threshold of the …

…disk as 101
  • Loading branch information...
1 parent db1e191 commit b70efd4f49c229564715507fe5742b8d63ac1ba0 Kevin Wojcik committed Nov 13, 2012
Showing with 8 additions and 23 deletions.
  1. +5 −20 bin/alerts.py
  2. +3 −3 config/disk.conf
View
25 bin/alerts.py
@@ -49,18 +49,6 @@ def execute(str):
for element in elements:
dont_watch.append(int(element.childNodes[0].data))
-#Read the don't alert file
-try:
- alert_conf = open('%s/donotalert.conf' % config_dir, 'r')
-except:
- logger.error("Unable to open the disk config file %s/disk.conf" % config_dir)
- logger.error(sys.exc_info()[0])
- exit(-1)
-alert_dom = parse(alert_conf)
-alert_map = {}
-for disk in alert_dom.getElementsByTagName('disk'):
- alert_map[int(disk.childNodes[0].data)] = 0
-
#Do disk fill detection
try:
disk_conf = open('%s/disk.conf' % config_dir, 'r')
@@ -116,18 +104,15 @@ def execute(str):
for disk in disks:
try:
disk_id = disksql.getID(disk)
- try:
- doalert = alert_map[disk_id]
- logger.info("Disk %d is not being monitored for alerts" % disk_id)
- continue
- except:
- pass
str = 'SELECT * FROM diskusage WHERE disk_id=%d ORDER BY time DESC LIMIT 1' % disk_id
result = execute(str)[0]
- #red = red_map[disk_id]
+ try:
+ red = red_map[disk_id]
+ except:
+ red = 95;
used = diskusagesql.getUsed(result)
device = disksql.getDevice(disk)
- if(used > 97):
+ if(used > red):
str = 'SELECT * FROM diskwarning WHERE disk_id=%d ORDER BY time DESC LIMIT 1' % disk_id
result = execute(str)
# print "cur_time", cur_time, "diskwarning", diskwarningsql.getTime(result[0]), "diskwarningwaitseconds", disk_warning_wait_seconds
View
6 config/disk.conf
@@ -1,7 +1,7 @@
<root>
<disk>
-<disk_id>39</disk_id>
-<yellow>90</yellow>
-<red>97</red>
+<disk_id>8</disk_id>
+<yellow>101</yellow>
+<red>101</red>
</disk>
</root>

0 comments on commit b70efd4

Please sign in to comment.