Linuxfabrik / monitoring-plugins

220+ check plugins for Icinga and other Nagios-compatible monitoring applications. Each plugin is a standalone command line tool (written in Python) that provides a specific type of check.
https://linuxfabrik.ch
The Unlicense
220 stars 51 forks source link

strongswan-connection: Monitor only certain connections #738

Open stefanhart opened 10 months ago

stefanhart commented 10 months ago

Describe the solution you'd like

An additional arg, eg --monitor-conns, to monitor not all possible connection but only specified connection. Also the output and perfdata should only present the relevant data. For example I ve configured a VPN-GW with two Site-to-Site-Peers and a couple of different Remote-Access-Connections. I like to monitor each site with a specific Icinga service and not the remote access connections. eg. vars.by_ssh["strongswan vpn conns Site XY"] = { by_ssh_command = [ "/usr/local/lib/monitoring/plugins/check_strongswan_conn" ], by_ssh_arguments = { "--socket=/var/run/charon.vici" = "", "--monitor-conns" = "S2S_SITE-XY_IKE2-AUTHN-PUBKEY" } }

Additional context

parser.add_argument(
    '--monitor-conns', dest='MONITOR_CONNECTION_KEYS', action='extend', nargs='+', type=str, default=DEFAULT_MONITOR_CONNECTION_KEYS, 
    help='Connections to be monitored.'
)

... for key in monitor_connection_keys: ...

markuslf commented 10 months ago

Nice suggestion, makes sense.