Nagiosgraph and colorscheme

Folkers, Lynn Lynn.Folkers at us.fujitsu.com
Tue Nov 7 22:33:26 CET 2006


Hi Peter, 

I am not understanding how this is working.  Here is the section in the
show.cgi file...

# Choose a color for service
#
sub hashcolor {
  my$c=1;map{$c=1+($c*ord)%(216)}split//,$_[0];
  my($i,$n,$m, at h);@h=(51*int$c/36,51*int$c/6%6,51*($c%6));
  for$i(0..2){$m=$i if$h[$i]<$h[$m];$n=$i if$h[$i]>$h[$n]}
  $h[$m]=102if$h[$m]>102;$h[$n]=153if$h[$n]<153;
  $c=sprintf"%06X",$h[2]+$h[1]*256+$h[0]*16**4;
  return $c;
}

# Generate all the parameters for rrd to produce a graph
#
sub rrdline {
  my($host,$service,$G,$time) = @_;
  my($g,$f,$v,$c,$ds);

  # Identify where to pull data from and what to call it
  $ds = '';
  for $g ( @$G ) {
    $f = $g->{file};
    debug(5, "CGI file=$f");
    for $v ( keys %{ $g->{line} } ) {
      $c = hashcolor($v);
      debug(5, "CGI file=$f line=$v color=$c");
      my $sv = "$v";
      $ds .= " DEF:$sv=$Config{rrddir}/$f:$v:AVERAGE";
      $ds .= " LINE2:${sv}#$c:$sv";
      $ds .= " GPRINT:$sv:MAX:'Max\\: %6.2lf%s'";
      $ds .= " GPRINT:$sv:AVERAGE:'Avg\\: %6.2lf%s'";
      $ds .= " GPRINT:$sv:MIN:'Min\\: %6.2lf%s'";
      $ds .= " GPRINT:$sv:LAST:'Cur\\: %6.2lf%s\\n'";
    }
  }

And here is the section of my map file for ping .....



# Service type: ping
# output:PING OK - 10.1.1.1 (loss=20%, rta=385.000000 ms)
# perfdata: loss=20%;79;100;0;100
rta=0.385000s;2.000000;5.000000;0.000000
#/output:PING.*?(d+)%.+?([.d]+)sms/
/perfdata:loss=([.0-9]+)%.*?rta=([.0-9]+)s;/
and push @s, [ Ping,
[ losspct, GAUGE, $1 ],
[ rta, GAUGE, $2 ] ];
 
How is the color determined in the output.  I don't see the referance in
the map file.  


-----Original Message-----
From: Peter.Ringe at web.de [mailto:Peter.Ringe at web.de] 
Sent: Tuesday, November 07, 2006 1:35 PM
To: Folkers, Lynn
Cc: nagios-users at lists.sourceforge.net
Subject: Re: [Nagios-users] Nagiosgraph and colorscheme

Hi Lynn

look for the following code in show.cgi. It calculates a hash based on
colorsheme and the name of the parameter (e.g lospct or rta for
check_ping). These names are defined in the map file and used in the rrd
database.

There is no standard way to define your own colors, but of course you
could use an own  array 'colorindex'. Just count the number of
parameters displayed in one graph and use $colorindex[$par_number]
instead of hashcolor($v);  Just three lines of code ...

hope that helps,


Peter


Folkers, Lynn schrieb:
>
> I am running Nagios 2.0 with nagiosgraph  v 1.1.1.1.  I see that there

> is an option to use color schemes 1 through 8 in the nagiosgraph.conf 
> file.  But is there a way to change the graph colors besides a general

> color scheme?  If there is not a way then is there some documentation 
> on what the 1 through 8 color schemes are?  I currently have my color 
> scheme set to 4 and the graph color lines are very similar in color 
> which makes it hard to read..
>
> # setting Colorscheme
> colorscheme = 4
>
> Thanks ...
>
> ----------------------------------------------------------------------
> --
>
> ----------------------------------------------------------------------
> --- Using Tomcat but need to do more? Need to support web services, 
> security?
> Get stuff done quickly with pre-integrated technology to make your job

> easier Download IBM WebSphere Application Server v.1.0.1 based on 
> Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=1216
> 42
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list