nagios-plugins/check_z_heat_vlv

37 lignes
1.2 KiB
Python
Fichiers exécutables

#!/bin/python3
#
import argparse
import nagios
import time
from z_server import config
from z_server import tcp_socket
from z_server.z_protocol import server as client_prot
from z_server.z_protocol import DID_FOLLOWS_HEATING_SETPOINT
from z_server import socket_protocol
import sys
if __name__ == '__main__':
parser = argparse.ArgumentParser(
prog='ProgramName',
description='What the program does',
epilog='Text at the bottom of help')
parser.add_argument('-s', '--stg', required=True)
parser.add_argument('-l', '--loc', required=True)
parser.add_argument('-r', '--roo', required=True)
args = parser.parse_args()
#
c = tcp_socket.tcp_client_stp('127.0.0.1', config.SOCK_PROT_PORT)
sp = client_prot(c, channel_name='example_client')
#
data = {
"stg": args.stg,
"loc": args.loc,
"roo": args.roo,
"fun": "FUN_HEA" # <-- Const, because script is for heat_vlv only
}
sp.send(socket_protocol.SID_READ_REQUEST, DID_FOLLOWS_HEATING_SETPOINT, data)
#
sp_data = sp.receive(socket_protocol.SID_READ_RESPONSE, DID_FOLLOWS_HEATING_SETPOINT).get_data()
nagios.Nagios().exit(**sp_data)