Ipvs firewall mark (#1455)

* IPVS: include firewall mark label

Signed-off-by: Boris Momčilović <boris@firstbeatmedia.com>
This commit is contained in:
Boris Momčilović 2019-08-27 14:24:11 +02:00 committed by Ben Kochie
commit 93c12e03a1
7 changed files with 109 additions and 81 deletions

View file

@ -50,6 +50,7 @@ func newIPVSCollector() (*ipvsCollector, error) {
"remote_address",
"remote_port",
"proto",
"local_mark",
}
c ipvsCollector
err error
@ -127,12 +128,17 @@ func (c *ipvsCollector) Update(ch chan<- prometheus.Metric) error {
}
for _, backend := range backendStats {
localAddress := ""
if backend.LocalAddress.String() != "<nil>" {
localAddress = backend.LocalAddress.String()
}
labelValues := []string{
backend.LocalAddress.String(),
localAddress,
strconv.FormatUint(uint64(backend.LocalPort), 10),
backend.RemoteAddress.String(),
strconv.FormatUint(uint64(backend.RemotePort), 10),
backend.Proto,
backend.LocalMark,
}
ch <- c.backendConnectionsActive.mustNewConstMetric(float64(backend.ActiveConn), labelValues...)
ch <- c.backendConnectionsInact.mustNewConstMetric(float64(backend.InactConn), labelValues...)