Projet

Général

Profil

Révision 17f78427

ID17f784270ae966ee9a13e9f5104a5b8f925b639e
Parent ef851f0c
Enfant d4320aea, 5b2396a9

Ajouté par Lars Kruse il y a plus de 7 ans

Whitespace cleanup

  • remove trailing whitespace
  • remove empty lines at the end of files

Voir les différences:

plugins/teamspeak/ts3v2_
16 16
#
17 17
#######################################################
18 18
# 02.10.10 - v0.3
19
#		    -now works again with 3.0.0-beta29 
19
#		    -now works again with 3.0.0-beta29
20 20
#
21 21
# 18.04.10 - v0.2
22 22
#           -transfer mode added
......
25 25
#           -initial release
26 26
#
27 27
######################################################
28
 
28

  
29 29
#%# family=auto
30 30
#%# capabilities=autoconf suggest
31
 
31

  
32 32
use strict;
33 33
use Net::Telnet;
34
 
34

  
35 35
# CONFIG HERE!
36 36
my $hostname =  $ENV{host} || "localhost";    # serveraddress
37 37
my $port =      $ENV{port} || 10011;      # querryport
38 38
my $user =      $ENV{user} || "serveradmin";
39 39
my $password =  $ENV{password} || "";
40 40
my $filename =  "ts3v2_";
41
 
41

  
42 42
# SCRIPT START!
43 43
#init telnet connection
44 44
my $name = ""; my $server = ""; my @num; my $id = 0; my $i = 0; my $myserver; my $transfer;
......
57 57
        die "ServerQuery login failed: ".$response;
58 58
  }
59 59
}
60
 
60

  
61 61
#get argument
62 62
my $argument = "";
63 63
if ($0 =~ /$filename(\w+)$/i) {
......
66 66
        die "Error: We need to know what serverid you want, so link this plugin as "
67 67
                .$filename."1, ".$filename."2 or ".$filename."overview.\n";
68 68
}
69
 
69

  
70 70
#check for overview, transfer or single server mode
71 71
my $mode = "";
72 72
if ($argument eq "overview" or $argument eq "transfer" or (defined $ARGV[0] and ($ARGV[0] eq "suggest" or $ARGV[0] eq "autoconf"))) {
......
92 92
} else {
93 93
        die "ERROR: unknown plugin mode: $argument\n";
94 94
}
95
 
95

  
96 96
#check for config mode
97 97
if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
98 98
        print "yes";
......
111 111
                $telnet->waitfor("/error id=0 msg=ok/");
112 112
                $telnet->cmd("serverinfo");
113 113
                my $line = $telnet->getline(Timeout=>1);
114
 
114

  
115 115
                if ($line =~ m/virtualserver_id=(\d+) virtual/) {
116 116
                        my $id = $1;
117 117
                } else {
......
124 124
                        die "ERROR: server string not recognized!\n";
125 125
                }
126 126
                $telnet->waitfor("/error id=0 msg=ok/");
127
 
127

  
128 128
                print "graph_title Teamspeak Users ".$name."\n";
129 129
                print "graph_vlabel Connected Teamspeak Users\n";
130 130
                print "graph_category voip\n";
......
132 132
                print "users.label Users\n";
133 133
                print "users.info Connected users to ".$name."\n";
134 134
                print "users.type GAUGE\n";
135
 
135

  
136 136
                exit 0;
137 137
        } elsif ($mode eq "o") {
138 138
                #overview mode
......
140 140
                print "graph_vlabel Connected Teamspeak Users\n";
141 141
                print "graph_category voip\n";
142 142
                print "graph_info This graph shows the number of connected users on a Teamspeak3 server\n";
143
 
143

  
144 144
                foreach (@num) {
145 145
                        $telnet->cmd("use sid=".$_);
146 146
                        $telnet->waitfor("/error id=0 msg=ok/");
......
176 176
                $telnet->cmd("use sid=".$server);
177 177
                $telnet->waitfor("/error id=0 msg=ok/");
178 178
                $telnet->cmd("serverinfo");
179
 
179

  
180 180
                my $line = $telnet->getline(Timeout=>1);
181 181
                if ($line =~ m/virtualserver_clientsonline=(\d+) /) {
182 182
                        print "users.value ".($1-1)."\n";
......
191 191
                        $telnet->cmd("use sid=".$_);
192 192
                        $telnet->waitfor("/error id=0 msg=ok/");
193 193
                        $telnet->cmd("serverinfo");
194
 
194

  
195 195
                        my $line = $telnet->getline(Timeout=>1);
196 196
                        if ($line =~ m/virtualserver_clientsonline=(\d+) /) {
197 197
                                print $_.".value ".($1-1)."\n";
......
211 211
                        die "ERROR: server string not recognized!\n";
212 212
                }
213 213
                $telnet->waitfor("/error id=0 msg=ok/");
214
 
214

  
215 215
        }
216 216
}
217
 
217

  
218 218
#close telnet connection
219 219
$telnet->close;
220 220
exit;

Formats disponibles : Unified diff