diff options
author | Ashley Wulber <48420062+wash2@users.noreply.github.com> | 2020-11-04 08:26:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:26:33 +0300 |
commit | 3f70299e3521ac4708bd6f47abbf46f70e8692e8 (patch) | |
tree | 6f35a342f90c09828f8eb7a95e655a7c2f28aa72 /collectors | |
parent | f5dd964f910b46c4fa72da6b24c261e2cd5e435c (diff) |
fix: make comma optional when parsing ipsec trafficstatus (#10190)
\{0,1\} is used instead of ? because standard sed doesn't support "?" https://stackoverflow.com/questions/6156259/sed-expression-doesnt-allow-optional-grouped-string
Diffstat (limited to 'collectors')
-rw-r--r-- | collectors/charts.d.plugin/libreswan/libreswan.chart.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/collectors/charts.d.plugin/libreswan/libreswan.chart.sh b/collectors/charts.d.plugin/libreswan/libreswan.chart.sh index 1320983a53..bfa2b9ea16 100644 --- a/collectors/charts.d.plugin/libreswan/libreswan.chart.sh +++ b/collectors/charts.d.plugin/libreswan/libreswan.chart.sh @@ -78,7 +78,7 @@ libreswan_get() { libreswan_ipsec whack --trafficstatus } | sed -n \ -e "s|[0-9]\+ #\([0-9]\+\): \"\(.*\)\".*IPsec SA established.*newest IPSEC.*|libreswan_connected_tunnels[\"\1\"]=\"\2\"|p" \ - -e "s|[0-9]\+ #\([0-9]\+\): \"\(.*\)\",.* add_time=\([0-9]\+\),.* inBytes=\([0-9]\+\),.* outBytes=\([0-9]\+\).*|libreswan_traffic_in[\"\1\"]=\"\4\"; libreswan_traffic_out[\"\1\"]=\"\5\"; libreswan_established_add_time[\"\1\"]=\"\3\";|p" + -e "s|[0-9]\+ #\([0-9]\+\): \"\(.*\)\",\{0,1\}.* add_time=\([0-9]\+\),.* inBytes=\([0-9]\+\),.* outBytes=\([0-9]\+\).*|libreswan_traffic_in[\"\1\"]=\"\4\"; libreswan_traffic_out[\"\1\"]=\"\5\"; libreswan_established_add_time[\"\1\"]=\"\3\";|p" ) || return 1 # check we got some data |