PORTMAN ~ Server status monitor

Date 2004/12/21 0:07:26 | Topic: Modules

Original ImagePORTMAN- A small utility for Xoops to check and display server port status as follows:

HTTP port=80 Open/closed
FTP port=21 Open/closed
MySql port=3306 Open/closed
POP3 port=110 Open/closed
SMTP port=25 Open/closed
SSH port=22 Open/closed

OPERATION

The Server Status block will display icons for the above server port functions. (hover over icon to identify) Green UP arrows indicate ports open and online. Red DOWN arrors indicate port closed and offline. These change automatically when detected. If your site is down or you can't reach it, simply callhttp://yoursite.com/portman/ to display current status page outside of the site iframe. (that's why it's not a module)

Portman server status script can be downloaded from HERE
-----------------------------------------------------------------------------
DEMO. seehttp://houseofstrauss.co.uk/

INSTALLATION:

1- Configure ./portman/index.php by replacing your site URL after $hostname and in the table.
2- Upload folder 'portman' to the root of your xoops site. Other destinations are possible but will require changes to the iframe code.
3- In your xoops Site/admin/blocks/ create a custom html block with the following code insert:
-----------------------------------------------------------------------------
<iframe src='{X_SITEURL}portman/index.php' width='150' height='68' scrolling=no marginwidth='0' marginheight='0' hspace='0' align='middle' frameborder='0'>
</iframe>
-----------------------------------------------------------------------------

4- Name block 'Server Status' or whatever you want.
5- Position and permission block as usual.
6- Depending on your theme and length of site name(s) monitored, iframe size may need adjusting (minimum width=110px)
7- If you are displaying multiple sites, increase iframe height as required.
8- To monitor all the ports you must only select sites and sub-sites on your own server.
9- Portman utility can be installed on a non xoops website, by replacing <iframe src='{X_SITEURL}portman/index.php.... >with the appropriate address.

**In order to monitor multiple sites installed on the same server simply uncomment the following section in [file: index.php] and add the appropriate sites URLs and site names. Repeat as required. Don't forget to reset iframe height in the xoops block to suit and increment the variable $hostname each time a site is added (ie: $hostname1, $hostname2, $hostname3, etc)**
-----------------------------------------------------------------------------
Example:

//$hostname1 = "www.site_2.com";

//echo "<table border='0' align=center width='140' cellspacing='0' cellpadding='1' bordercolor='' style='border: 1 solid #DADADA'>
// <td colspan='6'>Site 2</td><tr>
// <td width='16'><img src='image.php?host=$hostname1&port=80'></td>
// <td width='16'><img src='image.php?host=$hostname1&port=21'></td>
// <td width='16'><img src='image.php?host=$hostname1&port=3306'></td>
// <td width='16'><img src='image.php?host=$hostname1&port=110'></td>
// <td width='16'><img src='image.php?host=$hostname1&port=25'></td>
// <td width='16'><img src='image.php?host=$hostname1&port=22'> </td>";

-----------------------------------------------------------------------------

HOW IT WORKS:

file: image.php Ping checks if server ports are open or closed and returns graphic indicators .


$fp = fsockopen($host, $port,$errno,$errstr, 4);
if (!$fp){
readfile('offline.gif');
} else {
readfile('online.gif');
fclose($fp);
}
-----------------------------------------------------------------------------

TESTING: (example)

change a port number in [file: index.php], ie 3306 to 3336. This will find a closed port and should return a down arrow for MySql.
-----------------------------------------------------------------------------

OPTIONS:

A few alternative icons are supplied in the images folder. You can also add/delete/change port numbers if you wish to monitor other known ports.

-----------------------------------------------------------------------------

ABOUT PORT NUMBERS:

Where port numbers are concerned, consider an analogy between the computer and the telephone. Port numbers and their associated network addresses work something like telephone numbers and associated network extensions, or channels.
In this analogy a port number represents the "channel" for network communications. Port numbers allow different applications on the same computer to utilize network resources without interfering with each other. Just as different organizations may use different extension numbers "inside" their primary phone number, different computers use the same set of port numbers.
Port numbers most commonly appear in network programming, particularly socket programming. Sometimes, though, port numbers are made visible to the casual user. Normally, a Web site uses port number 80 and this number need not be included with the URL (although it can be).
In IP networking, port numbers can theoretically range from 0 to 65535. Most popular network applications, though, use port numbers at the low end of the range (such as 80 for HTTP). The port number is included as a field within the header of each IP packet.


There is a lot of information on port numbers: search google for "well known port numbers"
For a complete up to date list of port numbers seehttp://www.iana.org/assignments/port-numbers

-----------------------------------------------------------------------------

PURPOSE OF USE

1- Monitoring port numbers is not much good if you cant reach your site, that's why this is not a xoops module, but a stand alone script that can be called outside of your xoops website.

2- The server status script may be of use to administrators running other sites on the same server and like to see a quick indication that things are basically ok or not.

3- Administrators can also configue the port numbers to monitor other ports if required.

4- Some ports such as port 80 for HTTP can be monitored for sites on a different server

-----------------------------------------------------------------------------


FEEDBACK:

Comments, criticisms and creative suggestions all welcome

Richard Strauss // Carnuke@xoops.org



This article comes from XOOPS Web Application System
https://xoops.org

The URL for this story is:
https://xoops.org/modules/news/article.php?storyid=1947