Jump to content

How do I show the server load and uptime?


Beatle

Recommended Posts

Hello again,

 

I was hoping someone could tell me how I get the server load and uptime to show up in the server status section of WHMCS? Right now, as you can see from this, it only shows the status of the http, FTP, and POP3.

 

Thanks in advance!

Link to comment
Share on other sites

I am a bit confused by your questions, I am running WHMCS 3.6.1 and my serverstatus.php shows everything, as does the admin page.

 

What is your version and where are you not seeing what you should be seeing?

 

By the way, serverstatus.php is encoded, so you will not see any info relating to your question being posted soon, unless its in one of the template files.

Link to comment
Share on other sites

Have a look in the User Contributions section. Here's a link to the one that I use here at Hands-on:

 

http://forum.whmcs.com/showthread.php?t=7192&page=3&highlight=WHMCS+server+status

 

Works like a charm for our clients and servers.

 

You MUST setup the "status" script that comes with WHMCS in the /status folder. That must be on your individual servers that you want to monitor for LOAD etc. Have a look in the WIKI for more information on that.

Link to comment
Share on other sites

Ok, I did the edit that showed the uptime and load (in the screenshot), but it still does not show it on mine!? It does show more info when the user is logged in, but still the same when not logged in. The only difference when the user isn't logged in is that it shows a loggin form.

 

Here is what I have now:::

When the user is logged in>>

 

loggedin.gif

 

When the user is not logged in>>

 

notloggedin.gif

 

I had to edit the code a little to get the images to show up, but here is what I have in the serverstatus.tpl file:

 

{if $loggedin} 
<p>{$LANG.serverstatusheadingtext}</p> 
<table class="clientareatable" align="center" cellspacing="1"> 
<tr class="clientareatableheading"> 
<td>{$LANG.servername}</td> 
<td>HTTP</td> 
<td>FTP</td> 
<td>POP3</td> 
<td>{$LANG.serverstatusphpinfo}</td> 
<td>{$LANG.serverstatusserverload}</td> 
<td>{$LANG.serverstatusuptime}</td> 
</tr> 
{foreach key=num item=server from=$servers} 
<tr class="clientareatableactive"> 
<td>{$server.name}</td> 
<td>{get_port_status num="$num" port="80"}</td> 
<td>{get_port_status num="$num" port="21"}</td> 
<td>{get_port_status num="$num" port="110"}</td> 
<td><a href="{$server.phpinfourl}" target="_blank">{$LANG.serverstatusphpinfo}</a></td> 
<td>{$server.serverload}</td> 
<td>{$server.uptime}</td> 
</tr> 
{foreachelse} 
<tr class="clientareatableactive"> 
<td colspan="7">{$LANG.serverstatusnoservers}</td> 
</tr> 
{/foreach} 
</table> 
<p>The table below shows the status of your domains and which server they are hosted on.</p> 
<table class="clientareatable" align="center" cellspacing="1"> 
<tr class="clientareatableheading"> 
<td>{$LANG.servername}</td> 
<td>HTTP</td> 
<td>HTTPS</td> 
<td>FTP</td> 
<td>POP3</td> 
<td>SMTP</td> 
<td>IMAP</td> 
</tr> 
<tr> 
{php} 
//echo "<pre>"; 
//print_r($_SESSION); 
//echo "</pre>"; 
$query = "SELECT * FROM tblhosting WHERE userid='".$_SESSION["uid"]."' AND domainstatus='Active'"; 
$result = mysql_query($query); 
while ($row = mysql_fetch_array($result))  
{ 
//    echo "<pre>"; 
//    print_r($row); 
//    echo "</pre>"; 

   $activeserver = $row['server']; 
   $hosteddomain = $row['domain']; 

   $query2 = "SELECT * FROM tblservers WHERE id='".$activeserver."'"; 
   $result2 = mysql_query($query2); 
   $row2 = mysql_fetch_array($result2); 

//    echo "<pre>"; 
//    print_r($row2); 
//    echo "</pre>"; 

//HTTP 
   $fp = fsockopen($row['domain'],80,$errno,$errstr,10); 
   if(!$fp) 
   { 
       echo '<tr class="clientareatableactive">'; 
       echo "<td>( " .$row['domain']. " ) - " .$row2['name']."</td>"; 
       echo "<td><img src=\"images/statusfailed.gif\"></td>"; 
   }else{ 
       echo "<tr class=\"clientareatableactive\">"; 
       echo "<td>( " .$row['domain']. " ) - " .$row2['name']."</td>"; 
       echo "<td><img src=\"images/statusok.gif\"></td>"; 
       fclose($fp); 
   } 
//SSL 
   $fp = fsockopen('ssl://'.$row['domain'],443,$errno,$errstr,10); 
   if(!$fp) 
   { 
       echo "<td><img src=\"images/statusfailed.gif\"></td>"; 
   }else{ 
       echo "<td><img src=\"images/statusok.gif\"></td>"; 
       fclose($fp); 
   } 

//FTP 
   $fp = fsockopen($row['domain'],21,$errno,$errstr,10); 
   if(!$fp) 
   { 
       echo "<td><img src=\"images/statusfailed.gif\"></td>"; 
   }else{ 
       echo "<td><img src=\"images/statusok.gif\"></td>"; 
       fclose($fp); 
   } 

//POP3 
   $fp = fsockopen($row['domain'],110,$errno,$errstr,10); 
   if(!$fp) 
   { 
       echo "<td><img src=\"images/statusfailed.gif\"></td>"; 
   }else{ 
       echo "<td><img src=\"images/statusok.gif\"></td>"; 
       fclose($fp); 
   } 

//SMTP 
   $fp = fsockopen($row['domain'],25,$errno,$errstr,10); 
   if(!$fp) 
   { 
       echo "<td><img src=\"images/statuswarning.gif\"></td>"; 
   }else{ 
       echo "<td><img src=\"images/statusok.gif\"></td>"; 
       fclose($fp); 
   } 

//IMAP 
   $fp = fsockopen($row['domain'],143,$errno,$errstr,10); 
   if(!$fp) 
   { 
       echo "<td><img src=\"images/statusfailed.gif\"></td>"; 
   }else{ 
       echo "<td><img src=\"images/statusok.gif\"></td>"; 
       fclose($fp); 
   } 
} 
{/php} 
</tr> 
</table> 
{else} 
<p>{$LANG.serverstatusheadingtext}</p> 

<table class="clientareatable" align="center" cellspacing="1"> 
<tr class="clientareatableheading"> 
<td>{$LANG.servername}</td> 
<td>HTTP</td> 
<td>FTP</td> 
<td>POP3</td> 
<td>{$LANG.serverstatusphpinfo}</td> 
<td>{$LANG.serverstatusserverload}</td> 
<td>{$LANG.serverstatusuptime}</td> 
</tr> 
{foreach key=num item=server from=$servers} 
<tr class="clientareatableactive"> 
<td>{$server.name}</td> 
<td>{get_port_status num="$num" port="80"}</td> 
<td>{get_port_status num="$num" port="21"}</td> 
<td>{get_port_status num="$num" port="110"}</td> 
<td><a href="{$server.phpinfourl}" target="_blank">{$LANG.serverstatusphpinfo}</a></td> 
<td>{$server.serverload}</td> 
<td>{$server.uptime}</td> 
</tr> 
{foreachelse} 
<tr class="clientareatableactive"> 
<td colspan="7">{$LANG.serverstatusnoservers}</td> 
</tr> 
{/foreach} 
</table> 
<p>You must login to view detailed Server Statistics!  These login details differ from your websites control panel username and password. 
</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}  

 

Anyone know how I can get it so show the uptime and load when the user is logged or not? I would be happy if I could just get it to show either way!

 

Thanks in advance!

Link to comment
Share on other sites

I just noticed that if you click on the php info link, it shows the load, uptime, php version, and something else. Here is what you see when you click on the php info link>>>

 

0.53 1 Days 15:13:09 5.2.6 5.0.51a 2.2.0

 

You can see this for yourself at http://afreewebhost.com/clients/serverstatus.php

 

EDIT: I took out the php info link, but when I took out the whole line, it showed a grey box under the uptime section. So, I took out just the link to the php info, but I would like to remove the whole php info block.

 

This is what I had:

<td><a href="http://afreewebhost.com/status/index.php" target="_blank">{$LANG.serverstatusphpinfo}</a></td>

 

And this is what I did:

<td></td>

 

If I take out the <td></td> it shows the grey block under uptime.

Link to comment
Share on other sites

For the PHP info part - when you removed that link, and the <TD></TD> around it, did you remember to move it from the table header also further up in the code?

 

<td>{$LANG.serverstatusphpinfo}</td>

 

Remove both of those and that should take care of that for you.

 

With regards to some stuff showing when logged in, and some that's not, check the very top of the file, it says {if $loggedin} . Code in this section will ONLY show when logged in. Then if you look further down there's an {else} section. If you want to show EVERYTHING to EVERYONE, just remove the if loggedin line, then delete everything from the ELSE to the bottom of that section (including the {/if}

 

That will display everything without the login necesary etc.

 

I use it here on 3.6.1 with no issues, however I tweaked ours to not display anything unless a user is logged in.

Link to comment
Share on other sites

Did you put the status.tar file on the server that you wanted to view the load? Did you update the server configurations in your WHMCS with the location of where the status file is located (main admin page only).

 

After you setup that status scrpt if you click on the "Check Network Status" from your main page in WHMCS does it show the load through there? If not, what is the link to your status page on your server? Does it show the status through that link or give an error?

Link to comment
Share on other sites

If it's only showing a "-" then that means one of two things:

 

The page can't be opened and the PHP can't be executed, or the most common, your BILLING IP number is blocked in your destination server. Check your firewall and make sure that the IP number was added to ALLOW excessive login attempts :) I used to forget about that one on various server setups, but that's the next thing to check.

 

If it's showing in your browser with the UPTIME status (meaning the RAW information is being returned), but not working in your WHMCS, then it's likely the IP being blocked.

 

http://afreewebhost.com/clients/serverstatus.php -- this page didn't even load up for me :(

Link to comment
Share on other sites

  • 1 year 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