Skip to content

Commit 4e78e3b

Browse files
committed
Small updates to 1.19 lag plugin logic
- Use the 5-minute average instead of the 1-minute average; although the 1.7 version using the LagMeter plugin only offers 1-minute so this is something of a behavioral change, the 5-minute average is better suited to the 5-minute resolution normally offered by Munin. - Account for the asterisk that can appear in the 1.19 output to indicate a tick rate higher than 20.0, but continue to treat it as 20.0. Change-Id: I6673804bb6fb3af50f339121279e0454e81601e2
1 parent e55d6b8 commit 4e78e3b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

minecraft_lag.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
echo "graph_title " . ((empty($_ENV['customTitle'])) ? "Minecraft Server Lag" : $_ENV['customTitle'] . " Server Lag") . "\n";
3535
echo "graph_vlabel Ticks per second (TPS)\n";
3636
echo "graph_category minecraft\n";
37-
echo "tps.label Actual TPS (1-minute average)\n";
37+
echo "tps.label Actual TPS (5-minute average)\n";
3838
echo "tps.colour ff0000\n";
3939
echo "normal.label Normal TPS\n";
4040
echo "normal.colour 0fc20f\n";
@@ -52,8 +52,8 @@
5252
$data = dataPlz("tps");
5353
$data = preg_replace('/§./', '', $data);
5454

55-
if (preg_match('/TPS from last 1m, 5m, 15m: ([0-9.]+), ([0-9.]+), ([0-9.]+)/', $data, $matches)) {
56-
$tps = str_replace(',', '', $matches[1]);
55+
if (preg_match('/TPS from last 1m, 5m, 15m: ([0-9.]+)\*?, ([0-9.]+)\*?, ([0-9.]+)\*?/', $data, $matches)) {
56+
$tps = str_replace(',', '', $matches[2]);
5757

5858
echo "tps.value {$tps}\n";
5959
echo "normal.value 20.00\n";

0 commit comments

Comments
 (0)