Jump to content

Server Status display wizardry


redrat

Recommended Posts

I have this script setup to monitor additional ports on 2 servers. I have shell_exec and exec disabled on both servers. One the server where whmcs runs, I get all the info for extars like php/mysql ver, imap, cpanel ports. However, on the remote server, I do not get server load, imap and cpanel show offline(even though they are online). I do get php/mysql versions. Is this possibly a firewall issue?

 

 

Also is there a reason why the initial mods will only work with a portal template? I tried this with my custom template and get no data other than the port headings.

Link to comment
Share on other sites

  • Replies 148
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Well done boys.

 

Just a tip, though. Rather than have the client run all over the site looking for infromation, why not drop a couple of includes into the client area home page to give them a summary.

 

(Disclaimer:- this is great for small clients, but not so good for resellers or clients with hundreds of domains etc)

 

eg.

 

{include file='serverstatus.tpl'}

{include file='upcomingdomainrenewal.tpl'}

{include file='recentannouncements.tpl'}

{include file='clientareanotes.tpl'}

 

Plus a couple of other customs, as per the screenshot, notes, etc

 

Drop in a couple of hyperlinks to the relevant sections, and you have a nice one page snapshot summary of the client.

 

This is good in theory, but the status page takes a few seconds to load if you have added info. This will drag down client area home.

Link to comment
Share on other sites

redrat: Now I know why I could never get the two ports to show up as open a while back. I had an "AHA!" moment today and opened the ports.

 

Right after that, I checked the status page, and sure enough, they showed as up.

 

:/

 

Which means, if it's still showing as down when everything else is up, CHECK YOUR PORTS!

 

Check your ports where? In the firewall? What exactly did you do? My server status page can not see smtp, imap and cpanel. I have no problem on the local server that whmcs resides on, just the remote one.

Link to comment
Share on other sites

Check your ports where? In the firewall? What exactly did you do? My server status page can not see smtp, imap and cpanel. I have no problem on the local server that whmcs resides on, just the remote one.

 

Yes, in the firewall. I should've been more clearer.

 

I had the "AHA!" moment and tried opening the ports in the firewall to see if the script would see them as up, and sure enough, it did.

 

I'm curious, how do we add more ports to check without mangling up the display?

Link to comment
Share on other sites

This is good in theory, but the status page takes a few seconds to load if you have added info. This will drag down client area home.

 

OK. I had the AHA moment too. I was too concerned with the remote firewall and not the local firewall. I opened the outbound ports for the additional services. They all work with the exception on SMTP.

Link to comment
Share on other sites

OK. I had the AHA moment too. I was too concerned with the remote firewall and not the local firewall. I opened the outbound ports for the additional services. They all work with the exception on SMTP.

 

TCP. Outbound, as you've noticed. SMTP... I believe you'd need to check for the ports you use if you're not using the standard ports for SMTP.

Link to comment
Share on other sites

TCP. Outbound, as you've noticed. SMTP... I believe you'd need to check for the ports you use if you're not using the standard ports for SMTP.

 

I too am getting an SMTP problem. I am not using the standard port, and corrected it in the file prior to uploading.

 

Suggestions anyone?

 

PS... I'm using the code from post #88

Edited by knipper
Link to comment
Share on other sites

I too am getting an SMTP problem. I am not using the standard port, and corrected it in the file prior to uploading.

 

Suggestions anyone?

 

PS... I'm using the code from post #88

 

 

Did you check if you have the server(if remote) in the firewall allow file?

Link to comment
Share on other sites

Did you check if you have the server(if remote) in the firewall allow file?

 

Hi rldev,

 

Thanks for the response. Nope, it's on this server, not remote. But I do have CSF firewall, locking it down pretty tightly.

 

I tried adding the SMTP port to my tcp_out allowed area. (it obviously was in my tcp_in config) I deleted the templates_c directory, and dumped my browser cache, but still no smtp.

 

Any additional suggestions?

Link to comment
Share on other sites

  • 2 weeks later...

is there anyway of making the server status page work OUTSIDE of the WHMCS install directory?

 

I am currently working on a new version of my site and I was wanting to put it on the server spec page and I dont really wanna have that page running on the whmcs

Link to comment
Share on other sites

  • 2 weeks later...
Sorry for the late reply, I was working with no web access! I am able to telnet locally on the server to both port 25 & 26 (Where I have smtp set up).

 

You probably have SMTP_BLOCK enabled in CSF. This blocks outgoing access to port 25 / 26. Since by default you are using the domain or server hostname to connect, it will be blocked. You need to change the hostname for connecting to SMTP to 'localhost'

Link to comment
Share on other sites

  • 2 months later...
Here's another version I wrote up. It's based on WHMCS 4.1.2 version of the template. It turns off the PHP Info link, and adds a few extras (basically the same ones as the other script). It's a little bit shorter and cleaner, as it keeps all of the template code separate, it also loads the existing login.tpl so you don't have to maintain it in an additional place.

 

Also, if you want to turn off the PHP Info, don't forget to edit the status/index.php file too. Someone can still access the PHP info by going to /status/index.php?action=phpinfo unless you comment out the phpinfo line in the file by putting a // in front of phpinfo();.

 

{php}
$query = "SELECT DISTINCT tblservers.name FROM `tblservers` JOIN `tblhosting` ON tblhosting.server=tblservers.id WHERE tblhosting.userid='".$_SESSION["uid"]."' AND tblhosting.domainstatus='Active'";
$result = mysql_query($query);
$servers_new = array();
$server_names = array();
while ($data = mysql_fetch_array($result,MYSQL_ASSOC)) {
 $server_names[] .= $data['name'];
}
$servers_old = $this->_tpl_vars[servers];
foreach ($servers_old AS $key=>$value) {
 if (in_array($value['name'],$server_names)) $servers_new[] = $value;
}
$this->clear_assign('servers');
$this->assign('servers',$servers_new);
{/php}
{if $loggedin}
<p>{$LANG.serverstatusheadingtext}</p>
<table width="100%" border="0" align="center" cellpadding="10" cellspacing="0" class="data">
 <tr>
   <th>{$LANG.servername}</th>
   <th>HTTP</th>
   <th>FTP</th>
   <th>POP3</th>
   <th>IMAP</th>
   <th>SMTP</th>
   <th>cPanel</th>
   <th>{$LANG.serverstatusserverload}</th>
   <th>{$LANG.serverstatusuptime}</th>
 </tr>
 {foreach key=num item=server from=$servers}
 <tr>
   <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>{get_port_status num="$num" port="143"}</td>
   <td>{get_port_status num="$num" port="25"}</td>
   <td>{get_port_status num="$num" port="2082"}</td>
   <td>{$server.serverload}</td>
   <td>{$server.uptime}</td>
 </tr>
 {foreachelse}
 <tr>
   <td colspan="8">{$LANG.serverstatusnoservers}</td>
 </tr>
 {/foreach}
</table><br />
{else}
{assign var='formaction' value='dologin.php?goto=serverstatus'}
{include file="$template/login.tpl"}
{/if}

 

Redrat, thanks for the script. I'm not trying to steal your thunder, just offer another method. Thanks for the inspiration and some really good ideas.

 

 

i pasted this code in serverstatus.tpl but getting this in return

The table below shows the status of our server. You can use this page to check if any of the services on our servers are down.

Server HTTP FTP POP3 IMAP SMTP cPanel Server Load Uptime

No Servers are currently being monitored

 

Can some one help me on this?

I have placed http://www.xlxhost.com/status/ in my server configuration page.

Link to comment
Share on other sites

i pasted this code in serverstatus.tpl but getting this in return

 

 

Can some one help me on this?

I have placed http://www.xlxhost.com/status/ in my server configuration page.

 

The script that I had attached is configured to only display server info for the server that the logged in user has an account. If you're logged out or the logged in user does not have an appropriate package then no data will be returned.

 

I hope that helps.

Link to comment
Share on other sites

The script that I had attached is configured to only display server info for the server that the logged in user has an account. If you're logged out or the logged in user does not have an appropriate package then no data will be returned.

 

I created a test user account tested it but it was not working.

 

the logged in user does not have an appropriate package then no data will be returned.

 

What do you mean by package?

and also do i have to change my status/index.php too?

Link to comment
Share on other sites

  • 5 months later...
  • 5 weeks later...
  • 1 year later...
  • 1 month 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