Commit ebb64123 authored by smetaj's avatar smetaj
Browse files

config file plugin filter modified

parent 21dd2b3b
......@@ -608,17 +608,9 @@ def _keep_only_these_plugins_and_hg(df, plugins, hostgroups):
# filter all the plugin individually
for k in plugins.keys():
plugin_dict = plugins[k]
# for all attributes of this plugin
and_conditions = []
filters = plugin_dict['plugin_filters']
filters["plugin"] = filters.pop("plugin_name")
for sub_k in filters.keys():
value = filters[sub_k]
and_conditions.append(sub_k + " == '" + value + "'")
plg_condition = "( " + " and ".join(and_conditions) + " )"
# print("plg_condition: ", plg_condition)
or_conditions.append(plg_condition)
# print("or_conditions: ", or_conditions)
plg_filter = "( " + plugin_dict['plugin_filter'] + " )"
or_conditions.append(plg_filter)
# filter all interested line
filter_str = " or ".join(or_conditions)
......
......@@ -20,46 +20,23 @@
"selected_plugins": {
"load_longterm": {
"plugin_data_path": "/project/monitoring/collectd/load",
"plugin_filters": {
"value_instance": "longterm",
"plugin_name": "load"
}
"plugin_filter": "value_instance == 'longterm' and plugin == 'load'"
},
"cpu__percent_idle": {
"plugin_data_path": "/project/monitoring/collectd/cpu",
"plugin_filters": {
"plugin_instance": "",
"type": "percent",
"type_instance": "idle",
"plugin_name": "cpu"
}
"plugin_filter": "type == 'percent' and type_instance == 'idle' and plugin == 'cpu'"
},
"memory__memory_free": {
"plugin_data_path": "/project/monitoring/collectd/memory",
"plugin_filters": {
"plugin_instance": "",
"type": "memory",
"type_instance": "free",
"plugin_name": "memory"
}
"plugin_filter": "type == 'memory' and type_instance == 'free' and plugin == 'memory'"
},
"vmem__vmpage_io_memory_in": {
"plugin_data_path": "/project/monitoring/collectd/vmem",
"plugin_filters": {
"plugin_instance": "",
"type": "vmpage_io",
"type_instance": "memory",
"value_instance": "in",
"plugin_name": "vmem"
}
"plugin_filter": "type == 'vmpage_io' and type_instance == 'memory' and value_instance == 'in' and plugin == 'vmem'"
},
"swap_swapfile_swap_free": {
"plugin_data_path": "/project/monitoring/collectd/swap",
"plugin_filters": {
"type": "swap",
"type_instance": "free",
"plugin_name": "swap"
}
"plugin_filter": "type == 'swap' and type_instance == 'free' and plugin == 'swap'"
}
}
}
\ No newline at end of file
......@@ -20,46 +20,23 @@
"selected_plugins": {
"load_longterm": {
"plugin_data_path": "/project/monitoring/collectd/load",
"plugin_filters": {
"value_instance": "longterm",
"plugin_name": "load"
}
"plugin_filter": "value_instance == 'longterm' and plugin == 'load'"
},
"cpu__percent_idle": {
"plugin_data_path": "/project/monitoring/collectd/cpu",
"plugin_filters": {
"plugin_instance": "",
"type": "percent",
"type_instance": "idle",
"plugin_name": "cpu"
}
"plugin_filter": "type == 'percent' and type_instance == 'idle' and plugin == 'cpu'"
},
"memory__memory_free": {
"plugin_data_path": "/project/monitoring/collectd/memory",
"plugin_filters": {
"plugin_instance": "",
"type": "memory",
"type_instance": "free",
"plugin_name": "memory"
}
"plugin_filter": "type == 'memory' and type_instance == 'free' and plugin == 'memory'"
},
"vmem__vmpage_io_memory_in": {
"plugin_data_path": "/project/monitoring/collectd/vmem",
"plugin_filters": {
"plugin_instance": "",
"type": "vmpage_io",
"type_instance": "memory",
"value_instance": "in",
"plugin_name": "vmem"
}
"plugin_filter": "type == 'vmpage_io' and type_instance == 'memory' and value_instance == 'in' and plugin == 'vmem'"
},
"swap_swapfile_swap_free": {
"plugin_data_path": "/project/monitoring/collectd/swap",
"plugin_filters": {
"type": "swap",
"type_instance": "free",
"plugin_name": "swap"
}
"plugin_filter": "type == 'swap' and type_instance == 'free' and plugin == 'swap'"
}
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment