#include "common.h"
#include "plugin.h"
-#include <arpa/inet.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
} /* void tss2_submit_gauge */
static void tss2_submit_io (const char *plugin_instance, const char *type,
- counter_t rx, counter_t tx)
+ derive_t rx, derive_t tx)
{
/*
* Submits the io rx/tx tuple to the collectd daemon
value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
- values[0].counter = rx;
- values[1].counter = tx;
+ values[0].derive = rx;
+ values[1].derive = tx;
vl.values = values;
vl.values_len = 2;
WARNING ("teamspeak2 plugin: connect failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
close (sd);
+ sd = -1;
continue;
}
char *buffer_ptr;
buffer_ptr = fgets (buffer, sizeof (buffer), global_read_fh);
+ if (buffer_ptr == NULL)
+ {
+ WARNING ("teamspeak2 plugin: Unexpected EOF received "
+ "from remote host %s:%s.",
+ config_host ? config_host : DEFAULT_HOST,
+ config_port ? config_port : DEFAULT_PORT);
+ }
buffer[sizeof (buffer) - 1] = 0;
if (memcmp ("[TS]\r\n", buffer, 6) != 0)
gauge_t users = NAN;
gauge_t channels = NAN;
gauge_t servers = NAN;
- counter_t rx_octets = 0;
- counter_t tx_octets = 0;
- counter_t rx_packets = 0;
- counter_t tx_packets = 0;
+ derive_t rx_octets = 0;
+ derive_t tx_octets = 0;
+ derive_t rx_packets = 0;
+ derive_t tx_packets = 0;
gauge_t packet_loss = NAN;
int valid = 0;