@@ -392,7 +392,7 @@ class VariableConfig:
392392
393393 self .name = name
394394 try :
395- self .rrd_regex = re .compile (rrd_regex )
395+ self .rrd_regex = re .compile ("^%s$" % rrd_regex )
396396 except :
397397 raise XmlConfigException , "variable %s: regex %s does not compile" % (name , rrd_regex )
398398
@@ -573,7 +573,7 @@ class ObjectMonitor:
573573 params_in_obj_report = obj_report .get_var_names ()
574574 for var in self .variables :
575575 # find the subset of the params returned for this object that we need to consolidate into var
576- params_to_consolidate = filter (var .rrd_regex .search , params_in_obj_report )
576+ params_to_consolidate = filter (var .rrd_regex .match , params_in_obj_report )
577577 for row in range (num_rows ):
578578 # Get the values to consolidate
579579 values_to_consolidate = map (lambda param : obj_report .get_value (param , row ), params_to_consolidate )
@@ -604,7 +604,7 @@ class VMMonitor(ObjectMonitor):
604604 * alarm_trigger_period: num seconds of 'bad' values before an alarm is sent (default '60')
605605 * alarm_auto_inhibit_period: num seconds this alarm disabled after an alarm is sent (default '3600')
606606 * consolidation_fn: how to combine variables from rrd_updates into one value
607- (default is 'average' for 'cpu_usage' & 'sum' for everything else)
607+ (default is 'average' for 'cpu_usage', 'get_percent_fs_usage' for 'fs_usage', & 'sum' for everything else)
608608 * rrd_regex matches the names of variables from (xe vm-data-sources-list uuid=$vmuuid) used to compute value
609609 (only has defaults for "cpu_usage", "network_usage", and "disk_usage")
610610 """
@@ -623,7 +623,7 @@ class VMMonitor(ObjectMonitor):
623623 if variable_name == "cpu_usage" : return "cpu[0-9]+"
624624 elif variable_name == "network_usage" : return "vif_[0-9]+_[rt]x"
625625 elif variable_name == "disk_usage" : return "vbd_(xvd|hd)[a-z]+_(read|write)"
626- elif variable_name == "fs_usage" : return "__DUMMY__" # match nothing
626+ elif variable_name == "fs_usage" : return "_$_DUMMY__" # match nothing
627627 else : raise XmlConfigException , "variable %s: no default rrd_regex - please specify one" % variable_name
628628 elif config_tag == 'alarm_trigger_period' : return '60' # 1 minute
629629 elif config_tag == 'alarm_auto_inhibit_period' :
@@ -654,8 +654,8 @@ class HOSTMonitor(ObjectMonitor):
654654 * alarm_auto_inhibit_period: num seconds this alarm disabled after an alarm is sent (default '3600')
655655 * consolidation_fn: how to combine variables from rrd_updates into one value
656656 (default is 'average' for 'cpu_usage' & 'sum' for everything else)
657- * rrd_regex matches the names of variables from (xe host-data-sources -list uuid=$hostuuid) used to compute value
658- (only has defaults for "cpu_usage" and "network_usage ")
657+ * rrd_regex matches the names of variables from (xe host-data-source -list uuid=$hostuuid) used to compute value
658+ (only has defaults for "cpu_usage", "network_usage", "memory_total_kib" and "sr_io_throughput_total_xxxxxxxx ")
659659 """
660660 def __init__ (self , * args ):
661661 self .monitortype = "HOST"
@@ -670,6 +670,8 @@ class HOSTMonitor(ObjectMonitor):
670670 elif config_tag == 'rrd_regex' :
671671 if variable_name == "cpu_usage" : return "cpu[0-9]+"
672672 elif variable_name == "network_usage" : return "pif_eth[0-9]+_[rt]x"
673+ elif variable_name == "memory_total_kib" : return variable_name
674+ elif re .match ("sr_io_throughput_total_[0-9a-f]{8}$" , variable_name ): return variable_name [3 :]
673675 else : raise XmlConfigException , "variable %s: no default rrd_regex - please specify one" % variable_name
674676 elif config_tag == 'alarm_trigger_period' : return '60' # 1 minute
675677 elif config_tag == 'alarm_auto_inhibit_period' : return '3600' # 1 hour
0 commit comments