Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Server Status
#1
Hi,

I edited the serverStatus function to display some useful information. I know the links to start/stop/restart services don't work yet, but I don't know how to make them work.

I attached the modified function and a screenshot.

LE: I also added a link to server status in the template (under system).

Restored from old drupal forum, for user uid:700 username:deconectat
You may reset your password to access your new account here.
Reply
#2
thank you for file, i will check and include in ehcp
i will merge with some functions that i wrote too..

you are a great ehcp man ! Smile


Restored from old drupal forum, for user uid:700 username:deconectat
You may reset your password to access your new account here.
Reply
#3
function serverStatus(){
$this->requireAdmin();
//-------------- deconectat edit ---------------------------------------------------------
$this->output.="<div class='footer'><table> ";

$this->output.="<tr><td>Apache2: </td><td>";
$serviceCount=$this->executeProg3("ps ax | grep /apache2 | grep -v grep | wc -l");
if ($serviceCount > 0) $this->output.="<font color='#00cc00'><strong>YES</strong></font>";
else $this->output.="<font color='#ff0000'><strong>NO</strong></font>";
$this->output.="</td><td> (<a href='?op=startapache2'>Start</a> | <a href='?op=stopapache2'>Stop</a> | <a href='?op=restartapache2'>Restart</a&gtWink</td></tr>";

$this->output.="<tr><td>MySQL: </td><td>";
$serviceCount=$this->executeProg3("ps ax | grep '/mysqld ' | grep -v grep | wc -l");
if ($serviceCount > 0) $this->output.="<font color='#00cc00'><strong>YES</strong></font>";
else $this->output.="<font color='#ff0000'><strong>NO</strong></font>";
$this->output.="</td><td> (<a href='?op=startmysql'>Start</a> | <a href='?op=stopmysql'>Stop</a> | <a href='?op=restartmysql'>Restart</a&gtWink</td></tr>";

$this->output.="<tr><td>Vsftpd: </td><td>";
$serviceCount=$this->executeProg3("ps ax | grep vsftpd | grep -v grep | wc -l");
if ($serviceCount > 0) $this->output.="<font color='#00cc00'><strong>YES</strong></font>";
else $this->output.="<font color='#ff0000'><strong>NO</strong></font>";
$this->output.="</td><td> (<a href='?op=startvsftpd'>Start</a> | <a href='?op=stopvsftpd'>Stop</a> | <a href='?op=restartvsftpd'>Restart</a&gtWink</td></tr>";

$this->output.="<tr><td>Bind: </td><td>";
$serviceCount=$this->executeProg3("ps ax | grep bind | grep -v grep | wc -l");
if ($serviceCount > 0) $this->output.="<font color='#00cc00'><strong>YES</strong></font>";
else $this->output.="<font color='#ff0000'><strong>NO</strong></font>";
$this->output.="</td><td> (<a href='?op=startvsftpd'>Start</a> | <a href='?op=stopvsftpd'>Stop</a> | <a href='?op=restartvsftpd'>Restart</a&gtWink</td></tr>";

$this->output.="</table></div> ";
# i edited this part a bit, ehcpdeveloper
$systemStatus="\n Memory: used free (MB)\n".$this->executeProg3("free -m | grep buffers/ca | cut -d\":\" -f2")."\n--------------------------------------------------------------------------\n";
$systemStatus.="\ndf -h\n".$this->executeProg3("df -h")."\n--------------------------------------------------------------------------\n";
$systemStatus.="\nUptime:\n".$this->executeProg3("uptime");
$systemStatus.="\nhosts.deny:\n".$this->executeProg3("cat /etc/hosts.deny");
$systemStatus.="\nnetstat -anp | grep tcp:\n".$this->executeProg3("netstat -anp | grep tcp");

$this->output.="<div class=\"footer\"><pre>".$systemStatus."</pre></div>";


//-------------- end deconectat edit -----------------------------------------------------


$topoutput=$this->executeProg3("top -b -n 1 | head -40");
$this->output.="<hr><div align=left>Top output: <br> <pre>$topoutput</pre></div>";

$topoutput=$this->executeProg3("tail -100 /var/log/syslog");
$this->output.="<hr><div align=left>Syslog (to see this, you must chmod a+r /var/log/syslog on server console): <br> <pre>$topoutput</pre></div>";

return true;
}


Restored from old drupal forum, for user uid:1 username:ehcpdeveloper
You may reset your password to access your new account here.
Reply
#4
I added some more info in the server status (hostname, kernel version, php, mysql and apache version):

$systemStatus=$this->executeProg3("
echo \"\";
echo \"==========================================================================\";
echo -n \"Hostname: \";
hostname;
uname -srm;
echo \"\"
echo -n \"PHP version: \";
/usr/bin/php -nv | grep built | cut -d \" \" -f2;
echo -n \"MySQL version: \";
/usr/bin/mysql -V | cut -d \" \" -f6 | cut -d \",\" -f1;
echo -n \"Apache version: \";
/usr/sbin/apache2 -v | grep version | cut -d \"/\" -f2;
echo \"--------------------------------------------------------------------------\";
echo \"Memory: used free (MB)\" ...


Restored from old drupal forum, for user uid:1 username:ehcpdeveloper
You may reset your password to access your new account here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)

Online Shopping App
Online Shopping - E-Commerce Platform
Online Shopping - E-Commerce Platform
Feinunze Schmuck Jewelery Online Shopping