Coder Social home page Coder Social logo

mightybroccoli / logwatch-scripts Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 0.0 71 KB

Monitor logs of a TeamSpeak3 instance and notify either via mail or pushed XMPP Notification on cron basis

Home Page: https://magicbroccoli.de

License: GNU General Public License v3.0

Shell 100.00%
teamspeak3 logwatch xmpp

logwatch-scripts's Introduction

Codacy Badge

TeamSpeak3 Logwatch Script

Script which iterates through the latest teamspeak logfiles and captures the important parts. Main goal is to filter relevant loglines from the past day (UTC). Finally the selected lines are being formatted nicely, so it is easy to see what happened. There are two possible notification modes:

  • E-Mail
  • XMPP Push

Dependencies

For Mail notifications:

  • shell access
  • bash > 4.2
  • teamspeak 3 server
  • anacron / cron

Additional dependencies for XMPP Push:

  • bashutils
  • sendxmpp

Installation

Copy the provided user.config.sample to directory specified as $tmp_directory and name it .user.config. Place all the needed info in the .user.config file. Place scriptfile inside anacron /etc/cron.daily or run this script via @daily with a dedicated cronjob @daily /PATH/TO/SCRIPT/teamspeak_log_daily_mail

Example for Email notifications

This is just an example how the logmail could look like. The script will only send those parts which actually hold data.

---------------------- Teamspeak -------------------------
-------------------- Server -----------------------
Status : ● ts3server.service - TeamSpeak 3 Server
   Loaded: loaded (/etc/systemd/system/ts3server.service; enabled)
  Active: active (running) since So 2017-04-16 09:10:23 CEST; 3 weeks 5 days ago
Main PID: 3305 (ts3server)
  CGroup: /system.slice/ts3server.service
       └─3305 ./ts3server inifile=ts3server.ini
------------------ Server End ---------------------
-------------------- Kick ------------------------
2017-05-12 13:10:16.120599|INFO    |VirtualServerBase|1  |client disconnected 'USER'(id:USERID) reason 'invokerid=INVOKERID invokername=INVOKERNAME invokeruid=INVOKERUID reasonmsg=MESSAGE'
------------------ Kick End ----------------------
------------------- Permission --------------------
2017-05-12 22:04:44.280211|INFO    |VirtualServer |1  |permission 'PERMISSION NAME' with values (value:-1, negated:0, skipchannel:0) was added by 'USERNAME'(id:USERID) to servergroup 'SERVERGROUP NAME'(id:SERVERGROUP ID)
----------------- Permission End ------------------
-------------------- Teamspeak End -----------------------

Example for XMPP Push

This is just an example for a notification pushed via XMPP. The script will only send notifications if there is content to notify about.

---- Group change ----
--- added ---
2017-05-12 18:56:38.609377|INFO    |VirtualServer |1  |client (id:USER ID) was added to servergroup 'SERVERGROUP NAME'(id:SERVERGROUP ID) by client 'USERNAME'(id:USER ID)
2017-05-12 22:09:01.658969|INFO    |VirtualServer |1  |client (id:USER ID) was added to servergroup 'SERVERGROUP NAME'(id:SERVERGROUP ID) by client 'USERNAME'(id:USER ID)
---- Group change End ----

Donations

If somebody is that enthusiastic about this project and does want to donate me some coffee, I would be really pleased and happy. I provide two possibilities: PayPal and Bitcoin

1QJZTWenBvdLWTUachpLLd2dLXAZMGeU87

Donate with PayPal

logwatch-scripts's People

Contributors

jvmerkle avatar mightybroccoli avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

logwatch-scripts's Issues

[Feature Request] Send Diagnostics on Warning/Error

|ERROR | | |TS3ANetwork::ResolveHostName failed error: -3 (Temporärer Fehler bei der Namensauflösung) 11

|ERROR | | |TS3ANetwork::ResolveHostName failed error: -2 (Der Name oder der Dienst ist nicht bekannt) 111
|ERROR | | |TS3ANetwork::Connect failed error: 101
|ERROR | | |Unable to connect to primary address, trying secondary
|ERROR | | |TS3ANetwork::ResolveHostName failed error: -2 (Der Name oder der Dienst ist nicht bekannt) 111

|ERROR | | |error writing tcp socket Die Verbindung wurde vom Kommunikationspartner zurückgesetzt

|ERROR | | |TS3ANetwork::Send failed error: 104
|ERROR | | |unable to send key

|ERROR |FileListManager| |error getting filelist(exists) for ' files/virtualserver_1/channel_566/': Datei oder Verzeichnis nicht gefunden

|INFO |ServerMain | |Received signal SIGTERM, shutting down.

|WARNING | | |Accounting connection stalled

|ERROR | | |read invalid packet size size

|INFO |Accounting | |Licensing Information
|INFO |Accounting | |type : Non-profit
|INFO |Accounting | |starting date : Sun Dec 11 00:00:00 2016
|INFO |Accounting | |ending date : Thu Jun 15 00:00:00 2017
|INFO |Accounting | |max virtualservers: 10
|INFO |Accounting | |max slots : 512

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.