[Nagios] Ideas of Transferring file from remote to monitor host
I'm new to Linux, Nagios, scripting, and would require some ideas to perform certain task.
Notify Nagios admins the condition of remote host database server through email. Slow query Datalog will be attached in email as well.
This is what I tried to do to do.
From Nagios monitoring host, use NRPE to execute check_mysql script to check for long running processes at the remote host. If there are any long running processes, these processes will be logged into a txt file. And, then from the remote DB host, the text file will be sent to the Nagios monitoring host, and then attached to email to notify Nagios users.
The problem now is.. I cant seem to produce a solid plan to sent the txtfile over from the remote host to the Nagios monitoring host.
This is a plan i thought of initially. Please take a look at the steps.
1) Nagios monitor use NRPE to check any long running processes at mysql DB.
2) Then, if there's long running processes, the remote host will inform NAgios monitor, which changes the condition of the service to "critical".
3) Nagios monitor will trigger event handler to use scp to grab file from remote host, and send email to notify users.
I personally think that using scp will create a huge security flaw if i store the remote host password in a eventhandling script to access remote host (is that even possible?).
Does anyone have any better ideas how I can transfer files using NRPE or Nagios?