pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/sysutils/node_exporter
Module Name: pkgsrc
Committed By: tnn
Date: Sun Jul 28 01:14:24 UTC 2024
Modified Files:
pkgsrc/sysutils/node_exporter: Makefile distinfo
Added Files:
pkgsrc/sysutils/node_exporter/patches:
patch-collector_netdev__common.go patch-collector_netdev__netbsd.go
Log Message:
node_exporter: add netdev collector for NetBSD. Submitted to upstream.
To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 pkgsrc/sysutils/node_exporter/Makefile
cvs rdiff -u -r1.11 -r1.12 pkgsrc/sysutils/node_exporter/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/sysutils/node_exporter/patches/patch-collector_netdev__common.go \
pkgsrc/sysutils/node_exporter/patches/patch-collector_netdev__netbsd.go
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/sysutils/node_exporter/Makefile
diff -u pkgsrc/sysutils/node_exporter/Makefile:1.67 pkgsrc/sysutils/node_exporter/Makefile:1.68
--- pkgsrc/sysutils/node_exporter/Makefile:1.67 Tue Jul 16 08:31:26 2024
+++ pkgsrc/sysutils/node_exporter/Makefile Sun Jul 28 01:14:24 2024
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.67 2024/07/16 08:31:26 bsiegert Exp $
+# $NetBSD: Makefile,v 1.68 2024/07/28 01:14:24 tnn Exp $
DISTNAME= node_exporter-1.8.2
+PKGREVISION= 1
MASTER_SITES= ${MASTER_SITE_GITHUB:=prometheus/}
CATEGORIES= sysutils
GITHUB_TAG= v${PKGVERSION_NOREV}
Index: pkgsrc/sysutils/node_exporter/distinfo
diff -u pkgsrc/sysutils/node_exporter/distinfo:1.11 pkgsrc/sysutils/node_exporter/distinfo:1.12
--- pkgsrc/sysutils/node_exporter/distinfo:1.11 Tue Jul 16 08:31:26 2024
+++ pkgsrc/sysutils/node_exporter/distinfo Sun Jul 28 01:14:24 2024
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.11 2024/07/16 08:31:26 bsiegert Exp $
+$NetBSD: distinfo,v 1.12 2024/07/28 01:14:24 tnn Exp $
BLAKE2s (github.com_alecthomas_kingpin_v2_@v_v2.4.0.mod) = 20c554bf73adc1d4faea9cf1eba7f569d362037f364d643d7176e790eed60759
SHA512 (github.com_alecthomas_kingpin_v2_@v_v2.4.0.mod) = 27b647208aec705c995e523035f278c6b81102ba59f5a95e6e7adf1e8cba2e166d73f0d1115946acfcb736918b5b0db66d2f2aeba084a3581a7a29d342f511b2
@@ -387,3 +387,5 @@ Size (howett.net_plist_@v_v1.0.1.zip) =
BLAKE2s (node_exporter-1.8.2.tar.gz) = 2370bedb44e5469e3f9971b1c7e493adf4995107d748a8853e7549750e53548f
SHA512 (node_exporter-1.8.2.tar.gz) = 68112a85a9ffde88d75893c30ab992ae3c591d44fbefa10e45cf94d228c8f8c44bb3585707521e355817c4b4276cf77eeaf4ed9d0261de02620135ad12f5e711
Size (node_exporter-1.8.2.tar.gz) = 335292 bytes
+SHA1 (patch-collector_netdev__common.go) = 83b6615334490e8ccfd8c311b36ee2ec98c0ad15
+SHA1 (patch-collector_netdev__netbsd.go) = 59d5409ea5ab267c48c9a5d299e66c7c283f8680
Added files:
Index: pkgsrc/sysutils/node_exporter/patches/patch-collector_netdev__common.go
diff -u /dev/null pkgsrc/sysutils/node_exporter/patches/patch-collector_netdev__common.go:1.1
--- /dev/null Sun Jul 28 01:14:24 2024
+++ pkgsrc/sysutils/node_exporter/patches/patch-collector_netdev__common.go Sun Jul 28 01:14:24 2024
@@ -0,0 +1,18 @@
+$NetBSD: patch-collector_netdev__common.go,v 1.1 2024/07/28 01:14:24 tnn Exp $
+
+https://github.com/prometheus/node_exporter/pull/3078
+
+--- collector/netdev_common.go.orig 2024-07-28 01:10:46.491634800 +0000
++++ collector/netdev_common.go
+@@ -11,9 +11,9 @@
+ // See the License for the specific language governing permissions and
+ // limitations under the License.
+
+-//go:build !nonetdev && (linux || freebsd || openbsd || dragonfly || darwin)
++//go:build !nonetdev && (linux || freebsd || netbsd || openbsd || dragonfly || darwin)
+ // +build !nonetdev
+-// +build linux freebsd openbsd dragonfly darwin
++// +build linux freebsd netbsd openbsd dragonfly darwin
+
+ package collector
+
Index: pkgsrc/sysutils/node_exporter/patches/patch-collector_netdev__netbsd.go
diff -u /dev/null pkgsrc/sysutils/node_exporter/patches/patch-collector_netdev__netbsd.go:1.1
--- /dev/null Sun Jul 28 01:14:24 2024
+++ pkgsrc/sysutils/node_exporter/patches/patch-collector_netdev__netbsd.go Sun Jul 28 01:14:24 2024
@@ -0,0 +1,98 @@
+$NetBSD: patch-collector_netdev__netbsd.go,v 1.1 2024/07/28 01:14:24 tnn Exp $
+
+https://github.com/prometheus/node_exporter/pull/3078
+
+--- collector/netdev_netbsd.go.orig 2024-07-28 01:10:15.812170143 +0000
++++ collector/netdev_netbsd.go
+@@ -0,0 +1,91 @@
++// Copyright 2024 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.
++
++//go:build !nonetdev && netbsd
++// +build !nonetdev,netbsd
++
++package collector
++
++import (
++ "errors"
++
++ "fmt"
++ "github.com/go-kit/log"
++ "github.com/go-kit/log/level"
++ "unsafe"
++)
++
++/*
++#include <stdio.h>
++#include <stdlib.h>
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <sys/sysctl.h>
++#include <ifaddrs.h>
++#include <net/if.h>
++*/
++import "C"
++
++func getNetDevStats(filter *deviceFilter, logger log.Logger) (netDevStats, error) {
++ netDev := netDevStats{}
++
++ var ifap, ifa *C.struct_ifaddrs
++ if C.getifaddrs(&ifap) == -1 {
++ return nil, errors.New("getifaddrs() failed")
++ }
++ defer C.freeifaddrs(ifap)
++
++ for ifa = ifap; ifa != nil; ifa = ifa.ifa_next {
++ if ifa.ifa_addr.sa_family != C.AF_LINK {
++ continue
++ }
++
++ dev := C.GoString(ifa.ifa_name)
++ if filter.ignored(dev) {
++ level.Debug(logger).Log("msg", "Ignoring device", "device", dev)
++ continue
++ }
++
++ data := (*C.struct_if_data)(ifa.ifa_data)
++
++ // https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L180-L202
++ netDev[dev] = map[string]uint64{
++ "receive_packets": uint64(data.ifi_ipackets),
++ "transmit_packets": uint64(data.ifi_opackets),
++ "receive_bytes": uint64(data.ifi_ibytes),
++ "transmit_bytes": uint64(data.ifi_obytes),
++ "receive_errors": uint64(data.ifi_ierrors),
++ "transmit_errors": uint64(data.ifi_oerrors),
++ "receive_dropped": uint64(data.ifi_iqdrops),
++ "receive_multicast": uint64(data.ifi_imcasts),
++ "transmit_multicast": uint64(data.ifi_omcasts),
++ "collisions": uint64(data.ifi_collisions),
++ "noproto": uint64(data.ifi_noproto),
++ }
++
++ /*
++ * transmit_dropped (ifi_oqdrops) is not available in
++ * struct if_data for backwards compatibility reasons,
++ * but can be read via sysctl.
++ */
++ var ifi_oqdrops uint64
++ var len C.size_t = C.size_t(unsafe.Sizeof(ifi_oqdrops))
++ name := C.CString(fmt.Sprintf("net.interfaces.%s.sndq.drops", dev))
++ defer C.free(unsafe.Pointer(name))
++ if C.sysctlbyname(name, unsafe.Pointer(&ifi_oqdrops), (*C.size_t)(unsafe.Pointer(&len)), unsafe.Pointer(nil), 0) == 0 {
++ netDev[dev]["transmit_dropped"] = ifi_oqdrops
++ }
++ }
++
++ return netDev, nil
++}
Home |
Main Index |
Thread Index |
Old Index