Page 1 of 1

I need a check for the first 2 lines of the 5 last xml files

Posted: Mon Feb 24, 2014 4:10 am
by shlelieveld
Hello all,

I'm looking for a nagios XI check plugin that displays the first 2 lines of the last 5 xml files in a folder that might contain hundreds of xml files. I could check the file age and count if they are cleaned daily, but unfortunately they aren't cleaned daily.

In the xml files a time stamp of the schedule xml file is displayed but in that folder ALL xml files remain in that folder. So over a few years hundreds of files will remain in that folder.

I'm not a script-er so I really don't know where to begin. And after looking and searching through the exchange library I couldn't find a suitable plugin.
Is there someone that needed something similar? Or is someone very handy to alter an existing, or create a simple new one?

Thank you so much.

Re: I need a check for the first 2 lines of the 5 last xml f

Posted: Mon Feb 24, 2014 10:44 am
by tmcdonald
Since this is such a specific requirement I would highly doubt there is a plugin made to do just that. You could probably get away with using grep in a bash script, once for the date and once for the lines you seek.