[Extended ping functionality to ChkNet
tony@tonywhitmore.co.uk**20060316211500
* Added extended ping support to ChkNet, including links back to group on main ChkNet page.
* Tidied up ChkNet settings table.
* Updated help documentation.
] {
addfile ./chknet/check.php
hunk ./INSTALL 7
-Database supported by PEAR::DB (recommend MySQL 3.23 or newer)
+Database supported by PEAR::DB (recommend MySQL 4.0 or newer)
+fping (recommended for use with ChkNet module)
hunk ./TODO 20
-* Set up user options for mail alerts etc. (system wide?)
-* Add e-mail sending on initial submission?
hunk ./chknet/check.php 1
+query($query);
+ if (DB::isError($db)) {die($db->getMessage());}
+ while ( $row = $result->fetchRow() )
+ {
+ $$row['function'] = $row['value'];
+ }
+ // Fetch the details of the device to be checked
+ $query = "SELECT * FROM chknet_dev WHERE id = \"" . $id . "\"";
+ $result = $db->query($query);
+ if (DB::isError($db)) {die($db->getMessage());}
+ $num_rows = $result->numRows();
+ if ( $num_rows != 0 )
+ {
+ $row = $result->fetchRow();
+ if ( $pingtype == "unixfping" OR $pingtype == "unixping" )
+ {
+ $output = shell_exec($pingpath . ' ' . $extpingoptions . ' ' . $row['hostname'] . " 2>&1");
+ echo "
This function has not yet been implemented due to the lack of a test platform. If you can help out with this feature, please make contact through the project website.\n";
+ exit();
+ }
+ }
+ else
+ {
+ echo "
Device not found!
";
+ }
+ }
+// Check for access level
+if ( $_SESSION['chknet'] == "2" )
+ {
+ // Include the connection to the database server details.
+ include ("STORM/common/db/connectict.inc");
+ // Include the navigation options.
+ include ("STORM/chknet/html/ict_nav.inc");
+ // Produce the information page
+ echo "
Extended Connectivity Check Results
\n";
+ echo "
Please remember that this module is designed only to provide a simple connectivity test. The results show only
+ that a device on a hostname or IP address has responded to an ICMP echo request.
+ It does not guarantee that a particular port is open on the system, nor that any specific services are running.
\n";
+ // Get the path of the ping executable
+ $query = "SELECT value FROM chknet_settings WHERE function = \"pingpath\"";
+ $result = $db->query($query);
+ if (DB::isError($db)) {die($db->getMessage());}
+ $row = $result->fetchRow();
+ if ( file_exists($row['value']) ){
+ if ( is_file($row['value']) ){
+ ping_device($_REQUEST['id']);
+ $query = "SELECT grp FROM chknet_dev WHERE id = \"" . $_REQUEST['id'] . "\"";
+ $result = $db->query($query);
+ if (DB::isError($db)) {die($db->getMessage());}
+ $row = $result->fetchRow();
+ echo "Back\n";
+ }
+ else {
+ echo "
The location " . $row['value'] . " is not a file. Please contact the system administrator.
\n";
+ exit();
+ }
+ }
+ else {
+ echo "
The executable " . $row['value'] . " was not found. Please contact the system administrator.
\n";
+ exit();
+ }
+ }
+else
+ {
+ exit();
+ }
+
+?>
hunk ./chknet/help.php 54
- ChkNet uses a standard "ping" command to test connectivity. It does not check whether any particular ports are open on the device, and is just intended
- as a basic connectivity test.
+ ChkNet uses a standard "ping" command to test connectivity. It does not check whether any particular ports are open on the device or whether any services are functioning properly. It is just intended as a basic connectivity test. For more thorough service monitoring software, try Nagios.
hunk ./chknet/help.php 59
- If the fping program is not used, the page can take a lot longer to load, with each non-responding device typically adding 10 seconds to the load time.";
+ If the fping program is not used, the page can take a lot longer to load, with each non-responding device typically adding 10 seconds to the load time.
+
+
What does the "Extended check" option on non-responding hosts do?
+ This option performs a more thorough ping check on the host in question. It sends multiple ICMP Echo requests to the host, rather than just the one used on the main page and can therefore be used to help determine if the non-responding status was due to a total failure, and intermittent fault or a fluke. The entire output of the ping command is returned to the screen. The format of the output will vary depending on the version of the ping command in use, but will show the number of failed packets.
This function has not yet been implemented due to the lack of a test platform.\n";
+
This function has not yet been implemented due to the lack of a test platform. If you can help out with this feature, please make contact through the project website.\n";
hunk ./chknet/settings.php 85
- {
- extract ($row);
- echo "
\n";
- echo "
\n";
- echo "";
- // Small if loop that presents a nice version of the variable name
- if ( $function == "pingpath" )
- {
- echo "Full path to ping executable";
- }
- elseif ( $function == "pingoptions" )
- {
- echo "Options to be passed to ping before list of hostnames/addresses
- N.B. *nix fping mode requires options '-qa'
- For *nix ping mode, '-c1' is suggested";
- }
- elseif ( $function == "refresh" )
- {
- echo "Automatic refresh period for ChkNet status page (in seconds) Default: 60";
- }
- elseif ( $function == "okcolour" )
- {
- echo "Colour for alive devices (in HTML hex colour format) Default: #33FF33";
- }
- elseif ( $function == "failcolour" )
- {
- echo "Colour for failed devices (in HTML hex colour format) Default: #FF0000";
- }
- elseif ( $function == "nullcolour" )
- {
- echo "Colour for disabled devices (in HTML hex colour format) Default: #CCCCCC";
- }
- else
- {
- echo $function;
- }
- echo "\n";
- echo "