1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Whitespace cleanup

* remove trailing whitespace
* remove empty lines at the end of files
This commit is contained in:
Lars Kruse 2018-08-02 02:03:42 +02:00
parent ef851f0c34
commit 17f784270a
604 changed files with 2927 additions and 2945 deletions

View file

@ -26,7 +26,7 @@ use Net::Telnet;
# CONFIG HERE!
my $hostname = "localhost"; # serveraddress
my $port = 10011; # querryport (default: 10011)
my @serverids = (1); # array of virtualserverids (1,2,3,4,...)
my @serverids = (1); # array of virtualserverids (1,2,3,4,...)
my $username = ""; # only set if the default queryuser hasn´t enough rights (should work without this)
my $password = "";
@ -47,11 +47,11 @@ if(exists $ARGV[0] and $ARGV[0] eq "config")
exit 0;
}
else
{
my $telnet = new Net::Telnet(Timeout=>5, Errmode=>"return", Prompt=>"/\r/");
{
my $telnet = new Net::Telnet(Timeout=>5, Errmode=>"return", Prompt=>"/\r/");
if (!$telnet->open(Host=>$hostname, Port=>$port)) {
die exit;
}
}
$telnet->waitfor("/Welcome to the TeamSpeak 3 ServerQuery interface/");
foreach my $server (@serverids)
{
@ -62,7 +62,7 @@ else
$telnet->waitfor("/error id=0 msg=ok/");
}
$telnet->cmd("serverinfo");
my $clients = 0;
my $queryclients = 0;
my $line = $telnet->getline(Timeout=>5);
@ -74,7 +74,7 @@ else
}
$telnet->waitfor("/error id=0 msg=ok/");
print "$server.value ".($clients - $queryclients)."\n";
}
}
$telnet->close;
}
exit;

View file

@ -16,7 +16,7 @@
#
#######################################################
# 02.10.10 - v0.3
# -now works again with 3.0.0-beta29
# -now works again with 3.0.0-beta29
#
# 18.04.10 - v0.2
# -transfer mode added
@ -25,20 +25,20 @@
# -initial release
#
######################################################
#%# family=auto
#%# capabilities=autoconf suggest
use strict;
use Net::Telnet;
# CONFIG HERE!
my $hostname = $ENV{host} || "localhost"; # serveraddress
my $port = $ENV{port} || 10011; # querryport
my $user = $ENV{user} || "serveradmin";
my $password = $ENV{password} || "";
my $filename = "ts3v2_";
# SCRIPT START!
#init telnet connection
my $name = ""; my $server = ""; my @num; my $id = 0; my $i = 0; my $myserver; my $transfer;
@ -57,7 +57,7 @@ if ($password ne "") {
die "ServerQuery login failed: ".$response;
}
}
#get argument
my $argument = "";
if ($0 =~ /$filename(\w+)$/i) {
@ -66,7 +66,7 @@ if ($0 =~ /$filename(\w+)$/i) {
die "Error: We need to know what serverid you want, so link this plugin as "
.$filename."1, ".$filename."2 or ".$filename."overview.\n";
}
#check for overview, transfer or single server mode
my $mode = "";
if ($argument eq "overview" or $argument eq "transfer" or (defined $ARGV[0] and ($ARGV[0] eq "suggest" or $ARGV[0] eq "autoconf"))) {
@ -92,7 +92,7 @@ if ($argument eq "overview" or $argument eq "transfer" or (defined $ARGV[0] and
} else {
die "ERROR: unknown plugin mode: $argument\n";
}
#check for config mode
if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
print "yes";
@ -111,7 +111,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
$telnet->waitfor("/error id=0 msg=ok/");
$telnet->cmd("serverinfo");
my $line = $telnet->getline(Timeout=>1);
if ($line =~ m/virtualserver_id=(\d+) virtual/) {
my $id = $1;
} else {
@ -124,7 +124,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
die "ERROR: server string not recognized!\n";
}
$telnet->waitfor("/error id=0 msg=ok/");
print "graph_title Teamspeak Users ".$name."\n";
print "graph_vlabel Connected Teamspeak Users\n";
print "graph_category voip\n";
@ -132,7 +132,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
print "users.label Users\n";
print "users.info Connected users to ".$name."\n";
print "users.type GAUGE\n";
exit 0;
} elsif ($mode eq "o") {
#overview mode
@ -140,7 +140,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
print "graph_vlabel Connected Teamspeak Users\n";
print "graph_category voip\n";
print "graph_info This graph shows the number of connected users on a Teamspeak3 server\n";
foreach (@num) {
$telnet->cmd("use sid=".$_);
$telnet->waitfor("/error id=0 msg=ok/");
@ -176,7 +176,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
$telnet->cmd("use sid=".$server);
$telnet->waitfor("/error id=0 msg=ok/");
$telnet->cmd("serverinfo");
my $line = $telnet->getline(Timeout=>1);
if ($line =~ m/virtualserver_clientsonline=(\d+) /) {
print "users.value ".($1-1)."\n";
@ -191,7 +191,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
$telnet->cmd("use sid=".$_);
$telnet->waitfor("/error id=0 msg=ok/");
$telnet->cmd("serverinfo");
my $line = $telnet->getline(Timeout=>1);
if ($line =~ m/virtualserver_clientsonline=(\d+) /) {
print $_.".value ".($1-1)."\n";
@ -211,10 +211,10 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
die "ERROR: server string not recognized!\n";
}
$telnet->waitfor("/error id=0 msg=ok/");
}
}
#close telnet connection
$telnet->close;
exit;

View file

@ -1,5 +1,5 @@
#!/usr/bin/perl
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,
@ -68,7 +68,7 @@ elsif ( exists $ARGV[0] and $ARGV[0] eq "autoconf" )
}
}
}
else
else
{
foreach my $server (@uports)
{
@ -76,7 +76,7 @@ else
print $FS "si ".$server, "\n\n";
my $MASK = $string."=*";
while(<$FS>)
while(<$FS>)
{
my $input_line = $_;
if ( $input_line =~ m/($MASK)/ )