index f65e7589437b5073770020424de0c01f86ad5146..5d8c37735e25cf30cf2e4772ca6757e84e1fe8d5 100644 (file)
status = sdb_store_host(&host);
if (status < 0) {
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to "
"store/update host '%s'.\n", hostname);
free(hostname);
return -1;
else if (status > 0) /* value too old */
return 0;
- sdb_error_set(SDB_LOG_DEBUG, "MK Livestatus backend: Added/updated "
+ sdb_log(SDB_LOG_DEBUG, "MK Livestatus backend: Added/updated "
"host '%s' (last update timestamp = %"PRIscTIME").\n",
hostname, timestamp);
free(hostname);
status = sdb_store_service(&svc);
if (status < 0) {
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to "
"store/update service '%s / %s'.\n", hostname, svcname);
free(hostname);
free(svcname);
else if (status > 0) /* value too old */
return 0;
- sdb_error_set(SDB_LOG_DEBUG, "MK Livestatus backend: Added/updated "
+ sdb_log(SDB_LOG_DEBUG, "MK Livestatus backend: Added/updated "
"service '%s / %s' (last update timestamp = %"PRIscTIME").\n",
hostname, svcname, timestamp);
free(hostname);
client = SDB_OBJ_WRAPPER(user_data)->data;
if (sdb_unixsock_client_connect(client)) {
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: "
"Failed to connect to livestatus @ %s.\n",
sdb_unixsock_client_path(client));
return -1;
}
- sdb_error_set(SDB_LOG_INFO, "MK Livestatus backend: Successfully "
+ sdb_log(SDB_LOG_INFO, "MK Livestatus backend: Successfully "
"connected to livestatus @ %s.\n",
sdb_unixsock_client_path(client));
return 0;
status = sdb_unixsock_client_send(client, "GET hosts\r\n"
"Columns: name last_check");
if (status <= 0) {
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to send "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to send "
"'GET hosts' command to livestatus @ %s.\n",
sdb_unixsock_client_path(client));
return -1;
if (sdb_unixsock_client_process_lines(client, sdb_livestatus_get_host,
/* user data */ NULL, /* -> EOF */ -1, /* delim */ ";",
/* column count */ 2, SDB_TYPE_STRING, SDB_TYPE_DATETIME)) {
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to read "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to read "
"response from livestatus @ %s while reading hosts.\n",
sdb_unixsock_client_path(client));
return -1;
if ((! sdb_unixsock_client_eof(client))
|| sdb_unixsock_client_error(client)) {
char errbuf[1024];
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to read "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to read "
"host from livestatus @ %s: %s\n",
sdb_unixsock_client_path(client),
sdb_strerror(errno, errbuf, sizeof(errbuf)));
status = sdb_unixsock_client_send(client, "GET services\r\n"
"Columns: host_name description last_check");
if (status <= 0) {
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to send "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to send "
"'GET services' command to livestatus @ %s.\n",
sdb_unixsock_client_path(client));
return -1;
/* user data */ NULL, /* -> EOF */ -1, /* delim */ ";",
/* column count */ 3, SDB_TYPE_STRING, SDB_TYPE_STRING,
SDB_TYPE_DATETIME)) {
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to read "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to read "
"response from livestatus @ %s while reading services.\n",
sdb_unixsock_client_path(client));
return -1;
if ((! sdb_unixsock_client_eof(client))
|| sdb_unixsock_client_error(client)) {
char errbuf[1024];
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to read "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to read "
"services from livestatus @ %s: %s\n",
sdb_unixsock_client_path(client),
sdb_strerror(errno, errbuf, sizeof(errbuf)));
int i;
if (oconfig_get_string(ci, &name)) {
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Instance requires "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Instance requires "
"a single string argument\n\tUsage: <Instance NAME>\n");
return -1;
}
if (! strcasecmp(child->key, "Socket"))
oconfig_get_string(child, &socket_path);
else
- sdb_error_set(SDB_LOG_WARNING, "MK Livestatus backend: Ignoring "
+ sdb_log(SDB_LOG_WARNING, "MK Livestatus backend: Ignoring "
"unknown config option '%s' inside <Instance %s>.\n",
child->key, name);
}
if (! socket_path) {
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Instance '%s' "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Instance '%s' "
"missing the 'Socket' option.\n", name);
return -1;
}
client = sdb_unixsock_client_create(socket_path);
if (! client) {
char errbuf[1024];
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to create "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to create "
"unixsock client: %s\n",
sdb_strerror(errno, errbuf, sizeof(errbuf)));
return -1;
(void (*)(void *))sdb_unixsock_client_destroy);
if (! user_data) {
sdb_unixsock_client_destroy(client);
- sdb_error_set(SDB_LOG_ERR, "MK Livestatus backend: Failed to "
+ sdb_log(SDB_LOG_ERR, "MK Livestatus backend: Failed to "
"allocate sdb_object_t\n");
return -1;
}
if (! strcasecmp(child->key, "Instance"))
sdb_livestatus_config_instance(child);
else
- sdb_error_set(SDB_LOG_WARNING, "MK Livestatus backend: Ignoring "
+ sdb_log(SDB_LOG_WARNING, "MK Livestatus backend: Ignoring "
"unknown config option '%s'.\n", child->key);
}
return 0;