#include "collectd.h"
-#include "common.h" /* rrd_update_file */
-#include "plugin.h" /* plugin_register, plugin_submit */
+#include "plugin.h" /* plugin_register, plugin_submit */
+#include "utils/common/common.h" /* rrd_update_file */
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
* Private variables
*/
/* Default values for contacting daemon */
-static char *conf_node = NULL;
-static char *conf_service = NULL;
+static char *conf_node;
+static char *conf_service;
/* Defaults to false for backwards compatibility. */
-static _Bool conf_report_seconds = 0;
-static _Bool conf_persistent_conn = 1;
+static bool conf_report_seconds;
+static bool conf_persistent_conn = true;
static int global_sockfd = -1;
-static int count_retries = 0;
-static int count_iterations = 0;
+static int count_retries;
+static int count_iterations;
static int net_shutdown(int *fd) {
uint16_t packet_size = 0;
"first %i iterations. Will close the socket "
"in future iterations.",
count_retries, count_iterations);
- conf_persistent_conn = 0;
+ conf_persistent_conn = false;
}
while ((n = net_recv(&global_sockfd, recvline, sizeof(recvline) - 1)) > 0) {
}
static int apcups_config(oconfig_item_t *ci) {
- _Bool persistent_conn_set = 0;
+ bool persistent_conn_set = false;
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
cf_util_get_boolean(child, &conf_report_seconds);
else if (strcasecmp(child->key, "PersistentConnection") == 0) {
cf_util_get_boolean(child, &conf_persistent_conn);
- persistent_conn_set = 1;
+ persistent_conn_set = true;
} else
ERROR("apcups plugin: Unknown config option \"%s\".", child->key);
}
"Apcupsd NIS socket timeout is %.3f seconds, "
"PersistentConnection disabled by default.",
interval, APCUPS_SERVER_TIMEOUT);
- conf_persistent_conn = 0;
+ conf_persistent_conn = false;
}
}