* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
* Peter Holik <peter at holik.at>
* Bruno Prémont <bonbons at linux-vserver.org>
**/
static void sensor_read_handler (ipmi_sensor_t *sensor,
int err,
enum ipmi_value_present_e value_present,
- unsigned int raw_value,
+ unsigned int __attribute__((unused)) raw_value,
double value,
- ipmi_states_t *states,
+ ipmi_states_t __attribute__((unused)) *states,
void *user_data)
{
value_t values[1];
if (c_ipmi_nofiy_notpresent)
{
- notification_t n = { NOTIF_WARNING, time(NULL), "", "", "ipmi",
+ notification_t n = { NOTIF_WARNING, cdtime (), "", "", "ipmi",
"", "", "", NULL };
sstrncpy (n.host, hostname_g, sizeof (n.host));
}
}
}
+ else if (IPMI_IS_IPMI_ERR(err) && IPMI_GET_IPMI_ERR(err) == IPMI_NOT_SUPPORTED_IN_PRESENT_STATE_CC)
+ {
+ INFO ("ipmi plugin: sensor_read_handler: Sensor %s not ready",
+ list_item->sensor_name);
+ }
else
{
- INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
- "because it failed with status %#x.",
- list_item->sensor_name, err);
+ if (IPMI_IS_IPMI_ERR(err))
+ INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
+ "because it failed with IPMI error %#x.",
+ list_item->sensor_name, IPMI_GET_IPMI_ERR(err));
+ else if (IPMI_IS_OS_ERR(err))
+ INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
+ "because it failed with OS error %#x.",
+ list_item->sensor_name, IPMI_GET_OS_ERR(err));
+ else if (IPMI_IS_RMCPP_ERR(err))
+ INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
+ "because it failed with RMCPP error %#x.",
+ list_item->sensor_name, IPMI_GET_RMCPP_ERR(err));
+ else if (IPMI_IS_SOL_ERR(err))
+ INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
+ "because it failed with RMCPP error %#x.",
+ list_item->sensor_name, IPMI_GET_SOL_ERR(err));
+ else
+ INFO ("ipmi plugin: sensor_read_handler: Removing sensor %s, "
+ "because it failed with error %#x. of class %#x",
+ list_item->sensor_name, err & 0xff, err & 0xffffff00);
sensor_list_remove (sensor);
}
return;
if (c_ipmi_nofiy_notpresent)
{
- notification_t n = { NOTIF_OKAY, time(NULL), "", "", "ipmi",
+ notification_t n = { NOTIF_OKAY, cdtime (), "", "", "ipmi",
"", "", "", NULL };
sstrncpy (n.host, hostname_g, sizeof (n.host));
vl.values = values;
vl.values_len = 1;
- vl.time = time (NULL);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "ipmi", sizeof (vl.plugin));
{
/* `sensor_id_ptr' now points to "(123)". */
ssnprintf (sensor_name, sizeof (sensor_name),
- "%s %s", sensor_name_ptr, sensor_id_ptr);
+ "%s %s", sensor_name_ptr, sensor_id_ptr);
}
/* else: don't touch sensor_name. */
}
if (c_ipmi_nofiy_add && (c_ipmi_init_in_progress == 0))
{
- notification_t n = { NOTIF_OKAY, time(NULL), "", "", "ipmi",
+ notification_t n = { NOTIF_OKAY, cdtime (), "", "", "ipmi",
"", "", "", NULL };
sstrncpy (n.host, hostname_g, sizeof (n.host));
if (c_ipmi_nofiy_remove && c_ipmi_active)
{
- notification_t n = { NOTIF_WARNING, time(NULL), "", "",
+ notification_t n = { NOTIF_WARNING, cdtime (), "", "",
"ipmi", "", "", "", NULL };
sstrncpy (n.host, hostname_g, sizeof (n.host));
* Entity handlers
*/
static void entity_sensor_update_handler (enum ipmi_update_e op,
- ipmi_entity_t *entity,
+ ipmi_entity_t __attribute__((unused)) *entity,
ipmi_sensor_t *sensor,
- void *user_data)
+ void __attribute__((unused)) *user_data)
{
/* TODO: Ignore sensors we cannot read */
* Domain handlers
*/
static void domain_entity_update_handler (enum ipmi_update_e op,
- ipmi_domain_t *domain,
+ ipmi_domain_t __attribute__((unused)) *domain,
ipmi_entity_t *entity,
- void *user_data)
+ void __attribute__((unused)) *user_data)
{
int status;
ipmi_domain_id_t domain_id;
int status;
- os_handler = ipmi_posix_thread_setup_os_handler (SIGUSR2);
+ os_handler = ipmi_posix_thread_setup_os_handler (SIGIO);
if (os_handler == NULL)
{
ERROR ("ipmi plugin: ipmi_posix_thread_setup_os_handler failed.");
return (0);
} /* int thread_init */
-static void *thread_main (void *user_data)
+static void *thread_main (void __attribute__((unused)) *user_data)
{
int status;
os_handler_t *os_handler = NULL;
else if (strcasecmp ("IgnoreSelected", key) == 0)
{
int invert = 1;
- if ((strcasecmp ("True", value) == 0)
- || (strcasecmp ("Yes", value) == 0)
- || (strcasecmp ("On", value) == 0))
+ if (IS_TRUE (value))
invert = 0;
ignorelist_set_invert (ignorelist, invert);
}
else if (strcasecmp ("NotifySensorAdd", key) == 0)
{
- if ((strcasecmp ("True", value) == 0)
- || (strcasecmp ("Yes", value) == 0)
- || (strcasecmp ("On", value) == 0))
+ if (IS_TRUE (value))
c_ipmi_nofiy_add = 1;
}
else if (strcasecmp ("NotifySensorRemove", key) == 0)
{
- if ((strcasecmp ("True", value) == 0)
- || (strcasecmp ("Yes", value) == 0)
- || (strcasecmp ("On", value) == 0))
+ if (IS_TRUE (value))
c_ipmi_nofiy_remove = 1;
}
else if (strcasecmp ("NotifySensorNotPresent", key) == 0)
{
- if ((strcasecmp ("True", value) == 0)
- || (strcasecmp ("Yes", value) == 0)
- || (strcasecmp ("On", value) == 0))
+ if (IS_TRUE (value))
c_ipmi_nofiy_notpresent = 1;
}
else
int status;
/* Don't send `ADD' notifications during startup (~ 1 minute) */
- c_ipmi_init_in_progress = 1 + (60 / interval_g);
+ time_t iv = CDTIME_T_TO_TIME_T (plugin_get_interval ());
+ c_ipmi_init_in_progress = 1 + (60 / iv);
c_ipmi_active = 1;
- status = pthread_create (&thread_id, /* attr = */ NULL, thread_main,
+ status = plugin_thread_create (&thread_id, /* attr = */ NULL, thread_main,
/* user data = */ NULL);
if (status != 0)
{