[collectd] [PATCH] ipmi

Peter Holik peter at holik.at
Tue Jun 17 15:04:23 CEST 2008


First a small fix:

--- ipmi.c.orig 2008-06-12 13:02:14.000000000 +0200
+++ ipmi.c      2008-06-17 14:57:40.000000000 +0200
@@ -73,7 +73,7 @@

   if (IPMI_IS_OS_ERR (status))
   {
-    sstrerror_r (IPMI_GET_OS_ERR (status), errbuf, sizeof (errbuf));
+    sstrerror (IPMI_GET_OS_ERR (status), errbuf, sizeof (errbuf));
   }
   else if (IPMI_IS_IPMI_ERR (status))
   {

than a suggestion:

--- ipmi.c.orig 2008-06-12 13:02:14.000000000 +0200
+++ ipmi.c      2008-06-17 14:57:40.000000000 +0200
@@ -108,18 +108,21 @@

   char sensor_name[IPMI_SENSOR_NAME_LEN];
   char *sensor_name_ptr;
-  int sensor_type;
+  int sensor_type, len;
   const char *type;
-
+  ipmi_entity_t *ent = ipmi_sensor_get_entity(sensor);
+
   memset (sensor_name, 0, sizeof (sensor_name));
   ipmi_sensor_get_name (sensor, sensor_name, sizeof (sensor_name));
   sensor_name[sizeof (sensor_name) - 1] = 0;

-  sensor_name_ptr = strstr (sensor_name, ").");
+  len = IPMI_SENSOR_NAME_LEN - strlen(sensor_name);
+  strncat(sensor_name, " ", len--);
+  strncat(sensor_name, ipmi_entity_get_entity_id_string(ent), len);
+
+  sensor_name_ptr = strstr (sensor_name, "(");
   if (sensor_name_ptr == NULL)
     sensor_name_ptr = sensor_name;
-  else
-    sensor_name_ptr += 2;

   if (err != 0)
   {


sensor names looks now like (unique):

ipmi plugin: sensor_name: (7.1).System Level system_board
ipmi plugin: sensor_name: (10.1).Voltage 1 power_supply
ipmi plugin: sensor_name: (10.1).Current 1 power_supply
ipmi plugin: sensor_name: (7.1).FAN 6 RPM system_board
ipmi plugin: sensor_name: (7.1).FAN 5 RPM system_board
ipmi plugin: sensor_name: (7.1).FAN 4 RPM system_board
ipmi plugin: sensor_name: (7.1).FAN 3 RPM system_board
ipmi plugin: sensor_name: (7.1).FAN 2 RPM system_board
ipmi plugin: sensor_name: (7.1).FAN 1 RPM system_board
ipmi plugin: sensor_name: (7.1).Ambient Temp system_board
ipmi plugin: sensor_name: (10.2).Temp power_supply
ipmi plugin: sensor_name: (10.1).Temp power_supply
ipmi plugin: sensor_name: (3.2).Temp processor
ipmi plugin: sensor_name: (3.1).Temp processor


cu Peter




More information about the collectd mailing list