TeamSpeak-3 - Current Players Template
Moderators: Developers, Moderators
TeamSpeak-3 - Current Players Template
Hi Cacti Community,
For Teamspeak2 there are one nice Cacti Template available where give a good overview how many players are connected on a TeamSpeak-2 server.
No I have searched for a new templates for the TeampSpeak3 server.
And I have found one nice Perl-script where are coded for the Munin application. This Perl-script readout the virtualserver_clientsonline for each TS3 instance.
So I'm a really bad code-scripter and my Cacti knowhow are also limited. Maybe it will suffice to adapt the old code from Pinky... But if there someone where will code a new template that would be really awesome...
Cheerio,
InitZero
For Teamspeak2 there are one nice Cacti Template available where give a good overview how many players are connected on a TeamSpeak-2 server.
No I have searched for a new templates for the TeampSpeak3 server.
And I have found one nice Perl-script where are coded for the Munin application. This Perl-script readout the virtualserver_clientsonline for each TS3 instance.
So I'm a really bad code-scripter and my Cacti knowhow are also limited. Maybe it will suffice to adapt the old code from Pinky... But if there someone where will code a new template that would be really awesome...
Cheerio,
InitZero
Do you use Teamspeak 2 template already? (i mean with server selection ip:port) like this one http://forums.cacti.net/viewtopic.php?p=104424#104424 ?
if yes, you can use this script (ts3.php) with some cosmetic change in your XML..
Just remplace IP:Port by IP:ServerID
ts3.php
All credits to original owner.
if yes, you can use this script (ts3.php) with some cosmetic change in your XML..
Just remplace IP:Port by IP:ServerID
Code: Select all
root@ns1:/usr/share/cacti/site/scripts >php ts2.php 127.0.0.1:9006
max:100 now:55
root@ns1:/usr/share/cacti/site/scripts >php ts3.php 127.0.0.1:1
max:100 now:22
Code: Select all
#!/usr/bin/php
<?
function getSocket($host, $port, $errno, $errstr, $timeout) {
global $errno, $errstr;
$socket = fsockopen($host, $port, $errno, $errstr, $timeout);
if(!$socket or fread($socket, 3) != "TS3") {
echo("Server error: Teamspeak server not running!\n");
return false;
}
return $socket;
}
function sendQuery($socket, $query) {
fputs($socket, $query."\n");
}
function closeSocket($socket) {
fputs($socket, "quit\n");
fclose($socket);
}
$server = explode(":", $argv[1]);
$socket = getSocket($server[0], 10011, $errno, $errstr, 1);
if($errno != 0) exit(1);
sendQuery($socket, "use sid=".$server[1]);
fread($socket, 19);
sendQuery($socket, "serverinfo");
$vars = fread($socket, 3000);
closeSocket($socket);
$var1 = explode(" ", $vars);
$now = explode("=", $var1[7]);
$max = explode("=", $var1[5]);
$n = $now[1]-1;
echo "max:$max[1] now:$n";
?>
- Attachments
-
- cacti_graph_template_teamspeak_3_-_players.xml
- TeamSpeak 3 Template updated.
- (8.89 KiB) Downloaded 629 times
I changed your script to get
Only have no idea on how to make a template for it so it are nice graphs like interface traffic.
edit: nvm
Code: Select all
connection_bytes_sent_total=
Code: Select all
connection_bytes_received_total=
edit: nvm
- Attachments
-
- cacti_grafph_ts3_online_users.JPG (47.82 KiB) Viewed 10557 times
-
- cacti_grafph_ts3_traffic.JPG (64.13 KiB) Viewed 10557 times
I make some changes to the script and work on template you posted, i've done some changes to get working bandwidth and players together so, it's based on scripts/templates in this page, and i would give a feedback to this community.
First problem i found was that server info was unable to be obtained without use of serverquery user/password [given by ts3 on its first start] .
what i'm posting is the result of my tries
Hope this will ben useful
Pack i post contains:
- bandwidth template & dependency
- players template & dependency
- php scripts i create to manage TS3, it is easy to extend if needed.
First problem i found was that server info was unable to be obtained without use of serverquery user/password [given by ts3 on its first start] .
what i'm posting is the result of my tries
Hope this will ben useful
Pack i post contains:
- bandwidth template & dependency
- players template & dependency
- php scripts i create to manage TS3, it is easy to extend if needed.
- Attachments
-
- teamspeak3_cacti.zip
- (7.14 KiB) Downloaded 474 times
Re: TeamSpeak-3 - Current Players Template
Does this script stopped working for beta29?
edit:
They added:
edit:
They added:
Code: Select all
! serverquery sends between the ts3 prompt also a new welcome message
Re: TeamSpeak-3 - Current Players Template
Beta29 Welcome fix.
ts3.php
ts3.php
Code: Select all
#!/usr/bin/php
<?
function getSocket($host, $port, $errno, $errstr, $timeout) {
global $errno, $errstr;
$socket = fsockopen($host, $port, $errno, $errstr, $timeout);
if(!$socket or fread($socket, 4) != "TS3\n") {
echo("Server error: Teamspeak server not running!\n");
return false;
}
fread($socket, 200);
return $socket;
}
function sendQuery($socket, $query) {
fputs($socket, $query."\n");
}
function closeSocket($socket) {
fputs($socket, "quit\n");
fclose($socket);
}
$server = explode(":", $argv[1]);
$socket = getSocket($server[0], 10011, $errno, $errstr, 1);
if($errno != 0) exit(1);
sendQuery($socket, "use sid=".$server[1]);
fread($socket, 19);
sendQuery($socket, "serverinfo");
$vars = fread($socket, 3000);
closeSocket($socket);
$var1 = explode(" ", $vars);
$now = explode("=", $var1[7]);
$max = explode("=", $var1[5]);
$n = $now[1]-1;
echo "max:$max[1] now:$n";
?>
Re: TeamSpeak-3 - Current Players Template
Thanks.
Its working again.
Only real slow for large teamspeak3 servers.
Its working again.
Only real slow for large teamspeak3 servers.
- TheWitness
- Developer
- Posts: 17007
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Re: TeamSpeak-3 - Current Players Template
PHP is an awesome language...
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Re: TeamSpeak-3 - Current Players Template
I see this is an old post, but anyone have it worked on latest version of teamspeak?!
Re: TeamSpeak-3 - Current Players Template
^ Bump ^
I'm also really interested in this, especially the players and bandwidth one
Any help would be great!
I'm also really interested in this, especially the players and bandwidth one
Any help would be great!
-
- Posts: 1
- Joined: Sat Dec 27, 2008 8:35 pm
- Location: Albany, WA
- Contact:
Re: TeamSpeak-3 - Current Players Template
I've added the changes from Korigon's post to vtesei's script which I can confirm works for me on TeamSpeak 3.0.5.
I am not the original author the template/script so I cannot provide guaranteed support.
The only thing I had problem with was Cacti's spine for polling. When I used that I couldn't get the players graph to populate. A debug of the log file showed it was getting a result of "output: U". Once I changed it to cmd.php for poller it started to work. Might have a bit more of a tackle later.
I am not the original author the template/script so I cannot provide guaranteed support.
The only thing I had problem with was Cacti's spine for polling. When I used that I couldn't get the players graph to populate. A debug of the log file showed it was getting a result of "output: U". Once I changed it to cmd.php for poller it started to work. Might have a bit more of a tackle later.
- Attachments
-
- teamspeak3_cacti_v0.2.zip
- (6.76 KiB) Downloaded 349 times
Re: TeamSpeak-3 - Current Players Template
shameless bump.
I've attempted to configure this using cacti 0.8.7e however the graph is unable to populate.
debug shows the following:
running ts3_extended.php from ~/scripts/ shows the following:
*removed actual details*
max:512 now:64
any ideas on why this might not be populating?
I've attempted to configure this using cacti 0.8.7e however the graph is unable to populate.
debug shows the following:
Code: Select all
AREA:a#8D85F3FF:"Clients" \
GPRINT:a:LAST:"Now\:%8.0lf" \
GPRINT:a:AVERAGE:"Avg\:%8.0lf" \
GPRINT:a:MAX:"Max\:%8.0lf\n"
RRDTool Says:
OK
Code: Select all
php ts3_extended.php IP ID admin admin clients
max:512 now:64
any ideas on why this might not be populating?
-
- Posts: 1
- Joined: Fri Mar 21, 2014 3:21 am
Re: TeamSpeak-3 - Current Players Template
Hi out there
I'm lost and need some basic help on installing this template.
I have successfully imported the templates (bandwith and #of players). I now have in Cacti
I dont' have a Data Query and/or Host Template.
When I create a new device I can create the Data sources but I dont have any data queries.
About the script in general - where do I change the query port and why do I nees a user and password?
Any help is appreciated
Regards,
Gunslinger
I'm lost and need some basic help on installing this template.
I have successfully imported the templates (bandwith and #of players). I now have in Cacti
- Data Input Method
Graph Templates
Data Templates
I dont' have a Data Query and/or Host Template.
When I create a new device I can create the Data sources but I dont have any data queries.
About the script in general - where do I change the query port and why do I nees a user and password?
Any help is appreciated
Regards,
Gunslinger
Who is online
Users browsing this forum: No registered users and 0 guests