X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fthreshold.c;h=93ca5fdbda75bff290a6cd2b81d7321883be008e;hp=a3d865bac973fae6354faa1be3d95669fe7b57fa;hb=abaa1c8a24e8eff5632dd6052b1da5f6535caf19;hpb=47a8c3f0893a4ad8ef8f690ae0bd496ef55dcdcd diff --git a/src/threshold.c b/src/threshold.c index a3d865ba..93ca5fdb 100644 --- a/src/threshold.c +++ b/src/threshold.c @@ -335,22 +335,22 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl, n.time = vl->time; - status = snprintf(buf, bufsize, "Host %s, plugin %s", vl->host, vl->plugin); + status = ssnprintf(buf, bufsize, "Host %s, plugin %s", vl->host, vl->plugin); buf += status; bufsize -= status; if (vl->plugin_instance[0] != '\0') { - status = snprintf(buf, bufsize, " (instance %s)", vl->plugin_instance); + status = ssnprintf(buf, bufsize, " (instance %s)", vl->plugin_instance); buf += status; bufsize -= status; } - status = snprintf(buf, bufsize, " type %s", vl->type); + status = ssnprintf(buf, bufsize, " type %s", vl->type); buf += status; bufsize -= status; if (vl->type_instance[0] != '\0') { - status = snprintf(buf, bufsize, " (instance %s)", vl->type_instance); + status = ssnprintf(buf, bufsize, " (instance %s)", vl->type_instance); buf += status; bufsize -= status; } @@ -365,9 +365,9 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl, /* Send an okay notification */ if (state == STATE_OKAY) { if (state_old == STATE_MISSING) - snprintf(buf, bufsize, ": Value is no longer missing."); + ssnprintf(buf, bufsize, ": Value is no longer missing."); else - snprintf(buf, bufsize, ": All data sources are within range again. " + ssnprintf(buf, bufsize, ": All data sources are within range again. " "Current value of \"%s\" is %f.", ds->ds[ds_index].name, values[ds_index]); } else if (state == STATE_UNKNOWN) { @@ -383,7 +383,7 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl, if (th->flags & UT_FLAG_INVERT) { if (!isnan(min) && !isnan(max)) { - snprintf(buf, bufsize, + ssnprintf(buf, bufsize, ": Data source \"%s\" is currently " "%f. That is within the %s region of %f%s and %f%s.", ds->ds[ds_index].name, values[ds_index], @@ -391,7 +391,7 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl, ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "", max, ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : ""); } else { - snprintf(buf, bufsize, ": Data source \"%s\" is currently " + ssnprintf(buf, bufsize, ": Data source \"%s\" is currently " "%f. That is %s the %s threshold of %f%s.", ds->ds[ds_index].name, values[ds_index], isnan(min) ? "below" : "above", @@ -416,7 +416,7 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl, else value = 100.0 * values[ds_index] / sum; - snprintf(buf, bufsize, + ssnprintf(buf, bufsize, ": Data source \"%s\" is currently " "%g (%.2f%%). That is %s the %s threshold of %.2f%%.", ds->ds[ds_index].name, values[ds_index], value, @@ -425,7 +425,7 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl, (value < min) ? min : max); } else /* is not inverted */ { - snprintf(buf, bufsize, ": Data source \"%s\" is currently " + ssnprintf(buf, bufsize, ": Data source \"%s\" is currently " "%f. That is %s the %s threshold of %f.", ds->ds[ds_index].name, values[ds_index], (values[ds_index] < min) ? "below" : "above", @@ -689,7 +689,7 @@ static int ut_missing(const value_list_t *vl, FORMAT_VL(identifier, sizeof(identifier), vl); NOTIFICATION_INIT_VL(&n, vl); - snprintf(n.message, sizeof(n.message), + ssnprintf(n.message, sizeof(n.message), "%s has not been updated for %.3f seconds.", identifier, CDTIME_T_TO_DOUBLE(missing_time)); n.time = now;