Re: [Nagios-devel] Call for configs

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] Call for configs

Post by Guest »

Hi Andreas,

this is a diff to make it work with POSIX tools (tested on OpenBSD) and
adding more anonymization (notes_url and comments):

--- nagios-anonymizer.sh Tue Aug 28 12:03:11 2012
+++ nagios-anonymizer-portable.sh Tue Aug 28 12:33:09 2012
@@ -32,11 +32,11 @@
sed -n "s/^Processing object config file '\([^']*\)'.*/\1/p" vs-output > oconf-files

echo "Concatenating and minimizing object config"
-sed 's/^[\t ]*//' $(cat oconf-files) > objects.cfg
+sed 's/^[[:space:]]*//' $(cat oconf-files) > temp.cfg

echo "Anonymizing..."
-sed -i \
- -e 's/^address[\t ].*/address ANON/' \
+sed \
+ -e 's/^address[[:space:]].*/address ANON/' \
-e 's/^email.*/email ANON/' \
-e 's/^pager.*/pager ANON/' \
-e 's/address[1-7].*/address ANON/' \
@@ -45,7 +45,9 @@
-e 's/^\(host_notification_commands\).*/\1 host-notifyANONYMIZED/' \
-e 's/^\(service_notification_commands\).*/\1 service-notifyANONYMIZED/' \
-e 's/^\(command_line\).*/command_line ANONYMIZED/' \
- objects.cfg
+ -e 's/^notes_url.*/notes_url ANON/' \
+ -e 's/^#.*//' \
+ temp.cfg > objects.cfg

c=$(grep -c ANON objects.cfg)
echo "Anonymized $c strings"
@@ -58,7 +60,7 @@
fi

echo "Done :)"
-size=$(stat $anon_cfg_file | sed -n 2p | awk '{ print $2 }')
+size=$(wc -c $anon_cfg_file | awk '{ print $1 }')
echo "Successfully created $workdir/$anon_cfg_file"
if test $size -gt 10000000; then
echo "The file is larger than 10MB, so please attach it to a dropbox"

Regards,
Armin Wolfermann





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked