Jump to content

Server Status Split into server groups with clients domains listed.


Recommended Posts

[ATTACH=CONFIG]2876[/ATTACH]

I have made an improvement on the below coding,

 

If you are using the previous version from this page http://forum.whmcs.com/showthread.php?47696-Seperate-Server-Status&p=225278#post225278

 

you will note that the code in the quote is missing the {php} {/php} elements, i have moved these into an action hook so its not being called from the template any longer, i feel this will have a performance boost.

 

Drop this attached file into whmcs/includes/hooks/

 

If you are already using the previous version, please simply delete the php section from the template, the new file replaces it. i have removed it from the quoted code before to put everything in one place

 

 

 

File: whmcs/templates/default/serverstatus.tpl

 

I have included the containing div tags so you can easily see where to put it.

<div class="center80">

{foreach from=$groups item=grouped}
<h3>{$grouped.name}</h3>
<table class="zebra-striped">
		<thead>
			<tr>
				<th>{$LANG.servername}</th>
				<th class="textcenter">HTTP</th>
				<th class="textcenter">FTP</th>
				<th class="textcenter">POP3</th>
				<th class="textcenter">{$LANG.serverstatusserverload}</th>
				<th class="textcenter">{$LANG.serverstatusuptime}</th>
			</tr>
		</thead>
		<tbody>

		{foreach from=$servers key=num item=server}
				{foreach item=served from=$serving}
					{if $served.name eq $server.name and $served.groupid eq $grouped.id}
					<tr>
						<td>{$server.name}</td>
						<td class="textcenter">{get_port_status num="$num" port="80"}</td>
						<td class="textcenter">{get_port_status num="$num" port="21"}</td>
						<td class="textcenter">{get_port_status num="$num" port="110"}</td>
						<td class="textcenter">{$server.serverload}</td>
						<td class="textcenter">{$server.uptime|replace:'Days':$LANG.days}</td>
					</tr>
					<tr>
						<th colspan="1">Websites</th>
						<td colspan="5">
							{foreach item=domain from=$domains}
								{if $domain.server eq $served.id}
									{$domain.domain} 
								{/if}
							{/foreach}
						</td>
					</tr>
					{/if}
				{/foreach}
		{/foreach}
		</tbody>
	</table>
{/foreach}
</div>

 

File: whmcs/lang/english.php Line 1256

 

From This

$_LANG['serverstatusheadingtext'] = "Below is a real-time overview of our servers where you can check if there's any known issues.";

 

To this

$_LANG['serverstatusheadingtext'] = "Below is a real-time overview of servers where you have an account hosted"; 

Edited by disgruntled
Link to comment
Share on other sites

I added in some switching logged in or not. This works as it always did, you can turn status viewing on or off for visitors who have not logged in

 

here: setup > general > support tab > check or uncheck the option.

 

If you allow everybody to view the server status, this change will allow for that as the previous version did not,

 

This simply places the original layout back for people who are not logged in, the previous version prevented that due to checking only for client servers.

 

You will note that i have left the network issues counters outside of the loggedin checks, this was intentional as i feel that it shows that you are proactive in your administration. If you prefer simply ro now show it, uncomment the {*if $loggedin*} by removing both * and delete the second {if $loggedin}

 

{include file="$template/pageheader.tpl" title=$LANG.networkstatustitle desc=$LANG.networkstatusintro}

{*if $loggedin*}

<div class="alert-message block-message warning">
<p class="textcenter fontsize3">
<a href="{$smarty.server.PHP_SELF}?view=open" class="networkissuesopen">{$opencount} {$LANG.networkissuesstatusopen}</a>     
<a href="{$smarty.server.PHP_SELF}?view=scheduled" class="networkissuesscheduled">{$scheduledcount} {$LANG.networkissuesstatusscheduled}</a>     
<a href="{$smarty.server.PHP_SELF}?view=resolved" class="networkissuesclosed">{$resolvedcount} {$LANG.networkissuesstatusresolved}</a>
</p>
</div>

{if $loggedin}
{foreach from=$issues item=issue}

	{if $issue.clientaffected}<div class="alert-message block-message warning">{/if}

		<h3>{$issue.title} ({$issue.status})</h3>
		<p><strong>{$LANG.networkissuesaffecting} {$issue.type}</strong> - {if $issue.type eq $LANG.networkissuestypeserver}{$issue.server}{else}{$issue.affecting}{/if} | <strong>{$LANG.networkissuespriority}</strong> - {$issue.priority}</span></p>
		<br />
		<blockquote>
		{$issue.description}
		</blockquote>
		<p><strong>{$LANG.networkissuesdate}</strong> - {$issue.startdate}{if $issue.enddate} - {$issue.enddate}{/if}</p>
		<p><strong>{$LANG.networkissueslastupdated}</strong> - {$issue.lastupdate}</p>

	{if $issue.clientaffected}</div>{/if}

{foreachelse}

	<p class="textcenter"><strong>{$noissuesmsg}</strong></p>

{/foreach}

<div class="pagination">
	<ul>
		<li class="prev{if !$prevpage} disabled{/if}"><a href="{if $prevpage}{$smarty.server.PHP_SELF}?{if $view}view={$view}&{/if}page={$prevpage}{else}javascript:return false;{/if}">← {$LANG.previouspage}</a></li>
		<li class="next{if !$nextpage} disabled{/if}"><a href="{if $nextpage}{$smarty.server.PHP_SELF}?{if $view}view={$view}&{/if}page={$nextpage}{else}javascript:return false;{/if}">{$LANG.nextpage} →</a></li>
	</ul>
</div>

{if $servers}

	{include file="$template/subheader.tpl" title=$LANG.serverstatustitle}

	<p>{$LANG.serverstatusheadingtext}</p>

	<br />
	<div class="center80">

	{foreach from=$groups item=grouped}
		<h3>{$grouped.name}</h3>
		<table class="zebra-striped">
				<thead>
					<tr>
						<th>{$LANG.servername}</th>
						<th class="textcenter">HTTP</th>
						<th class="textcenter">FTP</th>
						<th class="textcenter">POP3</th>
						<th class="textcenter">{$LANG.serverstatusserverload}</th>
						<th class="textcenter">{$LANG.serverstatusuptime}</th>
					</tr>
				</thead>
				<tbody>

				{foreach from=$servers key=num item=server}
						{foreach item=served from=$serving}
							{if $served.name eq $server.name and $served.groupid eq $grouped.id}
							<tr>
								<td>{$server.name}</td>
								<td class="textcenter">{get_port_status num="$num" port="80"}</td>
								<td class="textcenter">{get_port_status num="$num" port="21"}</td>
								<td class="textcenter">{get_port_status num="$num" port="110"}</td>
								<td class="textcenter">{$server.serverload}</td>
								<td class="textcenter">{$server.uptime|replace:'Days':$LANG.days}</td>
							</tr>
							<tr>
								<th colspan="1">Websites</th>
								<td colspan="5">
									{foreach item=domain from=$domains}
										{if $domain.server eq $served.id}
											{$domain.domain} 
										{/if}
									{/foreach}
								</td>
							</tr>
							{/if}
						{/foreach}
				{/foreach}
				</tbody>
			</table>
	{/foreach}
	</div>

{/if}

<p>{$LANG.networkissuesaffectingyourservers}</p>
{else}

{if $servers}

	{include file="$template/subheader.tpl" title=$LANG.serverstatustitle}

	<p>{$LANG.serverstatusheadingtextnotlogged}</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.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>{$server.uptime}</td>
		</tr>
	{foreachelse}
		<tr class="clientareatableactive">
			<td colspan="7">{$LANG.serverstatusnoservers}</td>
		</tr>
	{/foreach}
	</table>

{/if}

{/if}

<br />
<br />

 

Add a new entry to your language files: lang/english.php

This is for users not logged in.

$_LANG['serverstatusheadingtextnotlogged'] = "Below is a real-time overview of the network servers.";

Edited by disgruntled
Link to comment
Share on other sites

This is awesome. My question is - will this show "only" the servers the user has "hosting" accounts on or will it show the servers they have a VPS on as well or a database server?

 

This does a check of all hosting the client has an account on, it checks from tblhosting, if this doesnt pick up the servers for the clients vps let me know and i will get that added in.

Link to comment
Share on other sites

as well or a database server?

 

Sorry i missed this part.

 

Because the status page works off the clients services unless the database servers are being sold within whmcs and are set up as a seperate server this will not work for the client.

 

For example, if you were to set up a new server group called Databases and add the associated servers for databases to that group then this would allow you to make specific products to be provisioned on the servers within this group.

 

The way in which you would actually provision is entirely your own choice and unrelated to this module.

 

In answer to your original question. This action hook should pick all of the clients hosting/server/databases so long as they are assigned to a correct product grouping then they will display in the appropriate place.

 

At the moment they will not display if not in a grouping, but i will make the changes and allow for this check to be in place and group all none group servers into one place after the main groups.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 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