#include "common.h"
#include "plugin.h"
-#if HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-
#if HAVE_MACH_MACH_TYPES_H
#include <mach/mach_types.h>
#endif
if (status != kIOReturnSuccess) {
ERROR("IOMasterPort failed: %s", mach_error_string(status));
io_master_port = MACH_PORT_NULL;
- return (-1);
+ return -1;
}
- return (0);
+ return 0;
}
static void as_submit(const char *type, const char *type_instance, double val) {
- value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
- DEBUG("type = %s; type_instance = %s; val = %f;", type, type_instance, val);
-
- values[0].gauge = val;
-
- vl.values = values;
+ vl.values = &(value_t){.gauge = val};
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "apple_sensors", sizeof(vl.plugin));
- sstrncpy(vl.plugin_instance, "", sizeof(vl.plugin_instance));
sstrncpy(vl.type, type, sizeof(vl.type));
sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
int value_int;
double value_double;
if (!io_master_port || (io_master_port == MACH_PORT_NULL))
- return (-1);
+ return -1;
status = IOServiceGetMatchingServices(
io_master_port, IOServiceNameMatching("IOHWSensor"), &iterator);
if (status != kIOReturnSuccess) {
ERROR("IOServiceGetMatchingServices failed: %s", mach_error_string(status));
- return (-1);
+ return -1;
}
while ((io_obj = IOIteratorNext(iterator))) {
IOObjectRelease(iterator);
- return (0);
+ return 0;
} /* int as_read */
void module_register(void) {