X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fipvs.c;h=ab76f1eb8638d2517dd1e56ddb981148d17ed556;hb=aff80830f1154a5b6c4da16a0b1033aafde14e24;hp=a64e7b7a99d56a4896c444235a10cf14090fbdf3;hpb=4e6812d3e5073e5b4bd7eaef9f2539c8c9dd28a4;p=collectd.git diff --git a/src/ipvs.c b/src/ipvs.c index a64e7b7a..ab76f1eb 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -225,23 +225,20 @@ static int get_ti (struct ip_vs_dest_entry *de, char *ti, size_t size) return 0; } /* get_ti */ -static void cipvs_submit_connections (char *pi, char *ti, counter_t value) +static void cipvs_submit_connections (char *pi, char *ti, derive_t value) { value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].counter = value; + values[0].derive = value; vl.values = values; vl.values_len = 1; - vl.time = time (NULL); - vl.interval = interval_g; - - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "ipvs"); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance)); - strcpy (vl.type, "connections"); + sstrncpy (vl.type, "connections", sizeof (vl.type)); sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total", sizeof (vl.type_instance)); @@ -250,22 +247,19 @@ static void cipvs_submit_connections (char *pi, char *ti, counter_t value) } /* cipvs_submit_connections */ static void cipvs_submit_if (char *pi, char *t, char *ti, - counter_t rx, counter_t tx) + derive_t rx, derive_t tx) { 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; - vl.time = time (NULL); - vl.interval = interval_g; - - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "ipvs"); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "ipvs", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, pi, sizeof (vl.plugin_instance)); sstrncpy (vl.type, t, sizeof (vl.type)); sstrncpy (vl.type_instance, (NULL != ti) ? ti : "total", @@ -280,7 +274,7 @@ static void cipvs_submit_dest (char *pi, struct ip_vs_dest_entry *de) { char ti[DATA_MAX_NAME_LEN]; - if (0 != get_ti (de, ti, DATA_MAX_NAME_LEN)) + if (0 != get_ti (de, ti, sizeof (ti))) return; cipvs_submit_connections (pi, ti, stats.conns); @@ -298,7 +292,7 @@ static void cipvs_submit_service (struct ip_vs_service_entry *se) int i = 0; - if (0 != get_pi (se, pi, DATA_MAX_NAME_LEN)) + if (0 != get_pi (se, pi, sizeof (pi))) return; cipvs_submit_connections (pi, NULL, stats.conns);