OSDN Git Service

------ BUGFIX ------
authorTaizo ITO <taizo@karesansui-project.info>
Thu, 6 May 2010 06:59:39 +0000 (15:59 +0900)
committerTaizo ITO <taizo@karesansui-project.info>
Thu, 6 May 2010 06:59:39 +0000 (15:59 +0900)
------ BUGZILLA ------

------ TRAC ------

------ IMPROVEMENT ------

------ CREATE ------

------ COMMENT ------
Append hostname to plugin_selector.

karesansui/lib/collectd/config.py

index a5df72b..337a95a 100644 (file)
@@ -487,6 +487,11 @@ def create_threshold_config_name(plugin,selector):
         config_name += ":%s" % (data['ds'],)
     except:
         config_name += ":"
+    try:
+        config_name += ":%s" % (data['host'],)
+    except:
+        pass
+        #config_name += ":"
 
     return config_name
 
@@ -519,11 +524,21 @@ def set_threshold(plugin,selector,params,dop=None, webobj=None, host=None):
         ds = data['ds']
     except:
         ds = None
+    try:
+        host = data['host']
+        _keys = [config_name,"Threshold","","Host",host,"Plugin",plugin]
+    except:
+        host = None
+        _keys = [config_name,"Threshold","","Plugin",plugin]
 
-    _keys = [config_name,"Threshold","","Plugin",plugin]
 
     if plugin_instance is not None:
         keys = _keys + ["Instance"]
+        try:
+            int(plugin_instance)
+            plugin_instance = "\"%d\"" % int(plugin_instance)
+        except:
+            pass
         dop.cdp_set("collectdplugin", keys, plugin_instance, multiple_file=True)
 
     if type is not None: