Hi,
I have a bash script that runs every minute and creating a TXT file with the output.
I trying to figure how i can display the output of the TXT file on Nagios GUI and alert according to the output.
for an example, if the TXT file says "OK" - show the output on Nagios GUI and the status will be OK.
If the TXT file says "Problem" - show the output on Nagios GUI and the status will be critical
Appreciate your help.
Thanks
Check file string and show the output
Re: Check file string and show the output
Does your text file get "completely overwritten" every minute or you append to the existing text? Other words, do you expect to have only one "OK" or "Problem" pattern in the file or multiple ones (some old and some new)? You can look for a suitable plugin on the Nagios Exchange.
If you needed something simple (when you don't have multiple "OK" or "Problem" entries in the file), you could probably modify this script a bit to achieve your goal:
https://gist.githubusercontent.com/dvar ... in_file.sh
If you needed a plugin with a greater functionality, you could try this one:
https://labs.consol.de/nagios/check_logfiles/index.html
or search Nagios Exchange for other plugins.
If you needed something simple (when you don't have multiple "OK" or "Problem" entries in the file), you could probably modify this script a bit to achieve your goal:
https://gist.githubusercontent.com/dvar ... in_file.sh
If you needed a plugin with a greater functionality, you could try this one:
https://labs.consol.de/nagios/check_logfiles/index.html
or search Nagios Exchange for other plugins.
Be sure to check out our Knowledgebase for helpful articles and solutions!