mirror of
https://github.com/FAUSheppy/monitoring-tools
synced 2025-12-06 03:21:35 +01:00
update: subprocess run direct encoding
This commit is contained in:
@@ -26,12 +26,11 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
cmd = [ "/usr/local/bin/rcon", "-P{}".format(password), "-a{}".format(args.host),
|
cmd = [ "/usr/local/bin/rcon", "-P{}".format(password), "-a{}".format(args.host),
|
||||||
"-p{}".format(args.port), "sm plugins info Skillbird" ]
|
"-p{}".format(args.port), "sm plugins info Skillbird" ]
|
||||||
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding=ENCODING)
|
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8")
|
||||||
out = p.stdout.encode("ascii")
|
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
print("Insurgency CRITICAL - {}".format(out))
|
print("Insurgency CRITICAL - {}".format(p.stdout))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif "not loaded" in out:
|
elif "not loaded" in p.stdout:
|
||||||
print("Insurgency WARNING - {}".format(out))
|
print("Insurgency WARNING - {}".format(out))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user