Nagios Plugins
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

check_z_heat_vlv 1.2KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/python3
  2. #
  3. import argparse
  4. import nagios
  5. import time
  6. from z_server import config
  7. from z_server import tcp_socket
  8. from z_server.z_protocol import server as client_prot
  9. from z_server.z_protocol import DID_FOLLOWS_HEATING_SETPOINT
  10. from z_server import socket_protocol
  11. import sys
  12. if __name__ == '__main__':
  13. parser = argparse.ArgumentParser(
  14. prog='ProgramName',
  15. description='What the program does',
  16. epilog='Text at the bottom of help')
  17. parser.add_argument('-s', '--stg', required=True)
  18. parser.add_argument('-l', '--loc', required=True)
  19. parser.add_argument('-r', '--roo', required=True)
  20. args = parser.parse_args()
  21. #
  22. c = tcp_socket.tcp_client_stp('127.0.0.1', config.SOCK_PROT_PORT)
  23. sp = client_prot(c, channel_name='example_client')
  24. #
  25. data = {
  26. "stg": args.stg,
  27. "loc": args.loc,
  28. "roo": args.roo,
  29. "fun": "FUN_HEA" # <-- Const, because script is for heat_vlv only
  30. }
  31. sp.send(socket_protocol.SID_READ_REQUEST, DID_FOLLOWS_HEATING_SETPOINT, data)
  32. #
  33. sp_data = sp.receive(socket_protocol.SID_READ_RESPONSE, DID_FOLLOWS_HEATING_SETPOINT).get_data()
  34. nagios.Nagios().exit(**sp_data)