Categorygithub.com/spheromak/ipsec_exporter
repositorypackage
1.0.0-jesse.2
Repository: https://github.com/spheromak/ipsec_exporter.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

IPsec Exporter

tests Go Reference Go Report Card codecov

Export strongswan/libreswan IPsec stats to Prometheus.

To run it:

make
./ipsec_exporter [flags]

Exported metrics

Exported for both strongswan/libreswan

MetricMeaningLabels
ipsec_upWas the last scrape successful.
ipsec_ike_sasNumber of currently registered IKE SAs.
ipsec_half_open_ike_sasNumber of IKE SAs in half-open state.
ipsec_ike_sa_stateIKE SA state.name, uid, version, local_host, local_id, remote_host, remote_id, remote_identity, vips
ipsec_child_sa_stateChild SA state.ike_sa_name, ike_sa_uid, ike_sa_version, ike_sa_local_host, ike_sa_local_id, ike_sa_remote_host, ike_sa_remote_id, ike_sa_remote_identity, ike_sa_vips, name, uid, reqid, mode, protocol, local_ts, remote_ts
ipsec_child_sa_bytes_inNumber of input bytes processed.ike_sa_name, ike_sa_uid, ike_sa_version, ike_sa_local_host, ike_sa_local_id, ike_sa_remote_host, ike_sa_remote_id, ike_sa_remote_identity, ike_sa_vips, name, uid, reqid, mode, protocol, local_ts, remote_ts
ipsec_child_sa_bytes_outNumber of output bytes processed.ike_sa_name, ike_sa_uid, ike_sa_version, ike_sa_local_host, ike_sa_local_id, ike_sa_remote_host, ike_sa_remote_id, ike_sa_remote_identity, ike_sa_vips, name, uid, reqid, mode, protocol, local_ts, remote_ts

Additionally exported for strongswan-only

MetricMeaningLabels
ipsec_uptime_secondsNumber of seconds since the daemon started.
ipsec_workers_totalNumber of worker threads.
ipsec_idle_workersNumber of idle worker threads.
ipsec_active_workersNumber of threads processing jobs.
ipsec_queuesNumber of queued jobs.priority
ipsec_pool_ips_totalNumber of addresses in the pool.name, address
ipsec_online_pool_ipsNumber of leases online.name, address
ipsec_offline_pool_ipsNumber of leases offline.name, address
ipsec_ike_sa_established_secondsNumber of seconds since the IKE SA has been established.name, uid, version, local_host, local_id, remote_host, remote_id, remote_identity, vips
ipsec_child_sa_packets_inNumber of input packets processed.ike_sa_name, ike_sa_uid, ike_sa_version, ike_sa_local_host, ike_sa_local_id, ike_sa_remote_host, ike_sa_remote_id, ike_sa_remote_identity, ike_sa_vips, name, uid, reqid, mode, protocol, local_ts, remote_ts
ipsec_child_sa_packets_outNumber of output packets processed.ike_sa_name, ike_sa_uid, ike_sa_version, ike_sa_local_host, ike_sa_local_id, ike_sa_remote_host, ike_sa_remote_id, ike_sa_remote_identity, ike_sa_vips, name, uid, reqid, mode, protocol, local_ts, remote_ts
ipsec_child_sa_installed_secondsNumber of seconds since the child SA has been installed.ike_sa_name, ike_sa_uid, ike_sa_version, ike_sa_local_host, ike_sa_local_id, ike_sa_remote_host, ike_sa_remote_id, ike_sa_remote_identity, ike_sa_vips, name, uid, reqid, mode, protocol, local_ts, remote_ts

strongswan state mapping

IKE SA

NameState value
CREATED0
CONNECTING1
ESTABLISHED2
PASSIVE3
REKEYING4
REKEYED5
DELETING6
DESTROYING7

Child SA

NameState value
CREATED0
ROUTED1
INSTALLING2
INSTALLED3
UPDATING4
REKEYING5
REKEYED6
RETRYING7
DELETING8
DELETED9
DESTROYING10

libreswan state mapping

NameState value
STATE_MAIN_R00
STATE_MAIN_I11
STATE_MAIN_R12
STATE_MAIN_I23
STATE_MAIN_R24
STATE_MAIN_I35
STATE_MAIN_R36
STATE_MAIN_I47
STATE_AGGR_R08
STATE_AGGR_I19
STATE_AGGR_R110
STATE_AGGR_I211
STATE_AGGR_R212
STATE_QUICK_R013
STATE_QUICK_I114
STATE_QUICK_R115
STATE_QUICK_I216
STATE_QUICK_R217
STATE_INFO18
STATE_INFO_PROTECTED19
STATE_XAUTH_R020
STATE_XAUTH_R121
STATE_MODE_CFG_R022
STATE_MODE_CFG_R123
STATE_MODE_CFG_R224
STATE_MODE_CFG_I125
STATE_XAUTH_I026
STATE_XAUTH_I127
STATE_V2_PARENT_I029
STATE_V2_PARENT_I130
STATE_V2_PARENT_I231
STATE_V2_PARENT_R032
STATE_V2_PARENT_R133
STATE_V2_IKE_AUTH_CHILD_I034
STATE_V2_IKE_AUTH_CHILD_R035
STATE_V2_NEW_CHILD_I036
STATE_V2_NEW_CHILD_I137
STATE_V2_REKEY_IKE_I038
STATE_V2_REKEY_IKE_I139
STATE_V2_REKEY_CHILD_I040
STATE_V2_REKEY_CHILD_I141
STATE_V2_NEW_CHILD_R042
STATE_V2_REKEY_IKE_R043
STATE_V2_REKEY_CHILD_R044
STATE_V2_ESTABLISHED_IKE_SA45
STATE_V2_ESTABLISHED_CHILD_SA46
STATE_V2_IKE_SA_DELETE47
STATE_V2_CHILD_SA_DELETE48

Flags

./ipsec_exporter --help
  • vici.address: VICI socket address. Example: unix:///var/run/charon.vici or tcp://127.0.0.1:4502.
  • vici.timeout: VICI socket connect timeout.
  • collector: Collector type to scrape metrics with. vici or ipsec.
  • ipsec.command: Command to scrape IPsec metrics when the collector is configured to an ipsec binary. ipsec statusall by default. To use with libreswan, set to ipsec status.
  • web.listen-address: Address to listen on for web interface and telemetry.
  • web.telemetry-path: Path under which to expose metrics.
  • log.level: Logging level. info by default.
  • log.format: Set the log target and format. Example: logger:syslog?appname=bob&local=7 or logger:stdout?json=true.

TLS and basic authentication

The ipsec_exporter supports TLS and basic authentication. To use TLS and/or basic authentication, you need to pass a configuration file using the --web.config.file parameter. The format of the file is described in the exporter-toolkit repository.