Additional image for action_url in host and service definitions patch
Andreas Ericsson
ae at op5.se
Sat Nov 29 14:17:25 CET 2008
Wim Hoekman wrote:
> Hello all,
>
> For some services my action_url is set to view performance
> data (graphs), while for other services the action_url is set to lead to
> an external webbased system to perform additional commands.
>
> To be able to see what action is to be performed in the Service Detail
> overview , I would like to be able to define different images for
> different actions.
>
> Some time ago (almost a year) I posted a request for this, but since
> then nothing happened.
>
> So, I decided to roll up my sleeves, and make the modifications myself.
>
Sweet. That's usually the best way to make something happen :)
> The attached patch adds the field 'action_image' to be defined for
> hosts, hostgroups, services, and service groups:
>
> define service {
> use template
> host_name host1
> service_description Load
> action_url http://....
> action_image action1.gif
> }
>
> If the action_image is not defined, the default red "splat" icon is used.
>
Nifty feature. I like it.
> Attached patch is made against 3.0.5, and is already running on my
> production Nagios server.
>
> I would be very happy if this patch can be included in the next Nagios
> release.
>
I'll queue it when I get a chance, and will extend it to also grok
notes_image (for notes_url) for consistency. However, altering the
sizes of the internal structures modifies the ABI for all NEB-modules,
so it's not something that can be done without bumping the minor-number
for a Nagios release. That means that this patch would force the next
Nagios-version to be called 3.1.0 (instead of 3.0.6), and I'm not sure
this functionality alone would be enough to warrant such a step.
Anyways, comments below:
--8<--8<--8<--
@@ -541,7 +549,12 @@
This directive is used to define an optional URL that can be used to provide more actions to be performed on the host group. If you specify an URL, you will see a red "splat" icon in the CGIs (when you are viewing hostgroup information) that links to the URL you specify here. Any valid URL can be used. If you plan on using relative paths, the base path will the the same as what is used to access the CGIs (i.e. <i>/cgi-bin/nagios/</i>).
</td>
</tr>
-</table>
+<tr>
+<td valign="top"><strong>action_image</strong>:</td>
+<td>
+This optional directive is used to define the name of a GIF, PNG, or JPG image that can be used instead of the red "splat" icon for the action_url. If you plan on using relative paths, the base path will be your HTML images directory (i.e. <i>/usr/local/nagios/share/images</i>).
+</td>
+</tr>
<p>
--8<--8<--8<--
It seems you removed the </table> closing tag completely. Deliberate
or erroneously?
--8<--8<--8<--
diff -ru nagios-3.0.5.org/include/objects.h nagios-3.0.5/include/objects.h
--- nagios-3.0.5.org/include/objects.h Mon Mar 31 21:09:36 2008
+++ nagios-3.0.5/include/objects.h Fri Nov 28 12:59:51 2008
@@ -452,7 +458,9 @@
char *failure_prediction_options;
char *notes;
char *notes_url;
+ char *notes_img;
char *action_url;
+ char *action_image;
char *icon_image;
char *icon_image_alt;
customvariablesmember *custom_variables;
diff -ru nagios-3.0.5.org/xdata/xodtemplate.h nagios-3.0.5/xdata/xodtemplate.h
--- nagios-3.0.5.org/xdata/xodtemplate.h Thu Feb 28 20:27:55 2008
+++ nagios-3.0.5/xdata/xodtemplate.h Fri Nov 28 12:59:51 2008
@ -269,7 +269,9 @@
char *failure_prediction_options;
char *notes;
char *notes_url;
+ char *notes_img;
char *action_url;
+ char *action_image;
char *icon_image;
char *icon_image_alt;
char *vrml_image;
@@ -295,7 +297,9 @@
int have_failure_prediction_options;
int have_notes;
int have_notes_url;
+ int have_notes_img;
int have_action_url;
+ int have_action_image;
int have_icon_image;
int have_icon_image_alt;
int have_vrml_image;
@@ -346,13 +350,17 @@
char *hostgroup_members;
char *notes;
char *notes_url;
+ char *notes_img;
char *action_url;
+ char *action_image;
int have_members;
int have_hostgroup_members;
int have_notes;
int have_notes_url;
+ int have_notes_img;
int have_action_url;
+ int have_action_image;
int has_been_resolved;
int register_object;
@@ -415,7 +423,9 @@
char *failure_prediction_options;
char *notes;
char *notes_url;
+ char *notes_img;
char *action_url;
+ char *action_image;
char *icon_image;
char *icon_image_alt;
int retain_status_information;
@@ -436,7 +446,9 @@
int have_failure_prediction_options;
int have_notes;
int have_notes_url;
+ int have_notes_img;
int have_action_url;
+ int have_action_image;
int have_icon_image;
int have_icon_image_alt;
@@ -486,13 +498,17 @@
char *servicegroup_members;
char *notes;
char *notes_url;
+ char *notes_img;
char *action_url;
+ char *action_image;
int have_members;
int have_servicegroup_members;
int have_notes;
int have_notes_url;
+ int have_notes_img;
int have_action_url;
+ int have_action_image;
int has_been_resolved;
int register_object;
@@ -674,7 +690,9 @@
char *hostgroup_name;
char *notes;
char *notes_url;
+ char *notes_img;
char *action_url;
+ char *action_image;
char *icon_image;
char *icon_image_alt;
char *vrml_image;
@@ -689,7 +707,9 @@
int have_hostgroup_name;
int have_notes;
int have_notes_url;
+ int have_notes_img;
int have_action_url;
+ int have_action_image;
int have_icon_image;
int have_icon_image_alt;
int have_vrml_image;
@@ -716,7 +736,9 @@
char *service_description;
char *notes;
char *notes_url;
+ char *notes_img;
char *action_url;
+ char *action_image;
char *icon_image;
char *icon_image_alt;
@@ -725,7 +747,9 @@
int have_service_description;
int have_notes;
int have_notes_url;
+ int have_notes_img;
int have_action_url;
+ int have_action_image;
int have_icon_image;
int have_icon_image_alt;
--8<--8<--8<
You're adding notes_img in an awful lot of places, but you never use it.
I'm not really opposed to it, as I think action_image should be accompanied
by a notes_image option, but I also like a "perfect patch", and I feel
that unused variables are better left out of the code.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
More information about the Developers
mailing list