You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to add the Plugin in the External Plugin section in the munin-node.ini file like this: Plugin01="python W:\sat2.py"
then when i call munin-node.exe it gives this output: Loaded plugin [class ExternalMuninNodePlugin - TBS_Signal]
when i add like described: Plugin01=W:\sat2.py
i get ERROR:Failed to load External plugin: W:\sat2.py
Even if it says its loaded, it wouldn't generate any graphs.
Maybe someone knows what i did wrong.
Python file:
#!/usr/bin/env python
import re
import sys
def extract_data(file_path):
try:
with open(file_path, 'r') as file:
# Lesen Sie alle Zeilen der Datei
lines = file.readlines()
# Extrahieren Sie die Daten aus der letzten Zeile mit einem regulären Ausdruck
last_line = lines[-1]
match = re.search(r'Lock: (\d+), Level: (\d+), Quality: (\d+), SNR: ([\d.]+)dB, BER: ([\d.]+), RFLevel: (-?\d+) dBm', last_line)
if match:
lock = int(match.group(1))
level = int(match.group(2))
quality = int(match.group(3))
snr = float(match.group(4))
rf_level = int(match.group(6))
return {'Lock': lock, 'Level': level, 'Quality': quality, 'SNR': snr, 'RFLevel': rf_level}
else:
print("Die letzte Zeile der Datei entspricht nicht dem erwarteten Muster.")
return None
except Exception as e:
print(f"Fehler beim Lesen der Datei: {e}")
return None
def autoconf():
# Diese Funktion wird von Munin aufgerufen, um zu überprüfen, ob das Plugin auf dem Zielrechner ausgeführt werden kann
# Sie sollte 0 für "ja" und 1 für "nein" zurückgeben
try:
import re
return 0
except ImportError:
return 1
def name():
# Diese Funktion wird von Munin aufgerufen, um zu überprüfen, ob das Plugin auf dem Zielrechner ausgeführt werden kann
# Sie sollte 0 für "ja" und 1 für "nein" zurückgeben
print ("TBS_Signal")
def config():
# Diese Funktion gibt die Konfiguration des Plugins aus, die Munin verwenden wird
print("graph_title TBS")
print("graph_args --base 1000 -l 0")
print("graph_category custom")
print("graph_vlabel Werte")
print("lock.label Lock")
print("level.label Level")
print("quality.label Quality")
print("snr.label SNR")
print("rf_level.label RFLevel")
sys.exit(0)
def fetch():
# Diese Funktion wird von Munin aufgerufen, um die Daten zu sammeln und an Munin zu senden
file_path = 'W:\\SignalStat.txt' # Passe dies entsprechend an
data = extract_data(file_path)
if data:
print(f"lock.value {data['Lock']}")
print(f"level.value {data['Level']}")
print(f"quality.value {data['Quality']}")
print(f"snr.value {data['SNR']}")
print(f"rf_level.value {data['RFLevel']}")
sys.exit(0)
else:
sys.exit(1)
# Überprüfen, welches Subkommando Munin erwartet
if len(sys.argv) > 1 and sys.argv[1] == "autoconf":
autoconf()
elif len(sys.argv) > 1 and sys.argv[1] == "config":
config()
elif len(sys.argv) > 1 and sys.argv[1] == "name":
name()
else:
fetch()
The text was updated successfully, but these errors were encountered:
Hey there,
i have written a external Plugin to get some values of a Text file (BDADataEx logs in a txt file)
if i try to get the values from the file it looks like this:
For me it looks right. Maybe it isn't.
I tried to add the Plugin in the External Plugin section in the munin-node.ini file like this:
Plugin01="python W:\sat2.py"
then when i call munin-node.exe it gives this output:
Loaded plugin [class ExternalMuninNodePlugin - TBS_Signal]
when i add like described:
Plugin01=W:\sat2.py
i get
ERROR:Failed to load External plugin: W:\sat2.py
Even if it says its loaded, it wouldn't generate any graphs.
Maybe someone knows what i did wrong.
Python file:
The text was updated successfully, but these errors were encountered: