[Nagios-devel] Patch for Nagios 3.0a5 - increase radius of circular
Posted: Mon Jul 23, 2007 12:37 am
Hi All,
I have found that when I have a lot of hosts the circular layout
statusmap.cgi output makes the host icons overlap, this made reading their
names and details difficult.
I have made some changes to the source to increase the radius of the circle
if the hosts are too close together, this "closeness" value is defined in
the config file so you can play with it to find one that looks correct. For
my map a value of 60 seemed OK (measuring the icons I got 72 as about right
but the smaller you make it the smaller the map is).
The diff for this against the 3.0a5 CSV is below. If anyone would like to
see the difference the patch makes I could post the JPG's to the list but
will wait to see if anyone wants them.
I also removed the redundant second "default_statusmap_layout_method=0;"
line from the cgiutils.c file.
diff -d -b -B -C 3 -r cvs-3-orig/nagios/cgi/cgiutils.c
cvs-3/nagios/cgi/cgiutils.c
*** cvs-3-orig/nagios/cgi/cgiutils.c 2007-07-23 11:21:33.000000000 +0800
--- cvs-3/nagios/cgi/cgiutils.c 2007-07-23 11:52:36.000000000 +0800
***************
*** 109,114 ****
--- 109,116 ----
int refresh_rate=DEFAULT_REFRESH_RATE;
int default_statusmap_layout_method=0;
+ int default_statusmap_circular_layout_minimum_host_diameter=0;
+
int default_statuswrl_layout_method=0;
extern hostgroup *hostgroup_list;
***************
*** 179,185 ****
refresh_rate=DEFAULT_REFRESH_RATE;
default_statusmap_layout_method=0;
! default_statusmap_layout_method=0;
service_critical_sound=NULL;
service_warning_sound=NULL;
--- 181,187 ----
refresh_rate=DEFAULT_REFRESH_RATE;
default_statusmap_layout_method=0;
+ default_statusmap_circular_layout_minimum_host_diameter=0;
service_critical_sound=NULL;
service_warning_sound=NULL;
***************
*** 435,440 ****
--- 437,448 ----
default_statusmap_layout_method=atoi((temp_buffer==NULL)?"0":temp_buffer);
}
+ else
if(strstr(input,"default_statusmap_circular_layout_minimum_host_diameter=")=
=input){
+ temp_buffer=strtok(input,"=");
+ temp_buffer=strtok(NULL,"\x0");
+
default_statusmap_circular_layout_minimum_host_diameter=atoi((temp_buffer==N
ULL)?"0":temp_buffer);
+ }
+
else if(strstr(input,"default_statuswrl_layout=")==input){
temp_buffer=strtok(input,"=");
temp_buffer=strtok(NULL,"\x0");
diff -d -b -B -C 3 -r cvs-3-orig/nagios/cgi/statusmap.c
cvs-3/nagios/cgi/statusmap.c
*** cvs-3-orig/nagios/cgi/statusmap.c 2007-07-23 11:21:35.000000000 +0800
--- cvs-3/nagios/cgi/statusmap.c 2007-07-23 11:32:33.000000000 +0800
***************
*** 62,67 ****
--- 62,68 ----
extern char *statusmap_background_image;
extern int default_statusmap_layout_method;
+ extern int default_statusmap_circular_layout_minimum_host_diameter;
#define DEFAULT_NODE_WIDTH 40
#define DEFAULT_NODE_HEIGHT 65
***************
*** 2556,2561 ****
--- 2557,2588 ----
}
+ /* calculate radius necessary to give each host enough room - value of
enough set in config file - if set to 0 do nothing */
+ int calculate_radius_for_host(double anglewidth, int oldradius)
+ {
+ int newradius;
+ double tmp1;
+ newradius=oldradius;
+ /* for this angle and radius see what the width is - if it is less
than the minimum then return the new value */
+ if ( default_statusmap_circular_layout_minimum_host_diameter != 0 )
{
+ /* now do something - diam = angle/360 2 PI R
+ make 2 PI / 360 a constant 0.17453 (close enough)
+ then if diam is too small radius should become
+ DIAMWANTED * 360 / 2 PI ANGLE */
+
+ tmp1=0.017453 * anglewidth * (double) oldradius ;
+ if ( (int) tmp1 <
default_statusmap_circular_layout_minimum_host_diameter )
+ {
+ tmp1 = (double)
default_statusmap_circular_layout_minimum_host_diameter / ( 0.017453 *
anglewidth) ;
+ newradius = (int) tmp1;
+ /* now round up to nearest "standard" radius */
+ newradius = CIRCULAR_DRAWING_RADIUS * ( 1 + (int)
(newradius / CIRCULAR_DRAWING_RADIUS) ) ;
+ }
+ }
+ return newradius;
+ }
+
+
/* calculate coords of all hosts in circular layout method */
void calculate_circular_coords(void){
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
I have found that when I have a lot of hosts the circular layout
statusmap.cgi output makes the host icons overlap, this made reading their
names and details difficult.
I have made some changes to the source to increase the radius of the circle
if the hosts are too close together, this "closeness" value is defined in
the config file so you can play with it to find one that looks correct. For
my map a value of 60 seemed OK (measuring the icons I got 72 as about right
but the smaller you make it the smaller the map is).
The diff for this against the 3.0a5 CSV is below. If anyone would like to
see the difference the patch makes I could post the JPG's to the list but
will wait to see if anyone wants them.
I also removed the redundant second "default_statusmap_layout_method=0;"
line from the cgiutils.c file.
diff -d -b -B -C 3 -r cvs-3-orig/nagios/cgi/cgiutils.c
cvs-3/nagios/cgi/cgiutils.c
*** cvs-3-orig/nagios/cgi/cgiutils.c 2007-07-23 11:21:33.000000000 +0800
--- cvs-3/nagios/cgi/cgiutils.c 2007-07-23 11:52:36.000000000 +0800
***************
*** 109,114 ****
--- 109,116 ----
int refresh_rate=DEFAULT_REFRESH_RATE;
int default_statusmap_layout_method=0;
+ int default_statusmap_circular_layout_minimum_host_diameter=0;
+
int default_statuswrl_layout_method=0;
extern hostgroup *hostgroup_list;
***************
*** 179,185 ****
refresh_rate=DEFAULT_REFRESH_RATE;
default_statusmap_layout_method=0;
! default_statusmap_layout_method=0;
service_critical_sound=NULL;
service_warning_sound=NULL;
--- 181,187 ----
refresh_rate=DEFAULT_REFRESH_RATE;
default_statusmap_layout_method=0;
+ default_statusmap_circular_layout_minimum_host_diameter=0;
service_critical_sound=NULL;
service_warning_sound=NULL;
***************
*** 435,440 ****
--- 437,448 ----
default_statusmap_layout_method=atoi((temp_buffer==NULL)?"0":temp_buffer);
}
+ else
if(strstr(input,"default_statusmap_circular_layout_minimum_host_diameter=")=
=input){
+ temp_buffer=strtok(input,"=");
+ temp_buffer=strtok(NULL,"\x0");
+
default_statusmap_circular_layout_minimum_host_diameter=atoi((temp_buffer==N
ULL)?"0":temp_buffer);
+ }
+
else if(strstr(input,"default_statuswrl_layout=")==input){
temp_buffer=strtok(input,"=");
temp_buffer=strtok(NULL,"\x0");
diff -d -b -B -C 3 -r cvs-3-orig/nagios/cgi/statusmap.c
cvs-3/nagios/cgi/statusmap.c
*** cvs-3-orig/nagios/cgi/statusmap.c 2007-07-23 11:21:35.000000000 +0800
--- cvs-3/nagios/cgi/statusmap.c 2007-07-23 11:32:33.000000000 +0800
***************
*** 62,67 ****
--- 62,68 ----
extern char *statusmap_background_image;
extern int default_statusmap_layout_method;
+ extern int default_statusmap_circular_layout_minimum_host_diameter;
#define DEFAULT_NODE_WIDTH 40
#define DEFAULT_NODE_HEIGHT 65
***************
*** 2556,2561 ****
--- 2557,2588 ----
}
+ /* calculate radius necessary to give each host enough room - value of
enough set in config file - if set to 0 do nothing */
+ int calculate_radius_for_host(double anglewidth, int oldradius)
+ {
+ int newradius;
+ double tmp1;
+ newradius=oldradius;
+ /* for this angle and radius see what the width is - if it is less
than the minimum then return the new value */
+ if ( default_statusmap_circular_layout_minimum_host_diameter != 0 )
{
+ /* now do something - diam = angle/360 2 PI R
+ make 2 PI / 360 a constant 0.17453 (close enough)
+ then if diam is too small radius should become
+ DIAMWANTED * 360 / 2 PI ANGLE */
+
+ tmp1=0.017453 * anglewidth * (double) oldradius ;
+ if ( (int) tmp1 <
default_statusmap_circular_layout_minimum_host_diameter )
+ {
+ tmp1 = (double)
default_statusmap_circular_layout_minimum_host_diameter / ( 0.017453 *
anglewidth) ;
+ newradius = (int) tmp1;
+ /* now round up to nearest "standard" radius */
+ newradius = CIRCULAR_DRAWING_RADIUS * ( 1 + (int)
(newradius / CIRCULAR_DRAWING_RADIUS) ) ;
+ }
+ }
+ return newradius;
+ }
+
+
/* calculate coords of all hosts in circular layout method */
void calculate_circular_coords(void){
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]