HOWTOlabs PHP Open Monitor
Network Service Monitoring with PHP

This is a really handy set of files that needs nothing but apache and PHP in place. You need to get the basic files from SourceForge (see Elsewhere) and make changes for you server and services.

Following detailed edits include script tweaks to accomodate multiple ports/address better
 
Elsewhere
[fredness@neo monitor]$ rcsdiff -w *
===================================================================
RCS file: config.inc,v
retrieving revision 1.1
diff -w -r1.1 config.inc
21c21
< $to             = "dino@freeshell.org";
---
> $to             = "scalix@zaptech.com";
24c24
< $replyto        = "dino@freeshell.org";
---
> $replyto        = "itstaff@scalix.com";
rcsdiff: RCS/crontab,v: No such file or directory
rcsdiff: RCS/index.pl,v: No such file or directory
rcsdiff: RCS/INSTALL,v: No such file or directory
===================================================================
RCS file: ip_list.txt,v
retrieving revision 1.1
diff -w -r1.1 ip_list.txt
1,4c1,12
< www.cisco.com --,22,--,25,80,--,443,--,       Cisco
< www.yahoo.com --,--,--,80,--,--,--,--,        Yahoo
< www.freshmeat.net     --,--,--,--,80,--,--,3306,      Freshmeat
< www.edomex.net        21,22,23,25,80,110,443,3306,    Edomex
---
> samwise.scalix.local  --,22,--,--,--,--,--,--,        samwise-ssh
> samwise.scalix.local  --,--,--,25,--,--,--,--,        samwise-mail
> samwise.scalix.local  --,--,--,--,80,--,--,--,        samwise-http
> samwise.scalix.local  --,--,--,--,--,--,443,--,       samwise-https
> samwise.scalix.local  --,--,--,--,--,--,--,8080,      samwise-tomcat
> fluffy.scalix.local   --,22,--,--,--,--,--,--,        fluffy-ssh
> fluffy.scalix.local   --,--,--,25,--,--,--,--,        fluffy-mail
> fluffy.scalix.local   --,--,--,--,80,--,--,--,        fluffy-http
> fluffy.scalix.local   --,--,--,--,--,--,443,--,       fluffy-https
> fluffy.scalix.local   --,--,--,--,--,--,--,8080,      fluffy-tomcat
> 127.0.0.1     --,22,--,--,--,--,--,--,        localhost-ssh
> 127.0.0.1     --,--,--,--,80,--,--,--,        localhost-http
rcsdiff: RCS/LICENSE,v: No such file or directory
===================================================================
RCS file: myphpom.sh,v
retrieving revision 1.1
diff -w -r1.1 myphpom.sh
1c1
< /usr/bin/php /www/htdocs/dino/monitor/dino3.php 1>/dev/null &
---
> /usr/bin/php /var/www/html/monitor/pom09.php 1>/dev/null &
rcsdiff: RCS/phpoc_sc,v: No such file or directory
===================================================================
RCS file: pom09.php,v
retrieving revision 1.1
diff -w -r1.1 pom09.php
3,5c3,7
< function mystatuschange ($my_nc=1,$my_alias="alias",$my_ip="192.168.1.1",$my_path="phpoc_sc",$my_extension="txt") {
< $my_file = "$my_path/$my_ip.$my_extension";
< $my_flog = "$my_path/$my_ip.log";
---
>
> function mystatuschange ($my_nc=1,$my_alias="alias",$my_ip="192.168.1.1",$my_serv="80",$my_path="phpoc_sc",$my_extension="txt") {
>   $my_file = "$my_path/$my_ip:$my_serv.$my_extension";
>   $my_flog = "$my_path/$my_ip:$my_serv.log";
>   echo "$my_file $my_flog";
7,8c9
<         if ($my_sc)
<        {
---
>   if ($my_sc) {
19c20,21
<               } else {
---
>       }
>     else {
24,26c26,29
< } else {
< # Send Notify Mail.
< $to             = "root@localhost.com";
---
>       }
>     else {
>     # $to             = "root@localhost.com";
>       $to             = "scalix@zaptech.com";
38d40
<
48a51,58
>
> # Here's the body of this code
> #   - attempt to open ip list file
> #   - loop through each line of the file
> #       - pull address and service list from each line
> #       - loop through list of services
> #           - open socket for service at address
> #           - call mystatuschange() with result
50,51c60
<         if ($ip_list_exist)
<         {
---
> if ($ip_list_exist) {
58a68
>       # $img should be null here
65c75
<       mystatuschange (0,"$ip_address[2]","$ip_address[0]","phpoc_sc","txt");
---
>           mystatuschange(0, "$ip_address[2]", "$ip_address[0]", $ip_services[$j], "phpoc_sc", "txt");
69c79
<       mystatuschange (1,"$ip_address[2]","$ip_address[0]","phpoc_sc","txt");
---
>           mystatuschange(1, "$ip_address[2]", "$ip_address[0]", $ip_services[$j], "phpoc_sc", "txt");
76a87
>
rcsdiff: RCS/pom.html,v: No such file or directory
rcsdiff: RCS/pom_logo.gif,v: No such file or directory
rcsdiff: RCS/pom.php,v: No such file or directory
rcsdiff: RCS/README,v: No such file or directory
===================================================================
RCS file: uptime.php,v
retrieving revision 1.1
diff -w -r1.1 uptime.php
6,7c6
<         if ($ip_list_exist)
<         {
---
> if ($ip_list_exist) {
21c20
<                       $my_tip =file("phpoc_sc/$ip_address[0].txt");
---
>           $my_tip = file("phpoc_sc/$ip_address[0]:$ip_services[$j].txt");
24c23
<                       $mysf = "cat phpoc_sc/$ip_address[0].txt ";
---
>           $mysf = "cat phpoc_sc/$ip_address[0]:$ip_services[$j].txt ";
43c42
<                       $my_this_ip = @fopen("phpoc_sc/$ip_address[0].txt","r");
---
>                       $my_this_ip = @fopen("phpoc_sc/$ip_address[0]:$ip_services[$j].txt","r");
45c44
<                       $my_tip =file("phpoc_sc/$ip_address[0].txt");
---
>                       $my_tip =file("phpoc_sc/$ip_address[0]:$ip_services[$j].txt");