diff --git a/packages/pnp4nagios/patches/205-improve-mkdir.patch b/packages/pnp4nagios/patches/205-improve-mkdir.patch new file mode 100644 index 000000000..6e40d409a --- /dev/null +++ b/packages/pnp4nagios/patches/205-improve-mkdir.patch @@ -0,0 +1,35 @@ +--- a/scripts/process_perfdata.pl.in 2023-02-28 15:22:09.112254795 +0100 ++++ b/scripts/process_perfdata.pl.in 2023-02-28 15:25:47.864254899 +0100 +@@ -28,6 +28,7 @@ + use strict; + use POSIX; + use Getopt::Long; ++use File::Path qw(make_path); + use Time::HiRes qw(gettimeofday tv_interval); + use vars qw ( $TEMPLATE %NAGIOS $t0 $t1 $rt $delayed_write $rrdfile @ds_create $count $line $name $ds_update $dstype %CTPL); + +@@ -429,20 +430,11 @@ + $NAGIOS{MULTI_PARENT} = $data[0]{multi_parent} || ""; + $TEMPLATE = $data[0]{template}; + +- unless ( -d "$conf{RRDPATH}" ) { +- unless ( mkdir "$conf{RRDPATH}" ) { +- print_log( "mkdir $conf{RRDPATH}, permission denied ", 1 ); +- print_log( "PNP exiting ...", 1 ); +- exit 5; +- } +- } +- ++ make_path($conf{RRDPATH}."/".$NAGIOS{HOSTNAME}); + unless ( -d "$conf{RRDPATH}/$NAGIOS{HOSTNAME}" ) { +- unless ( mkdir "$conf{RRDPATH}/$NAGIOS{HOSTNAME}" ) { +- print_log( "mkdir $conf{RRDPATH}/$NAGIOS{HOSTNAME}, permission denied ", 1 ); +- print_log( "PNP exiting ...", 1 ); +- exit 6; +- } ++ print_log( "mkdir $conf{RRDPATH}/$NAGIOS{HOSTNAME}: ".$!, 1 ); ++ print_log( "PNP exiting ...", 1 ); ++ exit 6; + } + + #