Page 1 of 1

so guess servers are down?

Posted: Wed Nov 07, 2018 4:14 pm
by Thott
servers down? so is TS for me. So just checking it's not just me.

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:16 pm
by oneyedranger
I am starring at log in screen in anticipation...the one day I am home figures

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:22 pm
by Jhereg
Yeah, about 2/3 of the servers are down, got to server select finally and Drinal is down.

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:28 pm
by Moonshaadow
oh it must be family time out time

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:29 pm
by Moonshaadow
TS been down all day for our server. I been able to connect into UF's and the public one/

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:33 pm
by Andreii
The Everquest forums are down too. Also, the Server Status indicator on the main EQ page shows all servers as up. I'm guessing it and theb servers stopped communicating.

--Endered

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:37 pm
by Glauri
Thott wrote:
Wed Nov 07, 2018 4:14 pm
servers down? so is TS for me. So just checking it's not just me.
Same for me! /sigh

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:38 pm
by Littlabit
IF team speak servers are down someone needs to send me a message so that I can reboot it and fix it.

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:44 pm
by Thott
This should help with monitoring teamspeak and alert you when it's down.

Code: Select all

#!/usr/bin/perl

#Parameter:
# -H            host
# -h            help
# -t            telnet port (default: 10011)
# -u            (Optional) A user name
# -p            (Optional) A password
# -w            warning usercount percent
# -c            Critical usercount percent
# -s            Server instance id
# -V            version
# -v            verbose

use strict;
use IO::Socket;
use Getopt::Long;
use Time::HiRes qw(gettimeofday);

use lib "/usr/lib/nagios/plugins/" ;
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use vars qw($PROGNAME $opt_v $opt_V $opt_h $opt_H $opt_w $opt_c $opt_t $opt_l $opt_u $opt_p $opt_sid @servers $duration %EscapePattern);

my $PROGNAME="check_teamspeak3";
my $VERSION="2.0";

my $DEFAULT_USERCNT_WARN        = 70;
my $DEFAULT_USERCNT_CRIT        = 90;
my $DEFAULT_TELNET_PORT         = 10011;

Getopt::Long::Configure('bundling');
GetOptions
	("V"   => \$opt_V, "version"       => \$opt_V,
	 "h"   => \$opt_h, "help"          => \$opt_h,
	 "l"   => \$opt_l, "list"          => \$opt_l,
	 "w=f" => \$opt_w, "warning=f"     => \$opt_w,
	 "c=f" => \$opt_c, "critical=f"    => \$opt_c,
	 "u=s" => \$opt_u, "user=s"    	   => \$opt_u,
	 "s=i" => \$opt_sid, "sid=i"       => \$opt_sid,
	 "p=s" => \$opt_p, "password=s"    => \$opt_p,
	 "H=s" => \$opt_H, "hostname=s"    => \$opt_H,
	 "t=f" => \$opt_t, "telnetport=f"  => \$opt_t);

if ($opt_V) {
	print_revision($PROGNAME, $VERSION);
	exit $ERRORS{'OK'};
}

if ($opt_h) {
	print_help();
	exit $ERRORS{'OK'};
}

unless ($opt_H) {
	print "No target host specified\n";
	print_usage();
	exit $ERRORS{'UNKNOWN'};
}

my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
($host) || print_usage("Invalid host: $opt_H\n");

($opt_w) || ($opt_w = $DEFAULT_USERCNT_WARN);
my $uwarn = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/);
($uwarn) || print_usage("Invalid warning threshold: $opt_w\n");

($opt_c) || ($opt_c = $DEFAULT_USERCNT_CRIT);
my $ucrit = $1 if ($opt_c =~ /([0-9]{1,2}|100)+/);
($ucrit) || print_usage("Invalid critical threshold: $opt_c\n");

unless ($uwarn <= $ucrit){
	print "Critical usercpunt must not be smaller than warning usercpunt\n";
	print_usage();
	exit $ERRORS{'UNKNOWN'};
}

unless ($opt_t) {
	$opt_t = $DEFAULT_TELNET_PORT;
}

if ($opt_u) {
	unless ($opt_p) {
		print "No password specified\n";
		print_usage();
		exit $ERRORS{'UNKNOWN'};
	}
}

if ($opt_l) {
	&list_servers();
	my $ret = "UNKNOWN: Active servers : ";
	foreach my $server (@servers) {
		$ret .= $server." ";
	}
	print  $ret."\n";
	exit $ERRORS{'UNKNOWN'};
}

# Just in case of problems, let's not hang Nagios
$SIG{'ALRM'} = sub {
	print ("ERROR: No response from teamspeakserver (alarm)\n");
	exit $ERRORS{"UNKNOWN"};
};
alarm($TIMEOUT);

sub connect_serverquery {
	my $sock = IO::Socket::INET->new(qq($opt_H:$opt_t));
	unless ($sock) {
		print ("ERROR: Unable to open Socket on $opt_H:$opt_t\n");
		exit $ERRORS{"CRITICAL"};
	}
	return $sock;
}

sub login {
	my ($sock) = @_;

	if ($opt_u) {
		print $sock "login ".EscapeLogin($opt_u)." ".EscapeLogin($opt_p)."\n";
	}

	if ($opt_sid) {
		print $sock "use sid=$opt_sid\n";
	}
}

sub list_servers {
	my $starttime = gettimeofday;

	my $sock = connect_serverquery();
	login($sock);

	print $sock qq(serverlist\nquit\n);
	while(<$sock>) {
		chomp;
		foreach (split(/\|/)) {
			if (/virtualserver_port=(\d+)/) {
				push @servers,$1;
			}
		}
	}
	my $endtime = gettimeofday;
	$duration += $endtime - $starttime;
	return @servers;
}

sub EscapeLogin{
	my $str=shift;
	$str=~s/^\s*(.*)\s*$/$1/g;
	$str=~s/\\/\\\\/g;
	$str=~s/\//\\\//g;
	$str=~s/ /\\s/g;
	$str=~s/\|/\\p/g;
	$str=~s/;/\\;/g;
	return $str;
}

get_data();

sub get_data {
	my $starttime = gettimeofday;
	my $currentusers = 0;
	my $maxusers = 0;
	my $userpercent = 0;
	my $bytesup = 0;
	my $bytesdown = 0;
	my $uptime = 0;

	my $sock = connect_serverquery();
	login($sock);

	print $sock qq(hostinfo\nquit\n);
	while(<$sock>){
		foreach (split(/\|/)) {
			if(/virtualservers_total_clients_online=(\d+)/){
				($currentusers) = $1;
			}
			if(/virtualservers_total_maxclients=(\d+)/){
				($maxusers) = $1;
			}
			if(/connection_bytes_sent_total=(\d+)/){
				($bytesup) = $1;
			}
			if(/connection_bytes_received_total=(\d+)/){
				($bytesdown) = $1;
			}
			if(/instance_uptime=(\d+)/){
				($uptime) = $1;
			}
		}
	}
	my $endtime = gettimeofday;
	$duration += $endtime - $starttime;
	$duration = sprintf "%2f", $duration;
	my $perfdata = "users=".$currentusers.";maxusers=".$maxusers.";bytessend=".$bytesup.";bytesreceived=".$bytesdown.";uptime=".$uptime;
	if ($maxusers > 0) {
		$userpercent = ($currentusers * 100.0) / $maxusers;
	} else {
		print ("ERROR: Unable to get maxclients from $opt_t\n");
		exit $ERRORS{"UNKNOWN"};
	}
	if ($userpercent >= $ucrit) {
		print "CRITICAL: current users: $currentusers on server: $opt_t ; queryduration: ".$duration." | ".$perfdata."\n";
		exit $ERRORS{"CRITICAL"};
	} elsif ($userpercent >= $uwarn) {
		print "WARNING: current users: $currentusers on server: $opt_t ; queryduration: ".$duration." | ".$perfdata."\n";
		exit $ERRORS{"WARNING"};
	} else {
		print "OK: current users: $currentusers on server: $opt_t ; queryduration: ".$duration." | ".$perfdata."\n";
		exit $ERRORS{"OK"};
	}
}

sub print_usage () {
	print "Usage: $PROGNAME [-V] -H <host> [-t <telnet port>] [-s <server instance>] [-u <user> -p <password>] [-w <warn>] [-c <crit>] [-l]\n";
}

sub print_help () {
	print_revision($PROGNAME, $VERSION);
	print_usage();
	print "
Checks the Teamspeak 3 server on host H:t where
 -V, --version
   Print version information
 -h, --help
   Print detailed help screen
 -l, --list
   list running TS Servers on -H <Host>
 -H, --hostname=ADDRESS
   Host name argument
 -t, --telnetport=INTEGER
   Port number of telnet port (default: 10011)
 -u, --user=STRING
   A user name
 -s, --sid=INTEGER
   Server instance ID
 -p, --password=STRING
   The users password
 -w, --warning=FLOAT
   Usercount warning percent (default: 70)
 -c, --critical=FLOAT
   Usercount critical percent (default: 90)
";
	support();
}

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:47 pm
by Meso
Well maybe some link to DOJ and bandwidth issues with Sessions resignation. Hah, everyone mail him a joint. I bet he'd smoke it now.

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:53 pm
by Glauri
Our server went from "down" to "locked". Whatever...

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:56 pm
by Littlabit
Thanks thott!

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 4:57 pm
by Littlabit
6:57 and still can not get on.. I'm pretty sure to say the raid is called :) Just in case you were wondering

EDIT: NO RAID

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 5:00 pm
by Moonshaadow
Woot! Finally got me avatar here!

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 5:01 pm
by Girrin
They are coming back up now

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 5:03 pm
by Andreii
Servers are now showing as "up" on the server status page, and Endered and Viirus are both logging in.

--Endered

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 5:06 pm
by Tandt
cant get to server select.

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 5:09 pm
by Harrington66
I just tried. No joy. Its 5:07, and I am going into withdrawal.

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 5:10 pm
by oneyedranger
everyone is logging on now

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 5:14 pm
by Littlabit
Everyone is logging in with a LOCK server? NM now it says up!

Re: so guess servers are down?

Posted: Wed Nov 07, 2018 5:15 pm
by Tandt
no joy 4 me