Jump to content

Server Status display wizardry


redrat

Recommended Posts

  • 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.

 

 

Am i missing something, where are theses template files or do you have to create them yourself :S

Link to comment
Share on other sites

Create new files yourself.

 

the contents of each file come from various mods around the forum (but you'll have to search for them ;) )

 

personally, I've found on various upgrades that it's quicker to drop "include" lines of code into new tpls, rather than have to compare 2-300 lines of code in your existing file, to that of the new file.

 

Of course you could just wait until you have to upgrade & find out the hard way like we all did

Link to comment
Share on other sites

  • 3 weeks later...

I have tried the includes.. webhost is my template name

{include file='webhost/serverstatus.tpl'}

along with copy/pasting the content from serverstatus.tpl into the clientareahome.tpl

 

but always get the error

Fatal error: Smarty error: [in webhost/serverstatus.tpl line 16]: [plugin] unknown tag - 'get_port_status' (core.load_plugins.php, line 118) in /home/cremama/public_html/libs/Smarty.class.php on line 1095

line 16 is the

<td>{get_port_status num="$num" port="80"}</td>

 

the server status page works great on its own

Link to comment
Share on other sites

  • 1 month later...

RedRat:

10 / 10 for you! (: (:

When i make the suggested changes, and then view the Server Status setup etc, everything looks ok.

Then when viewing: http://www.___.com/___/admin/configservers.php

I see the changes (as per the screen shot, nice. :)

 

However! When visiting: http://www.___.com/___/serverstatus.php

I get an error message after making your recommended changes (v3.7.2 user)

 

Fatal error: Smarty error: [in portal/serverstatus.tpl line 6]: syntax error: unrecognized tag: $disabled_funcs=array_map('trim',explode(',',ini_get('disable_functions'))); (Smarty_Compiler.class.php, line 439) in /home/____/public_html/____/libs/Smarty.class.php on line 1095

 

I modified both ../templates/portal/serverstatus.tpl (and portal is active theme). I created the new folder and index file as per step 2.

 

WORKS: http://www.___.com/billing/___/configservers.php

 

NO WORK: http://www.___.com/___/serverstatus.php

 

Thank you very much, and happy new year!

(: em.

Link to comment
Share on other sites

@lloydcodrington: Hi Lloyd. Could you just check that you have the following lines of code in your /WHMCS/templates/portal/serverstatus.tpl file:

//SMTP
$port = 25;

$fp = fsockopen($host,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td><img src=\"images/statusfailed.gif\"></td>";


}else{
echo "<td><img src=\"images/statusok.gif\"></td>";

fclose($fp);
}
$this->assign('serverid',$serverid);
$this->assign('servername',$servername);

{/php}

They are towards the bottom of the file after the lines relating to POP3. Please compare carefully. Thanks.

 

@flip Hi flip. Are you sure that you have the /status/index.php file in the /public_html folder? Thus /public_html/status/index.php May I also suggest that you try upgrading to 3.8.1. You could also try re-uploading serverstatus.php in binary mode as well as the /home/____/public_html/____/libs/Smarty.class.php

 

Hope this helps.

Edited by redrat
Link to comment
Share on other sites

ohhhhhhhh

:b

So index.php has to go under /public_html/status/*.*

not /public_html/whmcs.folder/status/*.*

 

???

Thank you :)

 

p.s. i tried merging the two scripts, the original status and the new script above, and made a bit of a mess too!

Thank god for backups....

 

Would be nice to keep the 'ticks' to see which services are running, and what aren't.

I've got a really really really nice server status script, but it did not like any of the code, when i put it in a TPL... lol

:(

 

thanks again!

e.

Link to comment
Share on other sites

I need to modify this slightly. For example I use Helm and although installed on the same server, doesn't use the same IP address and uses port 80. In the serverstatus.tpl file I have changed cPanel to Helm and there is a port entry there, but how do I get the script to check a different IP and port combination?

 

Cheers, David.

Link to comment
Share on other sites

I done it.

 

Change the $host in the following lines:

 

$fp = fsockopen($host,$port,$errno,$errstr,10);

 

to the IP address in question e.g:

 

$fp = fsockopen("127.0.0.1",$port,$errno,$errstr,10);

 

For more detals Google "fsockopen" and view the PHP manual for this command.

Link to comment
Share on other sites

  • 1 month later...

Hi!

 

This is a great contrib!

 

I made some modifications that might be useful. First one is simlpe - I use Plesk and as such needed to change the port number and column label accordingly. The next one was to replace the use of the IP address when checking each service with the domain name. I've also added ALT tags for each of the status markers because at one point I screwed up while swapping the position around on a couple of them and had a status marker sitting off to the side with no clue as to what it was for. The final one was to add a status for web mail in case I decide not to provide this service or the service goes down for some reason.

 

Code:

 
{if $loggedin}
<table  width="100%" class="clientareatable" align="center" cellspacing="1">
<tr class="clientareatableheading">
<td>{$LANG.servername}</td>
<td>Hosting</td>
<td>Plesk</td>
<td>HTTP</td>
<td>FTP</td>
<td>POP3</td>
<td>SMTP</td>
<td>WebMail</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) {
//Plesk
$port = 8443;
$fp = fsockopen($hosteddomains,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<tr class=\"clientareatableactive\">";
echo "<td><b>".$servername."</b> </td>";
echo "<td>" .$hosteddomains."</td>";
echo "<td><img src=\"images/statusfailed.gif\" alt=\"Plesk\"></td>";

}else{
echo "<tr class=\"clientareatableactive\">";
echo "<td>".$servername." </td>";
echo "<td>" .$hosteddomains."</td>";
echo "<td><img src=\"images/statusok.gif\" alt=\"Plesk\"></td>";
fclose($fp);
}
//HTTP
$port = 80;
$fp = fsockopen($hosteddomains,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td><img src=\"images/statusfailed.gif\" alt=\"HTTP\"></td>";
}
else{
echo "<td><img src=\"images/statusok.gif\" alt=\"HTTP\"></td>";
fclose($fp);
}
//FTP
$port = 21;
$fp = fsockopen('ftp.'.$hosteddomains,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td><img src=\"images/statusfailed.gif\" alt=\"FTP\"></td>";

}else{
echo "<td><img src=\"images/statusok.gif\" alt=\"FTP\"></td>";
fclose($fp);
}
//POP3
$port = 110;
$fp = fsockopen('mail.'.$hosteddomains,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td><img src=\"images/statusfailed.gif\" alt=\"POP3\"></td>";

}else{
echo "<td><img src=\"images/statusok.gif\" alt=\"POP3\"></td>";
fclose($fp);
}
//SMTP
$port = 25;
$fp = fsockopen('mail.'.$hosteddomains,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td><img src=\"imagesfailed.gif\" alt=\"SMTP\"></td>";

}else{
echo "<td><img src=\"images/statusok.gif\" alt=\"SMTP\"></td>";
fclose($fp);
}
$this->assign('serverid',$serverid);
$this->assign('servername',$servername);
//WEBMAIL
$port = 80;
$fp = fsockopen('webmail.'.$hosteddomains,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td><img src=\"images/statusfailed.gif\" alt=\"WebMail\"></td>";

}else{
echo "<td><img src=\"images/statusok.gif\" alt=\"WebMail\"></td>";
fclose($fp);
}
{/php}
{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}

 

One thing that has stumped me and I'm not sure if anyone else will see this or not is that the status of WebMail will alternate between being available and not available even though the service is available without issue.

Link to comment
Share on other sites

That level of functionality has not yet been built in. But there is no reason why it could not be.

 

The whole point of this mod was only ever to show exactly what you want to show. Necessity is the mother of invention.

 

There is no shortage of great coders here on WHMCS. Just a matter of one of them picking up wishes and making them come true.

Link to comment
Share on other sites

Hi Interweb. One of the main ideas about this mod was actually, purposefully, not to show the server status and uptime stats as such but, instead, just to show graphic indicators for all the key ports. EG: Green is good and red is not. I'm not sure what screen shots you are referring to......could you just mention the post number and I'll have a look at what you are referring to. Thanks.

 

This mod will not show all of your servers on one page as a generic display available to all users regardless as to whether they have relevant accounts. It is designed, though, to show all the servers that are applicable to each client. So, if a client has accounts on X servers then they will see the corresponding displays for each of X but only when logged in.

 

The mod was actually designed for less established, smaller host providers who expressly do not wish to broadcast that they may only have one server and this is a neat way around that problem plus gives considerably expanded info on port condition that the standard whmcs version does. More useful to clients if you like but with less issues for the host.

 

The other main feature of this mod is not to show the php info link which is a potential security risk and is, anyway, available in cPanel itself.

 

Does the above answer your question sufficiently?

 

There is, I believe, an additional variant of a server status mod somewhere in these forums that does show all servers generically. I'm just not sure where I've seen it. Perhaps a search might help.

 

Regards. :)

 

PS: Interweb: I really like your interesting web site. Well done! ;)

Edited by redrat
Link to comment
Share on other sites

Hi Redrat, many thanks for the comment about or site, we are still always adding and changing parts of it.

 

We love this script and it does the job perfectly, but I would like to show the status of the uptime of the server or have the option to, how can we do this?

 

I am trying to get a page which is seperate to this to show all our servers, ideally being able to add a specific port number for each to show media servers are up with uptime, any ideas on how we can do this?

 

Thanks, John

Link to comment
Share on other sites

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