Commit c76dd524 authored by José Luis  Gutiérrez's avatar José Luis Gutiérrez Committed by Alessandro Rubini

www: system monitor fix

system monitor can be now enabled or disabled from web interface in
management.php page.
parent 166aaf38
......@@ -341,8 +341,13 @@ function check_snmp_status(){
}
function check_monit_status(){
$output = intval(shell_exec("ps aux | grep -c monit"));
return ($output>2) ? 1 : 0;
$output = shell_exec("/bin/ps axo command,state | grep '^/usr/bin/monit' | awk '{print $2}'");
if(empty($output) || (strpos($output,'T') !== false)){
return 0; /* monit is disabled or not in dotconfig */
}else{
return 1; /* monit is running */
}
}
function wrs_interface_setup(){
......@@ -763,11 +768,13 @@ function wrs_management(){
if(check_monit_status()){ //It is running
//Stop SNMP
shell_exec("/bin/sh /etc/init.d/monit.sh stop > /dev/null 2>&1 &");
shell_exec("/etc/init.d/monit.sh stop > /dev/null 2>&1 &");
echo "i have disable it<br>";
}else{ //Not running
shell_exec("/bin/sh /etc/init.d/monit.sh start > /dev/null 2>&1 &");
shell_exec("/etc/init.d/monit.sh start > /dev/null 2>&1 &");
echo "i have enable it<br>";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment