in reply to RFC - PERL SCRIPT TO SSH MULTIPLE SERVER NODES, CHECKS OF SSL CERTIFICATES EXPIRY AND EMAIL TO ROOT
In no particular order, some additional comments:
If you have a lot of systems to check, consider threading/job queue. Personally, I use AnyEvent + AnyEvent::Util::run_cmd to run a dozen or two ssh's in parallel (no job queue - this isn't enough ssh's to matter, but if you have 40+ systems to check, you may want a job queue). If you take the above advice and then put it in a cron job, this may not matter as you can schedule it for a time when it can take a long time and when the network is otherwise not in significant use (e.g., 4AM). If all the systems are on a local Gbps network, this will also not matter. But if some systems are located in other physical locations, possibly with lower bandwidth and/or higher latency, being able to parallelise them can really speed things up. Again, speaking of my personal usage of this pattern, all the machines I ssh to are on a private 10+Gbps network, but the commands can take a long time to run, so I've used AE to parallelise them. In the future, I will likely switch to Coro + Coro::Channel/Coro::PrioChannel for job queuing, though that still leaves AE handling the parallel ssh calls.
This really depends on what you're doing and how it affects you. If you run it at the command line, as you must right now, you may want to minimise the amount of time it takes. If it's in a cron job in the middle of the night, it may matter less. If it takes 15 seconds, you may not care. If it takes 30 minutes for all the nodes, you may care. All I'm really suggesting is considering it. It's not actually that hard to do with the right modules.
|
|---|