I'm writing a bash script to monitor MAIL + FTP + MYSQL from an "X" website
MySQL monitor is already done.. now I have problems trying to figure out how to monitor MAIL and FTP for a "X" website.
I tried the following to know if the server was alive or not, but this command is not a static command, it keeps alive and have no end until I press CTRL + C , same happens if I use telnet .. here you have some examples for FTP and Mail...
netcat WEBSITE.COM 21
netcat WEBSITE.COM 25
Can anyone guide me on this.. I must write this script in bash, no other language.
Does anyone knows how to avoid the CTRL + C and stop the netcat until it says remote server is alive ?
By no means an out-of-the-box solution but I used a script called hostchecker, modified it for my needs and made a version available for download... I've since made a LOT more changes for my own use, but the basic framework is still available for download - it might give you an idea
I needed a way to monitor more than just whether something responded or not, I needed to know if it was responding correctly (i.e. a webserver responding 200 or 500, an email server with 200 OK, or some other error indicating file system full, high load, too many connections, etc.)
I must write this script in bash, no other language.
Then you're going to have very limited options
You will want to investigate other languages, especially php, which can compare responses from the ports and then respond accordingly.
WHMCS Guru - WHMCS addons, management, support and more. WHMCS Notifications Extended - Add slack, hipchat, SMS, pushover to WHMCS !!
Linux Problems? WHMCS Issues? +1-866-546-8914 (linux-14) or @whmcsguru on twitter!