Call for configs

Frost, Mark {BIS} mark.frost1 at pepsico.com
Mon Aug 27 21:39:39 CEST 2012





> -----Original Message-----
> From: Andreas Ericsson [mailto:ae at op5.se]
> Sent: Monday, August 27, 2012 9:37 AM
> To: nagios-devel; Nagios-users at lists.sourceforge.net
> Subject: [Nagios-devel] Call for configs



<...>



> I've created a small scriptlet that will let you anonymize most of

> your configuration, which can be downloaded from here:

> http://dl.dropbox.com/u/83439435/scripts/nagios-anonymizer.sh



Andreas,



I decided to give this a whirl to see what I wound up with and if it was something I felt I could send along.  As it turns out I'm having trouble getting this script to work right.  I've been trying to debug the script on our servers, but given that I'm not entirely certain what each step is supposed to be doing, it makes it difficult to figure out how to fix it.



First thing is that the bourne shell's I've got here (SLES Linux 11.1) don't like parens when you call a shell function so I needed to change:



12c12

< if test "$#" -ne 2; then usage(); fi

---

> if test "$#" -ne 2; then usage; fi



to make it not error out.



The usage seems to indicate that I should be running it as



./nagios-anonymizer.sh /opt/nagios/core/bin/nagios /opt/nagios/core/etc/nagios.cfg



That runs OK and gets the vs-output file, but when it runs the sed line



sed -i "s/^cfg_.*/$ncpath/" > nagios.cfg



sed gives me a talkin' to with



+ sed -i 's/^cfg_.*//opt/nagios/core/etc/nagios.cfg/'

sed: -e expression #1, char 12: unknown option to `s'





I'm assuming that I should use the GNU sed feature that allows me to use a different separator, but additionally, I don't see where there's an input file specified for sed either.   I changed it to



sed -i "s#^cfg_.*#$ncpath#" $ncpath > nagios.cfg



While that doesn't generate errors, it also doesn't generate anything in the nagios.cfg output file.  I'm not sure what this line is supposed to be doing.  It would appear that the intent is to replace a line in nagios.cfg like



cfg_dir=/opt/nagios/core/etc/oconf



with just



/opt/nagios/core/etc/nagios.cfg



(that doesn't seem right to me either).  Perhaps the intent was to do something like



sed -i "s#^cfg_.*#$ncpath#" vs-output > nagios.cfg



?



Then it seems to just hang on the next sed line ("Processing object config files...") presumably because there's no input file there and it's try to read stdin.



Oh, and perhaps rather importantly, you define "wkdir=" at the top, but then refer to "workdir" everywhere else in the file).



Mark






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20120827/ee9833d7/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list