Patches for NagiosGrapher

Lars Vogdt lars at linux-schulserver.de
Fri Nov 30 17:10:34 CET 2007


Hi Marius Hein, Christian Döbler and Gerd Mueller

I'm currently trying to build a RPM for openSUSE. By doing this, I have
created the following patches and would be very happy if you can apply them
in the main source:

config.layout patch: I have to adapt the configure.ac script so it allows
me to build with prefix='/'. 

Index: config.layout
===================================================================
--- config.layout.orig
+++ config.layout
@@ -205,3 +205,24 @@
    init_script_dir:        /etc/init.d
    logrotate_conf_dir:     /etc/logrotate.d
 </Layout>
+
+# layout for suse rpm install
+<Layout SuSE>
+  prefix:                              /
+  nagios_config:                       ${prefix}etc/nagios/nagios.cfg
+  nagios_config_cgi:                   ${prefix}etc/nagios/cgi.cfg
+  nagios_images:                       ${prefix}usr/share/nagios/images
+  nagios_images_logos:                
${prefix}usr/share/nagios/images/logos
+  nagios_folder_cgi:                   ${prefix}usr/lib/nagios/cgi
+  perl_inc:                            ${libdir}/perl5/vendor_perl/5.8.8
+  nagios_contribution:                 ${prefix}usr/lib/nagios/contrib
+  ng_config:                           ${prefix}etc/nagios
+  ng_config_sub:                       ${prefix}etc/nagios/ngraph.d
+  ng_daemon:                           ${prefix}var/run/nagiosgrapher
+  ng_srvext_file:                     
${prefix}etc/nagios/serviceextinfo.cfg
+  ng_srvext_dir:                       ${prefix}etc/nagios/serviceext
+  ng_interface_pipe:                  
${prefix}var/run/nagiosgrapher/ngraph.pipe
+  ng_logfile:                          ${prefix}var/log/nagios/ngraph.log
+  ng_rrd:                              ${prefix}var/lib/nagios/rrd
+  ng_rrd_font:                        
${prefix}usr/share/fonts/truetype/DejaVuSansMono.ttf
+</Layout>
Index: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -212,10 +212,6 @@
            AC_MSG_RESULT([invalid! Please check your layout.])
            exit 1
        fi
-       if test "x${exp_prefix}" = "x/"; then
-           AC_MSG_RESULT([is '/'! Please check your layout])
-           exit 1
-       fi
        AC_MSG_RESULT([set to '${exp_prefix}'])
    ]
 )



Next patch is a bit more interesting even for other distributions, I think.
I patched cfg/ngraph.ncfg.in, configure.ac, config.layout and Makefile.in
so you can set a "ng_tmp_path" (default /tmp/nagiosgrapher) in the
config.layout file.

Index: cfg/ngraph.ncfg.in
===================================================================
--- cfg/ngraph.ncfg.in.orig
+++ cfg/ngraph.ncfg.in
@@ -23,7 +23,7 @@
     heartbeat               AUTO
 
     rrdpath                 @NG_RRD@/
-    tmppath                 /tmp/nagiosgrapher/
+    tmppath                 @NG_TMPPATH@
 
     fontfile                @NG_RRD_FONT@
 
Index: configure.ac
===================================================================
--- configure.ac.orig
+++ configure.ac
@@ -115,6 +115,7 @@
 	NG_SUBST_EXPANDED_ARG(ng_logfile)
 	NG_SUBST_EXPANDED_ARG(ng_rrd)
 	NG_SUBST_EXPANDED_ARG(ng_rrd_font)
+    NG_SUBST_EXPANDED_ARG(ng_tmp_path)
 	NG_SUBST_EXPANDED_ARG(ng_cgi)
 	NG_SUBST_EXPANDED_ARG(ng_logos)
 	NG_SUBST_EXPANDED_ARG(ng_pid_file)
@@ -430,6 +431,7 @@
 AC_SUBST([NG_LOGFILE],			${exp_ng_logfile})
 AC_SUBST([NG_RRD],			${exp_ng_rrd})
 AC_SUBST([NG_RRD_FONT],			${exp_ng_rrd_font})
+AC_SUBST([NG_TMPPATH],      ${exp_ng_tmp_path})
 AC_SUBST([NG_CGI],			${exp_ng_cgi})
 AC_SUBST([NG_LOGOS],			${exp_ng_logos})
 AC_SUBST([NG_PREFIX],			${exp_prefix})
Index: config.layout
===================================================================
--- config.layout.orig
+++ config.layout
@@ -19,6 +19,7 @@
 	ng_logfile:			${prefix}/var/ngraph.log
 	ng_rrd:				${prefix}/var/rrd
 	ng_rrd_font:			/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf
+    ng_tmp_path:            /tmp/nagiosgrapher
 	ng_cgi:				/nagios/cgi-bin
 	ng_logos:			/nagios/images/logos
 	ng_pid_file:			${ng_daemon}/nagios_grapher.pid
@@ -45,6 +46,7 @@
 	ng_logfile:			${prefix}/var/ngraph.log
 	ng_rrd:				${prefix}/var/rrd
 	ng_rrd_font:			/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf
+    ng_tmp_path:            /tmp/nagiosgrapher
 	ng_cgi:				/nagios/cgi-bin
 	ng_logos:			/nagios/images/logos
 	ng_pid_file:			${ng_daemon}/nagios_grapher.pid
@@ -71,6 +73,7 @@
 	ng_logfile:			/var/log/nagiosgrapher/ngraph.log
 	ng_rrd:				/var/lib/nagiosgrapher/rrd
 	ng_pid_file:			${ng_daemon}/nagios_grapher.pid
+    ng_tmp_path:            /tmp/nagiosgrapher
 	init_script_dir:		/etc/init.d
 	logrotate_conf_dir:		/etc/logrotate.d
 </Layout>
@@ -94,6 +97,7 @@
 	ng_logfile:			${prefix}/var/ngraph.log
 	ng_rrd:				${prefix}/var/rrd
 	ng_rrd_font:			/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf
+    ng_tmp_path:            /tmp/nagiosgrapher
 	ng_cgi:				/nagios/cgi-bin
 	ng_logos:			/nagios/images/logos
 	ng_pid_file:			${ng_daemon}/nagios_grapher.pid
@@ -120,6 +124,7 @@
 	ng_logfile:			/var/log/nagios2/ngraph.log
 	ng_rrd:				/var/lib/nagios2/rrd
 	ng_rrd_font:			/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
+    ng_tmp_path:            /tmp/nagiosgrapher
 	ng_cgi:				/nagios2/cgi-bin
 	ng_logos:			/nagios2/images/logos
 	ng_pid_file:			${ng_daemon}/nagios_grapher.pid
@@ -146,6 +151,7 @@
 	ng_logfile:			/var/log/nagios/ngraph.log
 	ng_rrd:				/var/lib/nagios/rrd
 	ng_rrd_font:			/usr/local/rrdtool/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
+    ng_tmp_path:            /tmp/nagiosgrapher
 	# and to add for fontfile in ngraph.ncfg:
 	# ng_rrd_font:			${datadir}/rrdtool/fonts/DejaVuSansMono-Roman.ttf
 	ng_cgi:				/nagios/cgi-bin
@@ -173,6 +179,7 @@
 	ng_logfile:			/var/log/nagios/ngraph.log
 	ng_rrd:				/var/nagios/rrd
 	ng_rrd_font:			/usr/local/rrdtool/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
+    ng_tmp_path:            /tmp/nagiosgrapher
 	ng_cgi:				/nagios/cgi-bin
 	ng_logos:			/nagios/images/logos
 	ng_pid_file:			${ng_daemon}/nagios_grapher.pid
@@ -199,6 +206,7 @@
 	ng_logfile:			/var/log/nagios/ngraph.log
 	ng_rrd:				/var/lib/nagios/rrd
 	ng_rrd_font:			/usr/local/rrdtool/share/rrdtool/fonts/DejaVuSansMono-Roman.ttf
+    ng_tmp_path:            /tmp/nagiosgrapher
 	ng_cgi:				/nagios/cgi-bin
 	ng_logos:			/nagios/images/logos
 	ng_pid_file:			${ng_daemon}/nagios_grapher.pid
@@ -225,4 +233,5 @@
   ng_logfile:                          ${prefix}var/log/nagios/ngraph.log
   ng_rrd:                              ${prefix}var/lib/nagios/rrd
   ng_rrd_font:                        
${prefix}usr/share/fonts/truetype/DejaVuSansMono.ttf
+  ng_tmp_path:                        
${prefix}var/spool/nagios/nagiosgrapher
 </Layout>
Index: Makefile.in
===================================================================
--- Makefile.in.orig
+++ Makefile.in
@@ -20,6 +20,7 @@
 NG_LOGLEVEL			= @NG_LOGLEVEL@
 NG_RRD				= @NG_RRD@
 NG_RRD_FONT			= @NG_RRD_FONT@
+NG_TMPPATH          = @NG_TMPPATH@
 NG_INTERFACE_PIPE		= @NG_INTERFACE_PIPE@
 
 NG_SRVEXT			= @NG_SRVEXT@



Last Patch: SrvExtWriteHostextInfo.pm.in has a hardcoded path to
/usr/local/nagios/etc/hostext/ - this should IMHO be replaced by the
following patch:

Index: lib/NagiosGrapher/Hooks/SrvExtWriteHostextInfo.pm.in
===================================================================
--- lib/NagiosGrapher/Hooks/SrvExtWriteHostextInfo.pm.in.orig
+++ lib/NagiosGrapher/Hooks/SrvExtWriteHostextInfo.pm.in
@@ -97,7 +97,7 @@
 sub prepare {
    my $self = shift;

-   $self->{'dir'} = '/usr/local/nagios/etc/hostext/';
+   $self->{'dir'} = '@NG_CONFIG@/hostext/';
    $self->{'file'} = $self->{'dir'}. $self->Host. '.cfg';

    if (!$self->check_entry_exists()) {


Thanks in advance for your responses (even if good or bad ;-) !

Lars



-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
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