mirror of
https://github.com/FAUSheppy/monitoring-tools
synced 2025-12-06 03:21:35 +01:00
feat: config for remote gateway
This commit is contained in:
@@ -48,6 +48,19 @@ object NotificationCommand "signal-service-notification" {
|
||||
value = "$notification_servicedisplayname$"
|
||||
}
|
||||
"-v" = "$notification_logtosyslog$"
|
||||
|
||||
"-w" = {
|
||||
required = true
|
||||
value = "$notification_signal_gateway_host$"
|
||||
}
|
||||
"-x" = {
|
||||
required = true
|
||||
value = "$notification_signal_gateway_port$"
|
||||
}
|
||||
"-y" = {
|
||||
required = true
|
||||
value = "$notification_signal_gateway_proto$"
|
||||
}
|
||||
}
|
||||
|
||||
vars += {
|
||||
@@ -64,6 +77,10 @@ object NotificationCommand "signal-service-notification" {
|
||||
notification_servicestate = "$service.state$"
|
||||
notification_useremail = "$user.email$"
|
||||
notification_servicedisplayname = "$service.display_name$"
|
||||
notification_servicedisplayname = "$service.display_name$"
|
||||
notification_signal_gateway_host = "$icinga.signal_gateway_host"
|
||||
notification_signal_gateway_port = "$icinga.signal_gateway_port"
|
||||
notification_signal_gateway_proto = "$icinga.signal_gateway_proto"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,9 @@ if __name__ == "__main__":
|
||||
parser.add_argument('-u', '--service-display-name', required=False, help="Service Display Name")
|
||||
|
||||
parser.add_argument('-v', required=False, help="Deprecated. Compability only. Has no Effect.")
|
||||
parser.add_argument('--target-port', default=6000, help="Target port on which Telegram Gateway is running")
|
||||
parser.add_argument('-w', '--target-port', default=6000, help="Signal Gateway Port")
|
||||
parser.add_argument('-x', '--target-host', default="localhost", help="Signal Gateway Address")
|
||||
parser.add_argument('-y', '--target-proto', default="http", help="Signal proto")
|
||||
args = parser.parse_args()
|
||||
|
||||
# build message #
|
||||
@@ -33,5 +35,7 @@ if __name__ == "__main__":
|
||||
serviceName = args.service_display_name
|
||||
|
||||
# create and send request #
|
||||
url = "http://localhost:{port}/send-all-icinga".format(port=args.target_port)
|
||||
url = "{proto}://{host}:{port}/send-all-icinga".format(host=args.target_host, \
|
||||
port=args.target_port,\
|
||||
proto=args.target_proto)
|
||||
requests.post(url, json=vars(args))
|
||||
|
||||
Reference in New Issue
Block a user