View Single Post
  #3  
Old 8th May 2009, 20:17
glohmann glohmann is offline
Junior Member
 
Join Date: May 2009
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post
Default

There are already several core functions in monitor_core_module.inc.php to check if a service is up and running ... following I will try to provide additional methods:

--- monitor_core_module.inc.php 2009-05-08 18:21:22.000000000 +0200
+++ monitor_core_module.inc.php 2009-05-08 19:09:10.000000000 +0200
@@ -1290,6 +1290,21 @@ class monitor_core_module {
}
}

+ /**
+ * check if the named daemon is up and running
+ * daemon: name of daemon
+ */
+ function _checkDaemon ($daemon) {
+
+ $out = @exec("/etc/init.d/$daemon status", $outarr, $retval);
+ if ($retval == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
function _checkFtp ($host,$port){

$conn_id = @ftp_connect($host, $port);


badly I not found a good integrated functionality in PHP itself to look for running services (well there is only a 'win32_query_service_status') ... I guess I have to provide some PECL package here to fill that gap ... as I would prefer to not use functions like 'exec' if I can avoid them in any way ...
Reply With Quote