Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone know how to do a port monitoring script? 1

Status
Not open for further replies.

farley99

MIS
Joined
Feb 12, 2003
Messages
413
Location
US
Something like

if connect('162.42.34.128, 80){
;
}
else
mail("system@admin.com","SITE DOWN","SITE DOWN");
 
If you are monitoring ports 80, 21, or 443, and if you have a newer version of PHP, and if your php.ini has allow_url_fopen set to "on", then you can use fopen() to do the checking. Another options is to use CURL, if that has been made available in your PHP installation.

You could also use socket programming. Check out the example code here:
Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top