added 'show_gaps' support to the 'nginx' graph

This commit is contained in:
Jordi Sanfeliu 2013-07-02 16:41:53 +02:00
parent 97ef4fc51b
commit dea72b9b05
1 changed files with 26 additions and 0 deletions

View File

@ -351,6 +351,11 @@ sub nginx_cgi {
push(@tmpz, "LINE1:reading#00EE00"); push(@tmpz, "LINE1:reading#00EE00");
push(@tmpz, "LINE1:writing#0000EE"); push(@tmpz, "LINE1:writing#0000EE");
push(@tmpz, "LINE1:waiting#EE00EE"); push(@tmpz, "LINE1:waiting#EE00EE");
if(lc($config->{show_gaps}) eq "y") {
push(@tmp, "AREA:wrongdata#$colors->{gap}:");
push(@tmpz, "AREA:wrongdata#$colors->{gap}:");
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
}
($width, $height) = split('x', $config->{graph_size}->{main}); ($width, $height) = split('x', $config->{graph_size}->{main});
if($silent =~ /imagetag/) { if($silent =~ /imagetag/) {
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag"; ($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
@ -374,6 +379,8 @@ sub nginx_cgi {
"DEF:reading=$rrd:nginx_reading:AVERAGE", "DEF:reading=$rrd:nginx_reading:AVERAGE",
"DEF:writing=$rrd:nginx_writing:AVERAGE", "DEF:writing=$rrd:nginx_writing:AVERAGE",
"DEF:waiting=$rrd:nginx_waiting:AVERAGE", "DEF:waiting=$rrd:nginx_waiting:AVERAGE",
"CDEF:allvalues=total,reading,writing,waiting,+,+,+",
@CDEF,
@tmp, @tmp,
"COMMENT: \\n"); "COMMENT: \\n");
$err = RRDs::error; $err = RRDs::error;
@ -395,6 +402,8 @@ sub nginx_cgi {
"DEF:reading=$rrd:nginx_reading:AVERAGE", "DEF:reading=$rrd:nginx_reading:AVERAGE",
"DEF:writing=$rrd:nginx_writing:AVERAGE", "DEF:writing=$rrd:nginx_writing:AVERAGE",
"DEF:waiting=$rrd:nginx_waiting:AVERAGE", "DEF:waiting=$rrd:nginx_waiting:AVERAGE",
"CDEF:allvalues=total,reading,writing,waiting,+,+,+",
@CDEF,
@tmpz); @tmpz);
$err = RRDs::error; $err = RRDs::error;
print("ERROR: while graphing $PNG_DIR" . "$PNG1z: $err\n") if $err; print("ERROR: while graphing $PNG_DIR" . "$PNG1z: $err\n") if $err;
@ -427,11 +436,17 @@ sub nginx_cgi {
} }
undef(@tmp); undef(@tmp);
undef(@tmpz); undef(@tmpz);
undef(@CDEF);
push(@tmp, "AREA:requests#44EEEE:Requests"); push(@tmp, "AREA:requests#44EEEE:Requests");
push(@tmp, "GPRINT:requests:LAST: Current\\: %5.1lf\\n"); push(@tmp, "GPRINT:requests:LAST: Current\\: %5.1lf\\n");
push(@tmp, "LINE1:requests#00EEEE"); push(@tmp, "LINE1:requests#00EEEE");
push(@tmpz, "AREA:requests#44EEEE:Requests"); push(@tmpz, "AREA:requests#44EEEE:Requests");
push(@tmpz, "LINE1:requests#00EEEE"); push(@tmpz, "LINE1:requests#00EEEE");
if(lc($config->{show_gaps}) eq "y") {
push(@tmp, "AREA:wrongdata#$colors->{gap}:");
push(@tmpz, "AREA:wrongdata#$colors->{gap}:");
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
}
($width, $height) = split('x', $config->{graph_size}->{small}); ($width, $height) = split('x', $config->{graph_size}->{small});
if($silent =~ /imagetag/) { if($silent =~ /imagetag/) {
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag"; ($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
@ -454,6 +469,8 @@ sub nginx_cgi {
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},
"DEF:requests=$rrd:nginx_requests:AVERAGE", "DEF:requests=$rrd:nginx_requests:AVERAGE",
"CDEF:allvalues=requests",
@CDEF,
@tmp); @tmp);
$err = RRDs::error; $err = RRDs::error;
print("ERROR: while graphing $PNG_DIR" . "$PNG2: $err\n") if $err; print("ERROR: while graphing $PNG_DIR" . "$PNG2: $err\n") if $err;
@ -472,6 +489,8 @@ sub nginx_cgi {
@{$cgi->{version12_small}}, @{$cgi->{version12_small}},
@{$colors->{graph_colors}}, @{$colors->{graph_colors}},
"DEF:requests=$rrd:nginx_requests:AVERAGE", "DEF:requests=$rrd:nginx_requests:AVERAGE",
"CDEF:allvalues=requests",
@CDEF,
@tmpz); @tmpz);
$err = RRDs::error; $err = RRDs::error;
print("ERROR: while graphing $PNG_DIR" . "$PNG2z: $err\n") if $err; print("ERROR: while graphing $PNG_DIR" . "$PNG2z: $err\n") if $err;
@ -555,6 +574,11 @@ sub nginx_cgi {
push(@CDEF, "CDEF:B_in=in"); push(@CDEF, "CDEF:B_in=in");
push(@CDEF, "CDEF:B_out=out"); push(@CDEF, "CDEF:B_out=out");
} }
if(lc($config->{show_gaps}) eq "y") {
push(@tmp, "AREA:wrongdata#$colors->{gap}:");
push(@tmpz, "AREA:wrongdata#$colors->{gap}:");
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
}
($width, $height) = split('x', $config->{graph_size}->{small}); ($width, $height) = split('x', $config->{graph_size}->{small});
if($silent =~ /imagetag/) { if($silent =~ /imagetag/) {
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag"; ($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
@ -579,6 +603,7 @@ sub nginx_cgi {
@warning, @warning,
"DEF:in=$rrd:nginx_bytes_in:AVERAGE", "DEF:in=$rrd:nginx_bytes_in:AVERAGE",
"DEF:out=$rrd:nginx_bytes_out:AVERAGE", "DEF:out=$rrd:nginx_bytes_out:AVERAGE",
"CDEF:allvalues=in,out,+",
@CDEF, @CDEF,
@tmp); @tmp);
$err = RRDs::error; $err = RRDs::error;
@ -600,6 +625,7 @@ sub nginx_cgi {
@warning, @warning,
"DEF:in=$rrd:nginx_bytes_in:AVERAGE", "DEF:in=$rrd:nginx_bytes_in:AVERAGE",
"DEF:out=$rrd:nginx_bytes_out:AVERAGE", "DEF:out=$rrd:nginx_bytes_out:AVERAGE",
"CDEF:allvalues=in,out,+",
@CDEF, @CDEF,
@tmpz); @tmpz);
$err = RRDs::error; $err = RRDs::error;