From a863650ac2446be00964333e88f453a1cdf3d572 Mon Sep 17 00:00:00 2001 From: Gianni Stubbe Date: Tue, 25 Jul 2023 18:33:52 +0200 Subject: [PATCH] doc(probe): improve metric descriptions (#239) * docs: Updated descriptions of metrics to be self-explanatory * test(interface): Fixed tests for system and ipsec interfaces --------- Co-authored-by: Gianni Stubbe --- pkg/probe/system_interface.go | 2 +- pkg/probe/system_interface_test.go | 2 +- pkg/probe/vpn_ipsec.go | 2 +- pkg/probe/vpn_ipsec_test.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/probe/system_interface.go b/pkg/probe/system_interface.go index 7f8a2b7..7a10c59 100644 --- a/pkg/probe/system_interface.go +++ b/pkg/probe/system_interface.go @@ -11,7 +11,7 @@ func probeSystemInterface(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus. var ( mLink = prometheus.NewDesc( "fortigate_interface_link_up", - "Whether the link is up or not", + "Whether the link is up or not (not taking into account admin status)", []string{"vdom", "name", "alias", "parent"}, nil, ) mSpeed = prometheus.NewDesc( diff --git a/pkg/probe/system_interface_test.go b/pkg/probe/system_interface_test.go index afe3da1..c56d984 100644 --- a/pkg/probe/system_interface_test.go +++ b/pkg/probe/system_interface_test.go @@ -17,7 +17,7 @@ func TestSystemInterfaces(t *testing.T) { } em := ` - # HELP fortigate_interface_link_up Whether the link is up or not + # HELP fortigate_interface_link_up Whether the link is up or not (not taking into account admin status) # TYPE fortigate_interface_link_up gauge fortigate_interface_link_up{alias="",name="b",parent="",vdom="root"} 0 fortigate_interface_link_up{alias="",name="internal1",parent="",vdom="infra"} 1 diff --git a/pkg/probe/vpn_ipsec.go b/pkg/probe/vpn_ipsec.go index f9416d7..6f2f711 100644 --- a/pkg/probe/vpn_ipsec.go +++ b/pkg/probe/vpn_ipsec.go @@ -12,7 +12,7 @@ func probeVPNIPSec(c http.FortiHTTP, meta *TargetMetadata) ([]prometheus.Metric, var ( status = prometheus.NewDesc( "fortigate_ipsec_tunnel_up", - "Status of IPsec tunnel", + "Status of IPsec tunnel (0 - Down, 1 - Up)", []string{"vdom", "name", "p2serial", "parent"}, nil, ) transmitted = prometheus.NewDesc( diff --git a/pkg/probe/vpn_ipsec_test.go b/pkg/probe/vpn_ipsec_test.go index 612ab97..e9324ae 100644 --- a/pkg/probe/vpn_ipsec_test.go +++ b/pkg/probe/vpn_ipsec_test.go @@ -25,7 +25,7 @@ func TestVPNIPSec(t *testing.T) { # TYPE fortigate_ipsec_tunnel_transmit_bytes_total counter fortigate_ipsec_tunnel_transmit_bytes_total{name="tunnel_1-sub",p2serial="1",parent="tunnel_1",vdom="root"} 1.424856e+07 fortigate_ipsec_tunnel_transmit_bytes_total{name="tunnel_1-sub",p2serial="12",parent="tunnel_1",vdom="root"} 1.424856e+07 - # HELP fortigate_ipsec_tunnel_up Status of IPsec tunnel + # HELP fortigate_ipsec_tunnel_up Status of IPsec tunnel (0 - Down, 1 - Up) # TYPE fortigate_ipsec_tunnel_up gauge fortigate_ipsec_tunnel_up{name="tunnel_1-sub",p2serial="1",parent="tunnel_1",vdom="root"} 1 fortigate_ipsec_tunnel_up{name="tunnel_1-sub",p2serial="12",parent="tunnel_1",vdom="root"} 0 @@ -62,7 +62,7 @@ func TestVPNIPSecWithCommonP2Names(t *testing.T) { fortigate_ipsec_tunnel_transmit_bytes_total{name="CommonP2",p2serial="25",parent="My VPN",vdom="root"} 3.1269542e+07 fortigate_ipsec_tunnel_transmit_bytes_total{name="mgmt",p2serial="1",parent="My VPN",vdom="root"} 0 fortigate_ipsec_tunnel_transmit_bytes_total{name="some-network",p2serial="14",parent="My VPN",vdom="root"} 112307 - # HELP fortigate_ipsec_tunnel_up Status of IPsec tunnel + # HELP fortigate_ipsec_tunnel_up Status of IPsec tunnel (0 - Down, 1 - Up) # TYPE fortigate_ipsec_tunnel_up gauge fortigate_ipsec_tunnel_up{name="CommonP2",p2serial="22",parent="My VPN",vdom="root"} 0 fortigate_ipsec_tunnel_up{name="CommonP2",p2serial="23",parent="My VPN",vdom="root"} 1