Skip to content

Commit

Permalink
doc(probe): improve metric descriptions (#239)
Browse files Browse the repository at this point in the history
* docs: Updated descriptions of metrics to be self-explanatory

* test(interface): Fixed tests for system and ipsec interfaces

---------

Co-authored-by: Gianni Stubbe <[email protected]>
  • Loading branch information
33Fraise33 and Gianni Stubbe authored Jul 25, 2023
1 parent 8a6f0b3 commit a863650
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/probe/system_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pkg/probe/system_interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/probe/vpn_ipsec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions pkg/probe/vpn_ipsec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a863650

Please sign in to comment.