Hi,
We want to read a file in a specific path in a linux server (Alarm file) and them send the contents over mail.
Pls let us know how we can achieve it.
PS: We have email configured already.
Thanks.
Read a file in Linux server
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Read a file in Linux server
Hello @ets_user,
Just to clarify, you want to monitor a file on a Linux server, and when some value or keyword is present in the file, you want to send the contents of the file by email.
One option is to use Event Handlers in Nagios XI to execute a bash script send the file. The development of customs scripts is out of scope for product support, but the following document will help get you started.
Introduction to Event Handlers in Nagios XI
Take a look and let me know if you have any questions.
Just to clarify, you want to monitor a file on a Linux server, and when some value or keyword is present in the file, you want to send the contents of the file by email.
One option is to use Event Handlers in Nagios XI to execute a bash script send the file. The development of customs scripts is out of scope for product support, but the following document will help get you started.
Introduction to Event Handlers in Nagios XI
Take a look and let me know if you have any questions.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Read a file in Linux server
I don't think I have enough detail to provide solution yet but There is the /usr/local/nagios/libexec/check_log plugin which is default on XI systems. You may also want to check out - https://labs.consol.de/nagios/check_logfiles/index.html.
If you need further assistance please answer the following:
Is the file on the XI server or another remote server that XI is monitoring?
Are you trying to alert if specific strings are found or when other conditions are met?
Are you trying to send the entire file or just a portion? This may not be doable, but if you can provide more details we can better provide guidance.
If you need further assistance please answer the following:
Is the file on the XI server or another remote server that XI is monitoring?
Are you trying to alert if specific strings are found or when other conditions are met?
Are you trying to send the entire file or just a portion? This may not be doable, but if you can provide more details we can better provide guidance.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Read a file in Linux server
Kinldy find below details for more clarity.
Is the file on the XI server or another remote server that XI is monitoring?
Is the file on the XI server or another remote server that XI is monitoring?
Are you trying to alert if specific strings are found or when other conditions are met?Its on another remote Linux server where NRPE agent is running and monitoring CPU,Memory etc..
Are you trying to send the entire file or just a portion? This may not be doable, but if you can provide more details we can better provide guidance.Yes, if the file has error string we want to send that error message by email
Please advise.Entire file for now, but we might need to parse the file and get the required format in future
Re: Read a file in Linux server
Thanks for the extra information. With that I would second the recommendation of @benjaminsmith of using an event handler to email the file. https://assets.nagios.com/downloads/nag ... ios-XI.pdf
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.