output: make --skip-ok to effect --perfdata

Reported-by: Frank Bulk <fbulk@mypremieronline.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-12 17:29:40 +00:00
parent ef5421ed05
commit 15f08bbf02
No known key found for this signature in database
GPG key ID: A9553245FDE9B739

View file

@ -973,7 +973,6 @@ static int output_alarming(struct conf_t *state)
{
FILE *outfile;
struct range_t *range_p;
double range_size;
struct shared_network_t *shared_p;
struct output_helper_t oh;
unsigned int i;
@ -982,7 +981,6 @@ static int output_alarming(struct conf_t *state)
outfile = open_outfile(state);
range_p = state->ranges;
range_size = get_range_size(range_p);
if (state->number_limit & R_BIT) {
for (i = 0; i < state->num_ranges; i++) {
@ -1065,13 +1063,15 @@ static int output_alarming(struct conf_t *state)
if (state->perfdata == 1 && state->number_limit & R_BIT) {
for (i = 0; i < state->num_ranges; i++) {
range_p--;
range_size = get_range_size(range_p);
if (state->minsize < range_size) {
range_output_helper(state, &oh, range_p);
if (state->skip_ok && oh.status == STATUS_OK)
continue;
if (state->minsize < oh.range_size) {
fprintf(outfile, " %s_r=", ntop_ipaddr(&range_p->first_ip));
fprintf(outfile, "%g;%g;%g;0;%g",
range_p->count,
(range_size * state->warning / 100),
(range_size * state->critical / 100), range_size);
(oh.range_size * state->warning / 100),
(oh.range_size * state->critical / 100), oh.range_size);
fprintf(outfile, " %s_rt=%g",
ntop_ipaddr(&range_p->first_ip), range_p->touched);
if (state->backups_found == 1) {
@ -1097,6 +1097,9 @@ static int output_alarming(struct conf_t *state)
}
if (state->perfdata == 1 && state->header_limit & R_BIT) {
for (shared_p = state->shared_net_root->next; shared_p; shared_p = shared_p->next) {
shnet_output_helper(state, &oh, shared_p);
if (state->skip_ok && oh.status == STATUS_OK)
continue;
if (state->minsize < shared_p->available) {
fprintf(outfile, " '%s_s'=%g;%g;%g;0;%g",
shared_p->name,