[Nagiosplug-devel] check_mrtgtraf: add link to the mrtg graph

Carlos Peón Costa carlospeon at hotmail.com
Tue Oct 26 21:00:00 CEST 2004


Hi, here is a simple patch to add a link (really any text) to the plugin 
output, so you can click and go to the mrtg graph directly from nagios.

32a33
>char *mrtg_link = NULL;
178c179
<       asprintf (&error_message, _("%s. In = %0.1f %s, %s. Out = %0.1f 
%s|%s %s\n"),
---
>       asprintf (&error_message, _("%s. In = %0.1f %s, %s. Out = %0.1f %s 
>%s|%s %s\n"),
181a183
>                   (mrtg_link == NULL) ? "" : mrtg_link,
209a212
>               {"link", required_argument, 0, 'l'},
229c232
<               c = getopt_long (argc, argv, "hVF:e:a:c:w:", longopts, 
&option);
---
>               c = getopt_long (argc, argv, "hVF:e:a:c:w:l:", longopts, 
>&option);
254a258,260
>               case 'l':                                                    
>                    /* link mrtg page */
>                       mrtg_link = optarg;
>                       break;
340c346,348
<    Critical threshold pair \"<incoming>,<outgoing>\"\n"));
---
>    Critical threshold pair \"<incoming>,<outgoing>\"\n\
>  -l, --link\n\
>    MRTG link \n"));


Command definition example:

# 'traffic_max' command definition
define command{
        command_name    traffic_max
        command_line    /usr/lib/nagios/plugins/check_mrtgtraf -F "$ARG1$" 
-e 10 -a MAX -w $ARG2$ -c $ARG3$ -l "$ARG4$"
        }

Service example:

# Trafico interno pix_principal
define service{
        use                             generic-service
        host_name                       pix_principal
        service_description             Traf. Int.
        notification_period             workhours
        check_command                
traffic_max!/var/www/mrtg/10.5.1.10_avaya_inc._-_p333t_10_100base-tx_port_22_on_unit_2.log!90000000,90000000!100000000,100000000!<a 
href='/mrtg/10.5.1.10_avaya_inc._-_p333t_10_100base-tx_port_22_on_unit_2.html' 
style='font-size:6pt'>MRTG</a>
}


Thanks,

Carlos Peon Costa
carlospeon at hotmail.com

_________________________________________________________________
Un amor, una aventura, compañía para un viaje. Regístrate gratis en MSN Amor 
& Amistad. http://match.msn.es/





More information about the Devel mailing list