Bumps the minor-and-patch group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [github.com/go-chi/httprate](https://github.com/go-chi/httprate) | `0.16.0` | `0.16.1` | | [github.com/go-ldap/ldap/v3](https://github.com/go-ldap/ldap) | `3.4.14` | `3.4.15` | | [github.com/nats-io/nats-server/v2](https://github.com/nats-io/nats-server) | `2.15.0` | `2.15.1` | | [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) | `1.24.1` | `1.25.0` | | [github.com/tidwall/gjson](https://github.com/tidwall/gjson) | `1.19.1` | `1.20.0` | | [go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp](https://github.com/open-telemetry/opentelemetry-go-contrib) | `0.71.0` | `0.72.0` | | [golang.org/x/sync](https://github.com/golang/sync) | `0.23.0` | `0.24.0` | Updates `github.com/go-chi/httprate` from 0.16.0 to 0.16.1 - [Release notes](https://github.com/go-chi/httprate/releases) - [Commits](https://github.com/go-chi/httprate/compare/v0.16.0...v0.16.1) Updates `github.com/go-ldap/ldap/v3` from 3.4.14 to 3.4.15 - [Release notes](https://github.com/go-ldap/ldap/releases) - [Commits](https://github.com/go-ldap/ldap/compare/v3.4.14...v3.4.15) Updates `github.com/nats-io/nats-server/v2` from 2.15.0 to 2.15.1 - [Release notes](https://github.com/nats-io/nats-server/releases) - [Changelog](https://github.com/nats-io/nats-server/blob/main/RELEASES.md) - [Commits](https://github.com/nats-io/nats-server/compare/v2.15.0...v2.15.1) Updates `github.com/prometheus/client_golang` from 1.24.1 to 1.25.0 - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/v1.25.0/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.24.1...v1.25.0) Updates `github.com/tidwall/gjson` from 1.19.1 to 1.20.0 - [Commits](https://github.com/tidwall/gjson/compare/v1.19.1...v1.20.0) Updates `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` from 0.71.0 to 0.72.0 - [Release notes](https://github.com/open-telemetry/opentelemetry-go-contrib/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go-contrib/compare/zpages/v0.71.0...zpages/v0.72.0) Updates `golang.org/x/sync` from 0.23.0 to 0.24.0 - [Commits](https://github.com/golang/sync/compare/v0.23.0...v0.24.0) --- updated-dependencies: - dependency-name: github.com/go-chi/httprate dependency-version: 0.16.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor-and-patch - dependency-name: github.com/go-ldap/ldap/v3 dependency-version: 3.4.15 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor-and-patch - dependency-name: github.com/nats-io/nats-server/v2 dependency-version: 2.15.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor-and-patch - dependency-name: github.com/prometheus/client_golang dependency-version: 1.25.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: github.com/tidwall/gjson dependency-version: 1.20.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp dependency-version: 0.72.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch - dependency-name: golang.org/x/sync dependency-version: 0.24.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: minor-and-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
382 lines
11 KiB
Go
382 lines
11 KiB
Go
// Copyright The Prometheus Authors
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package procfs
|
|
|
|
import (
|
|
"bufio"
|
|
"bytes"
|
|
"errors"
|
|
"io"
|
|
"os"
|
|
"strconv"
|
|
"strings"
|
|
|
|
"github.com/prometheus/procfs/internal/parsers"
|
|
)
|
|
|
|
// ProcSnmp6 models the content of /proc/<pid>/net/snmp6.
|
|
type ProcSnmp6 struct {
|
|
// The process ID.
|
|
PID int
|
|
Ip6
|
|
Icmp6
|
|
Udp6
|
|
UdpLite6
|
|
}
|
|
|
|
type Ip6 struct { // nolint:revive
|
|
InReceives *float64
|
|
InHdrErrors *float64
|
|
InTooBigErrors *float64
|
|
InNoRoutes *float64
|
|
InAddrErrors *float64
|
|
InUnknownProtos *float64
|
|
InTruncatedPkts *float64
|
|
InDiscards *float64
|
|
InDelivers *float64
|
|
OutForwDatagrams *float64
|
|
OutRequests *float64
|
|
OutDiscards *float64
|
|
OutNoRoutes *float64
|
|
ReasmTimeout *float64
|
|
ReasmReqds *float64
|
|
ReasmOKs *float64
|
|
ReasmFails *float64
|
|
FragOKs *float64
|
|
FragFails *float64
|
|
FragCreates *float64
|
|
InMcastPkts *float64
|
|
OutMcastPkts *float64
|
|
InOctets *float64
|
|
OutOctets *float64
|
|
InMcastOctets *float64
|
|
OutMcastOctets *float64
|
|
InBcastOctets *float64
|
|
OutBcastOctets *float64
|
|
InNoECTPkts *float64
|
|
InECT1Pkts *float64
|
|
InECT0Pkts *float64
|
|
InCEPkts *float64
|
|
}
|
|
|
|
type Icmp6 struct {
|
|
InMsgs *float64
|
|
InErrors *float64
|
|
OutMsgs *float64
|
|
OutErrors *float64
|
|
InCsumErrors *float64
|
|
InDestUnreachs *float64
|
|
InPktTooBigs *float64
|
|
InTimeExcds *float64
|
|
InParmProblems *float64
|
|
InEchos *float64
|
|
InEchoReplies *float64
|
|
InGroupMembQueries *float64
|
|
InGroupMembResponses *float64
|
|
InGroupMembReductions *float64
|
|
InRouterSolicits *float64
|
|
InRouterAdvertisements *float64
|
|
InNeighborSolicits *float64
|
|
InNeighborAdvertisements *float64
|
|
InRedirects *float64
|
|
InMLDv2Reports *float64
|
|
OutDestUnreachs *float64
|
|
OutPktTooBigs *float64
|
|
OutTimeExcds *float64
|
|
OutParmProblems *float64
|
|
OutEchos *float64
|
|
OutEchoReplies *float64
|
|
OutGroupMembQueries *float64
|
|
OutGroupMembResponses *float64
|
|
OutGroupMembReductions *float64
|
|
OutRouterSolicits *float64
|
|
OutRouterAdvertisements *float64
|
|
OutNeighborSolicits *float64
|
|
OutNeighborAdvertisements *float64
|
|
OutRedirects *float64
|
|
OutMLDv2Reports *float64
|
|
InType1 *float64
|
|
InType134 *float64
|
|
InType135 *float64
|
|
InType136 *float64
|
|
InType143 *float64
|
|
OutType133 *float64
|
|
OutType135 *float64
|
|
OutType136 *float64
|
|
OutType143 *float64
|
|
}
|
|
|
|
type Udp6 struct { // nolint:revive
|
|
InDatagrams *float64
|
|
NoPorts *float64
|
|
InErrors *float64
|
|
OutDatagrams *float64
|
|
RcvbufErrors *float64
|
|
SndbufErrors *float64
|
|
InCsumErrors *float64
|
|
IgnoredMulti *float64
|
|
}
|
|
|
|
type UdpLite6 struct { // nolint:revive
|
|
InDatagrams *float64
|
|
NoPorts *float64
|
|
InErrors *float64
|
|
OutDatagrams *float64
|
|
RcvbufErrors *float64
|
|
SndbufErrors *float64
|
|
InCsumErrors *float64
|
|
}
|
|
|
|
func (p Proc) Snmp6() (ProcSnmp6, error) {
|
|
filename := p.path("net/snmp6")
|
|
data, err := parsers.ReadFileNoStat(filename)
|
|
if err != nil {
|
|
// On systems with IPv6 disabled, this file won't exist.
|
|
// Do nothing.
|
|
if errors.Is(err, os.ErrNotExist) {
|
|
return ProcSnmp6{PID: p.PID}, nil
|
|
}
|
|
|
|
return ProcSnmp6{PID: p.PID}, err
|
|
}
|
|
|
|
procSnmp6, err := parseSNMP6Stats(bytes.NewReader(data))
|
|
procSnmp6.PID = p.PID
|
|
return procSnmp6, err
|
|
}
|
|
|
|
// parseSnmp6 parses the metrics from proc/<pid>/net/snmp6 file
|
|
// and returns a map contains those metrics.
|
|
func parseSNMP6Stats(r io.Reader) (ProcSnmp6, error) {
|
|
var (
|
|
scanner = bufio.NewScanner(r)
|
|
procSnmp6 = ProcSnmp6{}
|
|
)
|
|
|
|
for scanner.Scan() {
|
|
stat := strings.Fields(scanner.Text())
|
|
if len(stat) < 2 {
|
|
continue
|
|
}
|
|
// Expect to have "6" in metric name, skip line otherwise
|
|
if sixIndex := strings.Index(stat[0], "6"); sixIndex != -1 {
|
|
protocol := stat[0][:sixIndex+1]
|
|
key := stat[0][sixIndex+1:]
|
|
value, err := strconv.ParseFloat(stat[1], 64)
|
|
if err != nil {
|
|
return procSnmp6, err
|
|
}
|
|
|
|
switch protocol {
|
|
case "Ip6":
|
|
switch key {
|
|
case "InReceives":
|
|
procSnmp6.InReceives = &value
|
|
case "InHdrErrors":
|
|
procSnmp6.InHdrErrors = &value
|
|
case "InTooBigErrors":
|
|
procSnmp6.InTooBigErrors = &value
|
|
case "InNoRoutes":
|
|
procSnmp6.InNoRoutes = &value
|
|
case "InAddrErrors":
|
|
procSnmp6.InAddrErrors = &value
|
|
case "InUnknownProtos":
|
|
procSnmp6.InUnknownProtos = &value
|
|
case "InTruncatedPkts":
|
|
procSnmp6.InTruncatedPkts = &value
|
|
case "InDiscards":
|
|
procSnmp6.InDiscards = &value
|
|
case "InDelivers":
|
|
procSnmp6.InDelivers = &value
|
|
case "OutForwDatagrams":
|
|
procSnmp6.OutForwDatagrams = &value
|
|
case "OutRequests":
|
|
procSnmp6.OutRequests = &value
|
|
case "OutDiscards":
|
|
procSnmp6.OutDiscards = &value
|
|
case "OutNoRoutes":
|
|
procSnmp6.OutNoRoutes = &value
|
|
case "ReasmTimeout":
|
|
procSnmp6.ReasmTimeout = &value
|
|
case "ReasmReqds":
|
|
procSnmp6.ReasmReqds = &value
|
|
case "ReasmOKs":
|
|
procSnmp6.ReasmOKs = &value
|
|
case "ReasmFails":
|
|
procSnmp6.ReasmFails = &value
|
|
case "FragOKs":
|
|
procSnmp6.FragOKs = &value
|
|
case "FragFails":
|
|
procSnmp6.FragFails = &value
|
|
case "FragCreates":
|
|
procSnmp6.FragCreates = &value
|
|
case "InMcastPkts":
|
|
procSnmp6.InMcastPkts = &value
|
|
case "OutMcastPkts":
|
|
procSnmp6.OutMcastPkts = &value
|
|
case "InOctets":
|
|
procSnmp6.InOctets = &value
|
|
case "OutOctets":
|
|
procSnmp6.OutOctets = &value
|
|
case "InMcastOctets":
|
|
procSnmp6.InMcastOctets = &value
|
|
case "OutMcastOctets":
|
|
procSnmp6.OutMcastOctets = &value
|
|
case "InBcastOctets":
|
|
procSnmp6.InBcastOctets = &value
|
|
case "OutBcastOctets":
|
|
procSnmp6.OutBcastOctets = &value
|
|
case "InNoECTPkts":
|
|
procSnmp6.InNoECTPkts = &value
|
|
case "InECT1Pkts":
|
|
procSnmp6.InECT1Pkts = &value
|
|
case "InECT0Pkts":
|
|
procSnmp6.InECT0Pkts = &value
|
|
case "InCEPkts":
|
|
procSnmp6.InCEPkts = &value
|
|
|
|
}
|
|
case "Icmp6":
|
|
switch key {
|
|
case "InMsgs":
|
|
procSnmp6.InMsgs = &value
|
|
case "InErrors":
|
|
procSnmp6.Icmp6.InErrors = &value
|
|
case "OutMsgs":
|
|
procSnmp6.OutMsgs = &value
|
|
case "OutErrors":
|
|
procSnmp6.OutErrors = &value
|
|
case "InCsumErrors":
|
|
procSnmp6.Icmp6.InCsumErrors = &value
|
|
case "InDestUnreachs":
|
|
procSnmp6.InDestUnreachs = &value
|
|
case "InPktTooBigs":
|
|
procSnmp6.InPktTooBigs = &value
|
|
case "InTimeExcds":
|
|
procSnmp6.InTimeExcds = &value
|
|
case "InParmProblems":
|
|
procSnmp6.InParmProblems = &value
|
|
case "InEchos":
|
|
procSnmp6.InEchos = &value
|
|
case "InEchoReplies":
|
|
procSnmp6.InEchoReplies = &value
|
|
case "InGroupMembQueries":
|
|
procSnmp6.InGroupMembQueries = &value
|
|
case "InGroupMembResponses":
|
|
procSnmp6.InGroupMembResponses = &value
|
|
case "InGroupMembReductions":
|
|
procSnmp6.InGroupMembReductions = &value
|
|
case "InRouterSolicits":
|
|
procSnmp6.InRouterSolicits = &value
|
|
case "InRouterAdvertisements":
|
|
procSnmp6.InRouterAdvertisements = &value
|
|
case "InNeighborSolicits":
|
|
procSnmp6.InNeighborSolicits = &value
|
|
case "InNeighborAdvertisements":
|
|
procSnmp6.InNeighborAdvertisements = &value
|
|
case "InRedirects":
|
|
procSnmp6.InRedirects = &value
|
|
case "InMLDv2Reports":
|
|
procSnmp6.InMLDv2Reports = &value
|
|
case "OutDestUnreachs":
|
|
procSnmp6.OutDestUnreachs = &value
|
|
case "OutPktTooBigs":
|
|
procSnmp6.OutPktTooBigs = &value
|
|
case "OutTimeExcds":
|
|
procSnmp6.OutTimeExcds = &value
|
|
case "OutParmProblems":
|
|
procSnmp6.OutParmProblems = &value
|
|
case "OutEchos":
|
|
procSnmp6.OutEchos = &value
|
|
case "OutEchoReplies":
|
|
procSnmp6.OutEchoReplies = &value
|
|
case "OutGroupMembQueries":
|
|
procSnmp6.OutGroupMembQueries = &value
|
|
case "OutGroupMembResponses":
|
|
procSnmp6.OutGroupMembResponses = &value
|
|
case "OutGroupMembReductions":
|
|
procSnmp6.OutGroupMembReductions = &value
|
|
case "OutRouterSolicits":
|
|
procSnmp6.OutRouterSolicits = &value
|
|
case "OutRouterAdvertisements":
|
|
procSnmp6.OutRouterAdvertisements = &value
|
|
case "OutNeighborSolicits":
|
|
procSnmp6.OutNeighborSolicits = &value
|
|
case "OutNeighborAdvertisements":
|
|
procSnmp6.OutNeighborAdvertisements = &value
|
|
case "OutRedirects":
|
|
procSnmp6.OutRedirects = &value
|
|
case "OutMLDv2Reports":
|
|
procSnmp6.OutMLDv2Reports = &value
|
|
case "InType1":
|
|
procSnmp6.InType1 = &value
|
|
case "InType134":
|
|
procSnmp6.InType134 = &value
|
|
case "InType135":
|
|
procSnmp6.InType135 = &value
|
|
case "InType136":
|
|
procSnmp6.InType136 = &value
|
|
case "InType143":
|
|
procSnmp6.InType143 = &value
|
|
case "OutType133":
|
|
procSnmp6.OutType133 = &value
|
|
case "OutType135":
|
|
procSnmp6.OutType135 = &value
|
|
case "OutType136":
|
|
procSnmp6.OutType136 = &value
|
|
case "OutType143":
|
|
procSnmp6.OutType143 = &value
|
|
}
|
|
case "Udp6":
|
|
switch key {
|
|
case "InDatagrams":
|
|
procSnmp6.Udp6.InDatagrams = &value
|
|
case "NoPorts":
|
|
procSnmp6.Udp6.NoPorts = &value
|
|
case "InErrors":
|
|
procSnmp6.Udp6.InErrors = &value
|
|
case "OutDatagrams":
|
|
procSnmp6.Udp6.OutDatagrams = &value
|
|
case "RcvbufErrors":
|
|
procSnmp6.Udp6.RcvbufErrors = &value
|
|
case "SndbufErrors":
|
|
procSnmp6.Udp6.SndbufErrors = &value
|
|
case "InCsumErrors":
|
|
procSnmp6.Udp6.InCsumErrors = &value
|
|
case "IgnoredMulti":
|
|
procSnmp6.IgnoredMulti = &value
|
|
}
|
|
case "UdpLite6":
|
|
switch key {
|
|
case "InDatagrams":
|
|
procSnmp6.UdpLite6.InDatagrams = &value
|
|
case "NoPorts":
|
|
procSnmp6.UdpLite6.NoPorts = &value
|
|
case "InErrors":
|
|
procSnmp6.UdpLite6.InErrors = &value
|
|
case "OutDatagrams":
|
|
procSnmp6.UdpLite6.OutDatagrams = &value
|
|
case "RcvbufErrors":
|
|
procSnmp6.UdpLite6.RcvbufErrors = &value
|
|
case "SndbufErrors":
|
|
procSnmp6.UdpLite6.SndbufErrors = &value
|
|
case "InCsumErrors":
|
|
procSnmp6.UdpLite6.InCsumErrors = &value
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return procSnmp6, scanner.Err()
|
|
}
|