Fixed and added metrics in Mumble probing.
This commit is contained in:
parent
8f8bb0dffc
commit
8f8eeb437d
4 changed files with 66 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
|
||||||
*
|
*
|
||||||
* This file is part of StatoolInfos, simple service statistics tool.
|
* This file is part of StatoolInfos, simple service statistics tool.
|
||||||
*
|
*
|
||||||
|
@ -38,14 +38,17 @@ public class MumbleLog
|
||||||
private static Logger logger = LoggerFactory.getLogger(MumbleLog.class);
|
private static Logger logger = LoggerFactory.getLogger(MumbleLog.class);
|
||||||
|
|
||||||
// 1 => <8:neox(-1)> Authenticated
|
// 1 => <8:neox(-1)> Authenticated
|
||||||
public static final Pattern NICK_PATTERN = Pattern.compile("^1 => <\\d+:(?<nickname>neox)(-?\\d+)> Authenticated$");
|
public static final Pattern NICK_PATTERN = Pattern.compile("^\\d+ => <\\d+:(?<nick>\\S+)\\(-?\\d+\\)> Authenticated$");
|
||||||
|
|
||||||
// 1 => <6:Cpm(-1)> Moved Cpm:6(-1) to Salon blabla 1[3:0]
|
// 1 => <6:Cpm(-1)> Moved Cpm:6(-1) to Salon blabla 1[3:0]
|
||||||
public static final Pattern ROOM_PATTERN = Pattern.compile("^Moved .+ to (?<room>.+)[.+]$");
|
public static final Pattern ROOM_PATTERN = Pattern.compile("^\\d+ => <\\S+> Moved \\S+ to (?<room>.+)\\[.+\\]$");
|
||||||
|
|
||||||
// 1 => <6:(-1)> New connection: 123.456.78.90:54958
|
// 1 => <6:(-1)> New connection: 123.456.78.90:54958
|
||||||
// 1 => <2:(-1)> New connection: [1234:5678:90ab:cdef::aaaa:eeee]:57588
|
// 1 => <2:(-1)> New connection: [1234:5678:90ab:cdef::aaaa:eeee]:57588
|
||||||
public static final Pattern IP_PATTERN = Pattern.compile("^New connection: (?<ip>.+)$");
|
public static final Pattern IP_PATTERN = Pattern.compile("^\\d+ => \\S+ New connection: \\[?(?<ip>.+)\\]?:\\d+$");
|
||||||
|
|
||||||
|
// 1 => Ignoring connection: 123.45.555.555:44124 (Global ban)
|
||||||
|
public static final Pattern GLOBALBAN_PATTERN = Pattern.compile("^\\d+ => Ignoring connection: \\[?(?<ip>.+)\\]?:\\d+ \\(Global ban\\)$");
|
||||||
|
|
||||||
private MumbleLogLevel level;
|
private MumbleLogLevel level;
|
||||||
private LocalDateTime time;
|
private LocalDateTime time;
|
||||||
|
@ -71,6 +74,29 @@ public class MumbleLog
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the global ban ip.
|
||||||
|
*
|
||||||
|
* @return the global ban ip
|
||||||
|
*/
|
||||||
|
public String getGlobalBanIp()
|
||||||
|
{
|
||||||
|
String result;
|
||||||
|
|
||||||
|
Matcher matcher = GLOBALBAN_PATTERN.matcher(this.message);
|
||||||
|
if (matcher.matches())
|
||||||
|
{
|
||||||
|
result = matcher.group("ip");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ip.
|
* Gets the ip.
|
||||||
*
|
*
|
||||||
|
@ -116,7 +142,7 @@ public class MumbleLog
|
||||||
Matcher matcher = NICK_PATTERN.matcher(this.message);
|
Matcher matcher = NICK_PATTERN.matcher(this.message);
|
||||||
if (matcher.matches())
|
if (matcher.matches())
|
||||||
{
|
{
|
||||||
result = matcher.group("nickname");
|
result = matcher.group("nick");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -127,6 +153,11 @@ public class MumbleLog
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the room name.
|
||||||
|
*
|
||||||
|
* @return the room name
|
||||||
|
*/
|
||||||
public String getRoomName()
|
public String getRoomName()
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
@ -145,6 +176,11 @@ public class MumbleLog
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the time.
|
||||||
|
*
|
||||||
|
* @return the time
|
||||||
|
*/
|
||||||
public LocalDateTime getTime()
|
public LocalDateTime getTime()
|
||||||
{
|
{
|
||||||
return this.time;
|
return this.time;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
|
||||||
*
|
*
|
||||||
* This file is part of StatoolInfos, simple service statistics tool.
|
* This file is part of StatoolInfos, simple service statistics tool.
|
||||||
*
|
*
|
||||||
|
@ -59,6 +59,7 @@ public class MumbleLogAnalyzer
|
||||||
private IpCounters ipv4;
|
private IpCounters ipv4;
|
||||||
private IpCounters ipv6;
|
private IpCounters ipv6;
|
||||||
private UserCounters rooms;
|
private UserCounters rooms;
|
||||||
|
private IpCounters globalBanIps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new http access log prober.
|
* Instantiates a new http access log prober.
|
||||||
|
@ -71,6 +72,7 @@ public class MumbleLogAnalyzer
|
||||||
this.ipv4 = new IpCounters();
|
this.ipv4 = new IpCounters();
|
||||||
this.ipv6 = new IpCounters();
|
this.ipv6 = new IpCounters();
|
||||||
this.rooms = new UserCounters();
|
this.rooms = new UserCounters();
|
||||||
|
this.globalBanIps = new IpCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,6 +92,7 @@ public class MumbleLogAnalyzer
|
||||||
result.putAll(this.ipv4.getCounters("metrics.service.ip.ipv4"));
|
result.putAll(this.ipv4.getCounters("metrics.service.ip.ipv4"));
|
||||||
result.putAll(this.ipv6.getCounters("metrics.service.ip.ipv6"));
|
result.putAll(this.ipv6.getCounters("metrics.service.ip.ipv6"));
|
||||||
result.putAll(this.rooms.getCounters("metrics.audioconferencing.rooms.active"));
|
result.putAll(this.rooms.getCounters("metrics.audioconferencing.rooms.active"));
|
||||||
|
result.putAll(this.globalBanIps.getCounters("metrics.mumble.globalbans.ip"));
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
|
@ -184,7 +187,11 @@ public class MumbleLogAnalyzer
|
||||||
}
|
}
|
||||||
else if (log.getLevel() == MumbleLogLevel.DEFAULT)
|
else if (log.getLevel() == MumbleLogLevel.DEFAULT)
|
||||||
{
|
{
|
||||||
this.counters.inc("metrics.mumble.logs.DEFAULT", year, yearMonth, yearWeek, date);
|
this.counters.inc("metrics.mumble.logs.default", year, yearMonth, yearWeek, date);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.counters.inc("metrics.mumble.logs.unknown", year, yearMonth, yearWeek, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
// metrics.service.users
|
// metrics.service.users
|
||||||
|
@ -219,6 +226,14 @@ public class MumbleLogAnalyzer
|
||||||
// metrics.audioconferencing.rooms.active
|
// metrics.audioconferencing.rooms.active
|
||||||
this.rooms.put(log.getRoomName(), year, yearMonth, yearWeek, date);
|
this.rooms.put(log.getRoomName(), year, yearMonth, yearWeek, date);
|
||||||
|
|
||||||
|
// metrics.mumble.globalbans
|
||||||
|
String globalBanIp = log.getGlobalBanIp();
|
||||||
|
if (globalBanIp != null)
|
||||||
|
{
|
||||||
|
this.counters.inc("metrics.mumble.globalbans", year, yearMonth, yearWeek, date);
|
||||||
|
this.globalBanIps.put(globalBanIp, year, yearMonth, yearWeek, date);
|
||||||
|
}
|
||||||
|
|
||||||
// metrics.audioconferencing.conferences
|
// metrics.audioconferencing.conferences
|
||||||
// metrics.audioconferencing.hours
|
// metrics.audioconferencing.hours
|
||||||
// metrics.audioconferencing.traffic.received.bytes
|
// metrics.audioconferencing.traffic.received.bytes
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
|
||||||
*
|
*
|
||||||
* This file is part of StatoolInfos, simple service statistics tool.
|
* This file is part of StatoolInfos, simple service statistics tool.
|
||||||
*
|
*
|
||||||
|
@ -45,19 +45,19 @@ public enum MumbleLogLevel
|
||||||
{
|
{
|
||||||
MumbleLogLevel result;
|
MumbleLogLevel result;
|
||||||
|
|
||||||
if (StringUtils.equals(value, "DEBUG"))
|
if (StringUtils.equals(value, "D"))
|
||||||
{
|
{
|
||||||
result = DEBUG;
|
result = DEBUG;
|
||||||
}
|
}
|
||||||
else if (StringUtils.equals(value, "WARNING"))
|
else if (StringUtils.equals(value, "W"))
|
||||||
{
|
{
|
||||||
result = WARNING;
|
result = WARNING;
|
||||||
}
|
}
|
||||||
else if (StringUtils.equals(value, "CRITICAL"))
|
else if (StringUtils.equals(value, "C"))
|
||||||
{
|
{
|
||||||
result = CRITICAL;
|
result = CRITICAL;
|
||||||
}
|
}
|
||||||
else if (StringUtils.equals(value, "FATAL"))
|
else if (StringUtils.equals(value, "F"))
|
||||||
{
|
{
|
||||||
result = FATAL;
|
result = FATAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
|
||||||
*
|
*
|
||||||
* This file is part of StatoolInfos, simple service statistics tool.
|
* This file is part of StatoolInfos, simple service statistics tool.
|
||||||
*
|
*
|
||||||
|
@ -66,6 +66,8 @@ public class MumbleProber
|
||||||
// metrics.mumble.logs.critical
|
// metrics.mumble.logs.critical
|
||||||
// metrics.mumble.logs.fatal
|
// metrics.mumble.logs.fatal
|
||||||
// metrics.mumble.logs.default
|
// metrics.mumble.logs.default
|
||||||
|
// metrics.mumble.globalbans
|
||||||
|
// metrics.mumble.globalbans.ip
|
||||||
result = MumbleLogAnalyzer.probe(logs);
|
result = MumbleLogAnalyzer.probe(logs);
|
||||||
|
|
||||||
// result.putAll(MumbleDatabaseAnalyzer.probe());
|
// result.putAll(MumbleDatabaseAnalyzer.probe());
|
||||||
|
|
Loading…
Reference in a new issue