Jump to content

Customized Server Status


arteryplanet

Recommended Posts

I know I had troubles getting this to work on mine. I went ahead and modified it to my needs. It shows the standard Server Stats along with a login form. If you are logged in, it shows you standard stats plus detailed stats for each domain.

 

 

this one working verry good for me rest of version not working :) thanks dude.

Link to comment
Share on other sites

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

hi guys, not sure why is showing not ok for you, is working for me and for "cyberneticos" too as far as i can see. Make sure you do not have something blocking in your firewall or you have disabled fsockopen in your php.ini.

So it needs fsockopen enabled in php.ini to work?

 

This is one mod i wont be doing, i love the server status link, makes sense so that potential customers can see how things are running on you server, plus they can see your uptime

True, the uptime could be a problem, and also the server load. But then again, only those who really want to know will take notice.

 

Just to clarify, when the user is not logged in, this is showing the server status on all servers.

 

We currently have just over 120 servers in operation, so we don't display status of ALL servers to ALL users, and only want to display the individual servers for whatever an account may be hosted on.

 

Any thoughts?

I'd like to have this option as well. Does anyone know how todo it? Probably a simple if / while script looping through the accounts, getting the server FQDN where the account is located, and then display that server's IP. But I think this may cause a problem on a DB with a few thousand clients?

Link to comment
Share on other sites

Just to clarify, when the user is not logged in, this is showing the server status on all servers.

 

We currently have just over 120 servers in operation, so we don't display status of ALL servers to ALL users, and only want to display the individual servers for whatever an account may be hosted on.

 

Any thoughts?

 

Just remove the part of the code that show the status when you are not logged in, the rest of the code will take care to show the server where the logged in client have hosting accounts.

Link to comment
Share on other sites

You could do this with a database, a simple script to grab the data out of the status folder and with a cron job. When it's the last day of the month, calculate each day of the month as an average and save it for that month.

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 months later...
I know I had troubles getting this to work on mine. I went ahead and modified it to my needs. It shows the standard Server Stats along with a login form. If you are logged in, it shows you standard stats plus detailed stats for each domain.

 

This is brilliant - tweaked it a little to remove the PHP info for none-logged in users :) and added cPanel and Webmail status for logged in users :)

 

I REALLY wanna have the server and domain's in different colums, but i just cant get it working - never the less, Great share, many thanks :D

 

Here's how mine finished up:

untitled-1416.jpg

 

me need more servers now :twisted: :twisted: :twisted:

Edited by carlsilver
Link to comment
Share on other sites

  • 2 months later...

Ok I am stuck. This is what I edited for /go/status/index.php

<?PHP
define("CLIENTAREA",true);
require("../dbconnect.php");
require("../includes/functions.php");
$pagetitle = $_LANG['clientareatitle'];
$pageicon = "../images/support/clientarea.gif";
$breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a> > | <a href="serverstatus.php">Status Page</a>';
require("../init.php");
if ($_SESSION['uid']) {
<table class="clientareatable" align="center" cellspacing="1">
<tr class="clientareatableheading">
<td>{$LANG.servername}</td>
<td>Hosting</td>
<td>HTTP</td>
<td>FTP</td>
<td>POP3</td>
<td>SMTP</td>
</tr>
<tr>
{php}
$query1 = "SELECT * FROM tblservers ORDER BY name";
$result1 = mysql_query($query1);
while ($row1 = mysql_fetch_array($result1)) {
$serverid = $row1['id'];
$servername = $row1['name'];
$host = $row1['ipaddress'];
$hosteddomains="";
$query2 = "SELECT * FROM tblhosting WHERE userid='".$_SESSION["uid"]."' AND domainstatus='Active' AND server='".$serverid."'";
$result2 = mysql_query($query2);
while ($row2 = mysql_fetch_array($result2)) {
$hosteddomain = $row2['domain'];
$hosteddomains.=$hosteddomain."<br>";
}
if ($hosteddomains) {
$hosteddomains=substr($hosteddomains,0,-4);
if ($host) {
//HTTP
$port = 80;
$fp = fsockopen($host,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<tr class=\"clientareatableactive\">";
echo "<td><b>".$servername."</b> [".$host."]</td>";
echo "<td>" .$hosteddomains."</td>";
echo "<td rowspan=\"2\"><strong><font color=\"#FF0000\">Not OK</font></strong></td>";
}
else{
echo "<tr class=\"clientareatableactive\">";
echo "<td>".$servername." [".$host."]</td>";
echo "<td>" .$hosteddomains."</td>";
echo "<td rowspan=\"2\"><strong>OK</strong></td>";
fclose($fp);
}
//FTP
$port = 21;
$fp = fsockopen($host,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td rowspan=\"2\"><strong><font color=\"#FF0000\">Not OK</font></strong></td>";

}else{
echo "<td rowspan=\"2\"><strong>OK</strong></td>";
fclose($fp);
}
//POP3
$port = 110;
$fp = fsockopen($host,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td rowspan=\"2\"><strong><font color=\"#FF0000\">Not OK</font></strong></td>";

}else{
echo "<td rowspan=\"2\"><strong>OK</strong></td>";
fclose($fp);
}
//SMTP
$port = 25;
$fp = fsockopen($host,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td rowspan=\"2\"><strong><font color=\"#FF0000\">Not OK</font></strong></td><tr>";

}else{
echo "<td rowspan=\"2\"><strong>OK</strong></td></tr>";
fclose($fp);
}
$this->assign('serverid',$serverid);
$this->assign('servername',$servername);
echo "<tr class=\"clientareatablepending\">";
echo "<td colspan=\"2\">";
{/php}
{foreach key=num item=server from=$servers}
{if $server.name == $servername}
<b>Uptime:</b> {$server.uptime}
 - 
<b>Load Average:</b> {$server.serverload}<br>
{/if}
{/foreach}
{php}
echo "</td></tr>";
} else {
echo "<tr class=\"clientareatableactive\">";
echo "<td>".$servername."</td>";
echo "<td>" .$hosteddomains."</td>";
echo "<td colspan=\"5\"><strong><font color=\"#AAAAAA\">Not Monitored Here</font></strong></td>";
}}}
{/php}
</table>
{else}
<p>{$LANG.loginintrotext}</p>
<form action="../dologin.php?goto=serverstatus" method="post">
<table align="center">
<tr><td align="right">{$LANG.loginemail}:</td><td><input type="text" name="username" size="40" value="{$username}"></td></tr>
<tr><td align="right">{$LANG.loginpassword}:</td><td><input type="password" name="password" size="25" value="{$password}"></td></tr>
</table>
<p align="center"><input type="submit" value="{$LANG.loginbutton}"><br><input type="checkbox" name="rememberme"{$rememberme}> {$LANG.loginrememberme}</p>
</form>
<p><b>{$LANG.loginforgotten}</B> <a href="passwordreminder.php">{$LANG.loginforgotteninstructions}</a>.</p>
{/if}
}
# Define the template filename to be used without the .tpl extension
$templatefile = "serverstatus";
# To assign variables in Smarty use the following syntax. This can then be used as {$variablename} in the template
// $smartyvalues["variablename"] = $value;
require("../display.php");
?>

 

Now what do I put in the template file?

Edited by Inetbiz
Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated