projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #312 from jazzmes/libvirt-mem-usage
[collectd.git]
/
src
/
ipmi.c
diff --git
a/src/ipmi.c
b/src/ipmi.c
index
44fae35
..
47ceaca
100644
(file)
--- a/
src/ipmi.c
+++ b/
src/ipmi.c
@@
-1,7
+1,8
@@
/**
* collectd - src/ipmi.c
/**
* collectd - src/ipmi.c
- * Copyright (C) 2008 Florian octo Forster
- * Copyright (C) 2008 Peter Holik
+ * Copyright (C) 2008-2009 Florian octo Forster
+ * Copyright (C) 2008 Peter Holik
+ * Copyright (C) 2009 Bruno Prémont
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@
-17,8
+18,9
@@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* 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>
* Peter Holik <peter at holik.at>
+ * Bruno Prémont <bonbons at linux-vserver.org>
**/
#include "collectd.h"
**/
#include "collectd.h"
@@
-134,7
+136,7
@@
static void sensor_read_handler (ipmi_sensor_t *sensor,
if (c_ipmi_nofiy_notpresent)
{
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));
"", "", "", NULL };
sstrncpy (n.host, hostname_g, sizeof (n.host));
@@
-188,7
+190,7
@@
static void sensor_read_handler (ipmi_sensor_t *sensor,
if (c_ipmi_nofiy_notpresent)
{
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));
"", "", "", NULL };
sstrncpy (n.host, hostname_g, sizeof (n.host));
@@
-361,7
+363,7
@@
static int sensor_list_add (ipmi_sensor_t *sensor)
if (c_ipmi_nofiy_add && (c_ipmi_init_in_progress == 0))
{
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));
"", "", "", NULL };
sstrncpy (n.host, hostname_g, sizeof (n.host));
@@
-415,7
+417,7
@@
static int sensor_list_remove (ipmi_sensor_t *sensor)
if (c_ipmi_nofiy_remove && c_ipmi_active)
{
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));
"ipmi", "", "", "", NULL };
sstrncpy (n.host, hostname_g, sizeof (n.host));
@@
-630,31
+632,23
@@
static int c_ipmi_config (const char *key, const char *value)
else if (strcasecmp ("IgnoreSelected", key) == 0)
{
int invert = 1;
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)
{
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)
{
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)
{
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
c_ipmi_nofiy_notpresent = 1;
}
else
@@
-670,11
+664,12
@@
static int c_ipmi_init (void)
int status;
/* Don't send `ADD' notifications during startup (~ 1 minute) */
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;
c_ipmi_active = 1;
- status = pthread_create (&thread_id, /* attr = */ NULL, thread_main,
+ status = p
lugin_
thread_create (&thread_id, /* attr = */ NULL, thread_main,
/* user data = */ NULL);
if (status != 0)
{
/* user data = */ NULL);
if (status != 0)
{