aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rwxr-xr-xteamspeak-multi.py34
2 files changed, 17 insertions, 19 deletions
diff --git a/README.md b/README.md
index 40c57ee..a6334cf 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ To check if the plugin is working correctly it is necessary to first instruct th
telnet localhost 4949 # localhost or IP the munin-node
cap multigraph
list
-fetch nextcloud_multi
+fetch teamspeak-munin.py
```
The `list` command will return a list of all plugins currently active. This list should feature the newly activated
teamspeak plugin.
diff --git a/teamspeak-multi.py b/teamspeak-multi.py
index 07cf730..cf717c8 100755
--- a/teamspeak-multi.py
+++ b/teamspeak-multi.py
@@ -38,7 +38,7 @@ class TeamspeakMulti:
'down.type DERIVE',
'down.graph no',
'down.min 0',
- 'up.label sent',
+ 'up.label bps',
'up.info total amount of bytes sent in the last 5 minutes',
'up.type DERIVE',
'up.negative down',
@@ -58,7 +58,7 @@ class TeamspeakMulti:
'ftdown.type DERIVE',
'ftdown.graph no',
'ftdown.min 0',
- 'ftup.label sent',
+ 'ftup.label bps',
'ftup.info total amount of bytes sent for file transfers in the last 5 minutes',
'ftup.type DERIVE',
'ftup.negative ftdown',
@@ -88,7 +88,7 @@ class TeamspeakMulti:
'graph_category voip',
'graph_info This graph shows the number of connected users on the Teamspeak3 server',
- 'user.label last 5 minutes',
+ 'user.label users',
'user.info users connected in the last 5 minutes',
'user.min 0'
]
@@ -132,27 +132,26 @@ class TeamspeakMulti:
with ts3.query.TS3Connection(host, port) as ts3conn:
# will raise a TS3QueryError if response code is not 0
try:
- ts3conn.login(
- client_login_name=os.environ['username'],
- client_login_password=os.environ['password'],
- )
- except ts3.query.TS3QueryError as err:
- print("Login failed:", err.resp.error["msg"])
- exit(1)
+ ts3conn.login(client_login_name=os.environ['username'],
+ client_login_password=os.environ['password'])
- hostinfo = ts3conn.hostinfo().parsed
+ hostinfo = ts3conn.hostinfo().parsed
+ result = self.get_data(hostinfo[0])
- result = self.get_data(hostinfo[0])
+ # for key in results print every entry in dict
+ [print('\n'.join(result[key])) for key in result.keys()]
- for key in result.keys():
- print('\n'.join(result[key]))
+ except (ts3.query.TS3QueryError,KeyError) as err:
+ print("Login failed:", err.resp.error["msg"])
+ exit(1)
def main(self):
- # check if first argument is config or autoconf if not fetch data
+ # check if any argument is given
if sys.argv.__len__() >= 2:
+ # check if first argument is config or autoconf if not fetch data
if sys.argv[1] == "config":
- for key in self.config().keys():
- print('\n'.join(self.config()[key]))
+ # for key in config().keys() print every entry in dict
+ [print('\n'.join(self.config()[key])) for key in self.config().keys()]
if os.environ.get('MUNIN_CAP_DIRTYCONFIG') == '1':
self.run()
elif sys.argv[1] == 'autoconf':
@@ -166,4 +165,3 @@ class TeamspeakMulti:
if __name__ == "__main__":
TeamspeakMulti().main()
- exit(0)