Jump to content

Server Status Improvements


keliix06

Recommended Posts

We only wanted to show servers that users had an active or suspended account on on the server status page, so I whipped together this code. This is just the 3.8.1 serverstatus.tpl file with a couple of changes

 

<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}
{php}
$query = '';
$server = $this->get_template_vars('server');
$servername = $server['name'];
$serverip = $server['ipaddress'];
$query = "SELECT s.* FROM tblservers AS s LEFT JOIN tblhosting AS h ON h.server=s.id WHERE h.userid = ".$_SESSION['uid']." AND (h.domainstatus = 'Active' OR h.domainstatus = 'Suspended') AND s.name = '$servername'";
$result = mysql_query($query);
if(mysql_num_rows($result) > 0){
{/php}
<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>
{php}}{/php}
{foreachelse}
<tr class="clientareatableactive">
<td colspan="7">{$LANG.serverstatusnoservers}</td>
</tr>
{/foreach}
</table>

 

All I added was the stuff in the {php} tags. We also removed the phpinfo link and changed the intro text a bit so people didn't think that the one server they could see was "our servers". :)

Link to comment
Share on other sites

Ok, I wasn't happy with these improvements, so I've rewritten basically everything. This is ony compatible with PHP5 as I used SimpleXML.

 

The attachment contains a new status/index.php file which outputs the load/uptime/etc as valid xml.

 

The new serverstatus.php uses SimpleXML to grab/parse the data. It checks only for servers that the logged in user has active/suspended accounts on, grabs the status data for those and outputs it. This only works with users who are logged in.

 

The new serverstatus.tpl does not have the phpinfo link as we don't use that, so if you do just add it back in.

 

This is probably the last update I'll make, and it's somewhat customized for what we needed it to do, but it should work with anyone's setup.

status.zip

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

I just wrote a rather detailed submission and was logged out...

When logging back in, everything I'd typed dissapeared....

 

Well.. Here goes again....

 

-------------------

 

How plausible would it be to write something like this..(see below)..? I already have written this, but is in a seperate PHP file, (well 3 PHP files in total). Perhaps a 'simple' and 'detailed' button could be used....

 

1.Potential Customer, i.e. has no service (not logged in). Wanting to see server specifications of 1 or more servers, would see these stats:

 

- Server Name

- Server Location

- Server IP

- Server's network / datacenter

- Server Services Stats - 1 Tick (simple view

-- The tick could be either: Green / Orange / Red (Green 0 problems. Orange 1-2 problems. Red 3+ problems)

- Server Specifications (CPU Type, Speed, Cache etc, Manufacturer (dell etc..)

-- might need to be manually entered for those without access to STAT path... etc.)

- Server Spec's:

-- HDD Storage Size (total GB)

-- HDD Storage Use (percentage)

-- Memory Size (total GB)

-- Memory Use (percentage)

- Server uptime (Days, Hours, Minutes (optional seconds))

 

 

2. Customer who already has a service and is logged in, would see info in more detail, and also more private info.

 

- Servers Name (DNS and Nickname)

- Server I.P. Address (public shared / private)

- Servers Location (Datacenter + City / State / Country)

- Servers Network Provider / Backbone etc....

- Server Stats - Several Ticks (or Crosses) with different colours against the service...

-- Show which services are up/down. (PHP, MySQL, FTP, POP3, SMTP, IMAP?, SSH, DNS, HTTP, HTTPS)

-- Indicate by colour too, i.e. Green, Orange and Red or just Green and Red.

- Server Specifications (CPU Type, Speed, Cache, http app, e.g. cgi... etc, Manufacturer (dell etc..) - might need to be manually entered for those without access to STAT path... etc.)

- Server Spec's:

-- HDD Storage Size (total GB)

-- HDD Storage Use (percentage + GB)

-- Memory Size (total GB)

-- Memory Use (percentage + GB)

-- CPU Utilization (percentage)

- Server uptime (Days, Hours, Minutes (optional seconds))

 

 

I already have the detailed view written, but have not had much success incorporating it into the current system, e.g. by using "INCLUDE ('file.php');" for example...

 

Getting a little confused. I think something like this could really benefit everybody!

:)

 

Here's a screenshot of what i'm using currently. It simply refreshes ever 30 seconds to update the statistics.

 

emma.

(:

Link to comment
Share on other sites

I just wrote a rather detailed submission and was logged out...

When logging back in, everything I'd typed dissapeared....

 

Well.. Here goes again....

 

-------------------

 

How plausible would it be to write something like this..(see below)..? I already have written this, but is in a seperate PHP file, (well 3 PHP files in total). Perhaps a 'simple' and 'detailed' button could be used....

 

1.Potential Customer, i.e. has no service (not logged in). Wanting to see server specifications of 1 or more servers, would see these stats:

 

- Server Name

- Server Location

- Server IP

- Server's network / datacenter

- Server Services Stats - 1 Tick (simple view

-- The tick could be either: Green / Orange / Red (Green 0 problems. Orange 1-2 problems. Red 3+ problems)

- Server Specifications (CPU Type, Speed, Cache etc, Manufacturer (dell etc..)

-- might need to be manually entered for those without access to STAT path... etc.)

- Server Spec's:

-- HDD Storage Size (total GB)

-- HDD Storage Use (percentage)

-- Memory Size (total GB)

-- Memory Use (percentage)

- Server uptime (Days, Hours, Minutes (optional seconds))

 

 

2. Customer who already has a service and is logged in, would see info in more detail, and also more private info.

 

- Servers Name (DNS and Nickname)

- Server I.P. Address (public shared / private)

- Servers Location (Datacenter + City / State / Country)

- Servers Network Provider / Backbone etc....

- Server Stats - Several Ticks (or Crosses) with different colours against the service...

-- Show which services are up/down. (PHP, MySQL, FTP, POP3, SMTP, IMAP?, SSH, DNS, HTTP, HTTPS)

-- Indicate by colour too, i.e. Green, Orange and Red or just Green and Red.

- Server Specifications (CPU Type, Speed, Cache, http app, e.g. cgi... etc, Manufacturer (dell etc..) - might need to be manually entered for those without access to STAT path... etc.)

- Server Spec's:

-- HDD Storage Size (total GB)

-- HDD Storage Use (percentage + GB)

-- Memory Size (total GB)

-- Memory Use (percentage + GB)

-- CPU Utilization (percentage)

- Server uptime (Days, Hours, Minutes (optional seconds))

 

 

I already have the detailed view written, but have not had much success incorporating it into the current system, e.g. by using "INCLUDE ('file.php');" for example...

 

Getting a little confused. I think something like this could really benefit everybody!

:)

 

Here's a screenshot of what i'm using currently. It simply refreshes ever 30 seconds to update the statistics.

 

emma.

(:

 

Pretty cool, but where's the screenshot ?

Link to comment
Share on other sites

status.page.example.jpg

 

I was having all sorts of trouble with the site, where it would spit out an error code about line xxx of ____.php

It was doing it for around 45 minutes with the login.php file only.... login.php?login...

 

All fixed now by the look of it!

 

edit: forgot to mention i have it set to a meta refresh every 30 seconds.

 

e

Edited by flip
Link to comment
Share on other sites

implement into whmcs is the goal... I have just spent quite a bit of time trying to get it in... i'm not the 'best' coder :( but there were a few bugs, and then when i added doctype above the header, everything went hay-wire! LOL....

 

Everything is fine now.

 

But this will be great once in!

But also to add a simple / detailed view will be good.

 

What does everyone think?

Link to comment
Share on other sites

It seems like a good idea, remember that some clients have shared accounts spread over multiple servers. A simple view of services up and down on those servers is sufficient for checking of servers status. This additional information could be displayed when a user clicks on the server name..

Link to comment
Share on other sites

  • 2 weeks later...
status.page.example.jpg

 

I was having all sorts of trouble with the site, where it would spit out an error code about line xxx of ____.php

It was doing it for around 45 minutes with the login.php file only.... login.php?login...

 

All fixed now by the look of it!

 

edit: forgot to mention i have it set to a meta refresh every 30 seconds.

 

e

 

I like the looks of your script. Are you planning on sharing what you already have? If so, I'd be interested in looking at it.

 

Thanks,

 

marco

Link to comment
Share on other sites

I'd be more than happy to share it and see it evolve.

But first we need to find someone to migrate it over to WHMCS to work.

:)

 

I'm not much of a WHMCS expert, and am not familiar with the template files etc...

 

Please let me know if we have some volunteers!

 

REPLY:

Yes, as i said above, if we had a simple view, then if you click more info, it could simply pop-up a new window with this info in it. As i currently have a meta refresh set to 30 seconds, so it automatically updates.

That's entirely optional i guess, you can use the reload button....

 

Thanks again guys! (:

em.

Link to comment
Share on other sites

  • 2 weeks later...

Still no one interested in integrating this into WHMCS??

 

I.e. have the status page, and when you click on MORE perhaps, it would have either an AJAX or other pop-up, and display this degree of information.

 

The current summary and info status's are a little.... breif.

It would be great to be able to view detailed info if logged in, otherwise, simple stat's if just a guest or not logged in.

 

(:

 

EDIT:

Will post the current changes i've made here soon.

Lets see what other people's Server Status page looks like!

Edited by flip
Link to comment
Share on other sites

But that's the point.

You can remove what you wish, or add more as you please.

Most users rarely log in to their Client Area, as very few have issues, or need invoices etc.

 

It is simply a tool for "advanced" users to be able to monitor their account on a server.

Even if you made it only available admin users.

Easy enough to do, just create a new section and change the If loggedin=1 to If admin=1 etc...

 

As i said earlier, you wouldn't make this info public, you make the current status screen public, then for clients/admins logged in, they could see more services with Ticks, and an option for each server they have to click MORE, pop-up a page, and view a single page with details stats.

 

:(

oh well...

Link to comment
Share on other sites

I would really like to see the information contained in Cpanel's server status screen ported into WHMCS, this would solve the problem i think because you already have access to this screen in webhost manager, and you can set the allow functions from there. It would list services as well, instead of just port numbers.

 

I guess the only concern is to have a script in case that server is completely down to parse some downtime message since the data wouldn;t be available from cpanel.

Link to comment
Share on other sites

  • 5 months 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