Jump to content
Patrick

PHP Server Status / Rainmeter Widget

Recommended Posts

image.png

<?php
// load framework library
require_once("TeamSpeak3/TeamSpeak3.php");

try
{
#Set your  IP & Port here, don't edit any of the format below or it will break rainmeter code.
$ip_query = 'localhost:10011';
$port = 9987;


$ts3 = TeamSpeak3::factory("serverquery://$user:[email protected]$ip_query/?server_port=$port&nickname=Server-Status-Desktop");
 // show server as online
  echo "<title>Server Status:" . " Online" . "</title>\n";
  echo "<title>Server Uptime: " . TeamSpeak3_Helper_Convert::seconds($ts3->virtualserver_uptime) . "</title>\n";
  echo "<title>Current Clients: " . $ts3->virtualserver_clientsonline . " / " . $ts3->virtualserver_maxclients . "</title>\n";

  $PL = $ts3->getProperty("virtualserver_total_packetloss_total");
  $Output = (string)$PL;
  $Rounded = round($Output,3);

  $Output = ($Rounded * 100) . '%';
  echo "<title>Packet Loss: " . $Output . "</title>\n";
}
catch(Exception $e)
{
  // grab errors and show server as offline
echo "<title>Server Status:" . "" . " Offline</title>\n";
echo "<title></title>\n";
echo "<title></title>\n";
echo "<title></title>\n";
}
?>

 

I've attached the rainmeter package file to this post. 

 

README for rainmeter:

 

Edit line 6 with the URL path to your server-status script.

Edit line 46 with your server max clients so:

Formula=(MeasureClientsBar/512) * 100

If you have 128 max clients change the above to:

Formula=(MeasureClientsBar/128) * 100

 

TeamSpeak Server Status_1.0.rmskin

 

PHP Dependency: https://github.com/planetteamspeak/ts3phpframework

Share this post


Link to post
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.   Restore formatting

  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.


×
×
  • Create New...