X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fthreshold.c;h=8dcb711d5e6004bb82d266b8d9e950242681c50d;hb=d8a02e6c6f5875dfcab7b011d1f340e3a13c9e39;hp=8815a002efc260090ea9f96b8aadc2b8d5ce0148;hpb=8f4a48a804f9d95010cf5ad469e4729cebc3e0e9;p=collectd.git diff --git a/src/threshold.c b/src/threshold.c index 8815a002..8dcb711d 100644 --- a/src/threshold.c +++ b/src/threshold.c @@ -251,7 +251,6 @@ static int ut_config_type (const threshold_t *th_orig, oconfig_item_t *ci) for (i = 0; i < ci->children_num; i++) { oconfig_item_t *option = ci->children + i; - status = 0; if (strcasecmp ("Instance", option->key) == 0) status = ut_config_type_instance (&th, option); @@ -339,7 +338,6 @@ static int ut_config_plugin (const threshold_t *th_orig, oconfig_item_t *ci) for (i = 0; i < ci->children_num; i++) { oconfig_item_t *option = ci->children + i; - status = 0; if (strcasecmp ("Type", option->key) == 0) status = ut_config_type (&th, option); @@ -386,7 +384,6 @@ static int ut_config_host (const threshold_t *th_orig, oconfig_item_t *ci) for (i = 0; i < ci->children_num; i++) { oconfig_item_t *option = ci->children + i; - status = 0; if (strcasecmp ("Type", option->key) == 0) status = ut_config_type (&th, option); @@ -515,15 +512,12 @@ static int ut_report_state (const data_set_t *ds, if (state == STATE_OKAY) { if (state_old == STATE_MISSING) - status = ssnprintf (buf, bufsize, - ": Value is no longer missing."); + ssnprintf (buf, bufsize, ": Value is no longer missing."); else - status = ssnprintf (buf, bufsize, + ssnprintf (buf, bufsize, ": All data sources are within range again. " "Current value of \"%s\" is %f.", ds->ds[ds_index].name, values[ds_index]); - buf += status; - bufsize -= status; } else { @@ -537,7 +531,7 @@ static int ut_report_state (const data_set_t *ds, { if (!isnan (min) && !isnan (max)) { - status = ssnprintf (buf, bufsize, ": Data source \"%s\" is currently " + 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], (state == STATE_ERROR) ? "failure" : "warning", @@ -546,13 +540,13 @@ static int ut_report_state (const data_set_t *ds, } else { - status = 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", - (state == STATE_ERROR) ? "failure" : "warning", - isnan (min) ? max : min, - ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : ""); + 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", + (state == STATE_ERROR) ? "failure" : "warning", + isnan (min) ? max : min, + ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : ""); } } else if (th->flags & UT_FLAG_PERCENTAGE) @@ -575,7 +569,7 @@ static int ut_report_state (const data_set_t *ds, else value = 100.0 * values[ds_index] / sum; - status = ssnprintf (buf, bufsize, ": Data source \"%s\" is currently " + 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, (value < min) ? "below" : "above", @@ -584,15 +578,13 @@ static int ut_report_state (const data_set_t *ds, } else /* is not inverted */ { - status = 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", - (state == STATE_ERROR) ? "failure" : "warning", - (values[ds_index] < min) ? min : max); + 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", + (state == STATE_ERROR) ? "failure" : "warning", + (values[ds_index] < min) ? min : max); } - buf += status; - bufsize -= status; } plugin_dispatch_notification (&n); @@ -906,7 +898,6 @@ int ut_config (oconfig_item_t *ci) for (i = 0; i < ci->children_num; i++) { oconfig_item_t *option = ci->children + i; - status = 0; if (strcasecmp ("Type", option->key) == 0) status = ut_config_type (&th, option);