On Tue, Oct 15, 2019 at 08:35:01AM +0200, Claudio Jeker wrote:
> Minor bug fix release fixing these two things:
> 
>     [BUGFIX] Fix incorrect sysctl call in BSD meminfo collector, resulting
>              in broken swap metrics on FreeBSD #1345
>     [BUGFIX] Fix rollover bug in mountstats collector #1364
> 
> Again I changed the build user settings in promu.yml, happy to remove
> those patches if this is not an issue.
> Seems to work for me but more testing welcome.

This one is better since it enables the uname collector as well which
should help with e.g. the grafana node_exporter dashboard.

-- 
:wq Claudio

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/node_exporter/Makefile,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile
--- Makefile    12 Jul 2019 20:49:47 -0000      1.2
+++ Makefile    11 Oct 2019 03:39:23 -0000
@@ -4,7 +4,7 @@ COMMENT =               prometheus exporter for hardw
 
 GH_ACCOUNT =           prometheus
 GH_PROJECT =           node_exporter
-GH_TAGNAME =           v0.18.0
+GH_TAGNAME =           v0.18.1
 
 CATEGORIES =           sysutils
 
Index: distinfo
===================================================================
RCS file: /cvs/ports/sysutils/node_exporter/distinfo,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 distinfo
--- distinfo    14 May 2019 17:21:31 -0000      1.1.1.2
+++ distinfo    11 Oct 2019 03:39:49 -0000
@@ -1,2 +1,2 @@
-SHA256 (node_exporter-0.18.0.tar.gz) = 
L3GkoR+hOI5KRZhlUgNlOW+LbrutnUXfR2/mDuDeBBU=
-SIZE (node_exporter-0.18.0.tar.gz) = 2104908
+SHA256 (node_exporter-0.18.1.tar.gz) = 
nd8YfEYvJoGrRRZBCtoObw8DCX22mGaGeVVZ6nGgdpQ=
+SIZE (node_exporter-0.18.1.tar.gz) = 2110072
Index: patches/patch-Makefile_common
===================================================================
RCS file: /cvs/ports/sysutils/node_exporter/patches/patch-Makefile_common,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-Makefile_common
--- patches/patch-Makefile_common       8 May 2019 12:37:09 -0000       1.1.1.1
+++ patches/patch-Makefile_common       11 Oct 2019 03:41:57 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-Makefile_common,v 1.1.1.
 Index: Makefile.common
 --- Makefile.common.orig
 +++ Makefile.common
-@@ -175,11 +175,7 @@ common-docker-tag-latest:
+@@ -233,11 +233,7 @@ common-docker-manifest:
  promu: $(PROMU)
  
  $(PROMU):
Index: patches/patch-_promu-cgo_yml
===================================================================
RCS file: patches/patch-_promu-cgo_yml
diff -N patches/patch-_promu-cgo_yml
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-_promu-cgo_yml        11 Oct 2019 03:45:06 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: .promu-cgo.yml
+--- .promu-cgo.yml.orig
++++ .promu-cgo.yml
+@@ -10,7 +10,7 @@ build:
+         -X github.com/prometheus/common/version.Version={{.Version}}
+         -X github.com/prometheus/common/version.Revision={{.Revision}}
+         -X github.com/prometheus/common/version.Branch={{.Branch}}
+-        -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
++        -X github.com/prometheus/common/version.BuildUser=OpenBSD
+         -X github.com/prometheus/common/version.BuildDate={{date 
"20060102-15:04:05"}}
+ tarball:
+     files:
Index: patches/patch-_promu_yml
===================================================================
RCS file: patches/patch-_promu_yml
diff -N patches/patch-_promu_yml
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-_promu_yml    11 Oct 2019 03:42:01 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: .promu.yml
+--- .promu.yml.orig
++++ .promu.yml
+@@ -12,7 +12,7 @@ build:
+         -X github.com/prometheus/common/version.Version={{.Version}}
+         -X github.com/prometheus/common/version.Revision={{.Revision}}
+         -X github.com/prometheus/common/version.Branch={{.Branch}}
+-        -X github.com/prometheus/common/version.BuildUser={{user}}@{{host}}
++        -X github.com/prometheus/common/version.BuildUser=OpenBSD
+         -X github.com/prometheus/common/version.BuildDate={{date 
"20060102-15:04:05"}}
+ tarball:
+     files:
Index: patches/patch-collector_uname_go
===================================================================
RCS file: patches/patch-collector_uname_go
diff -N patches/patch-collector_uname_go
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-collector_uname_go    15 Oct 2019 15:06:56 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: collector/uname.go
+--- collector/uname.go.orig
++++ collector/uname.go
+@@ -11,7 +11,7 @@
+ // See the License for the specific language governing permissions and
+ // limitations under the License.
+ 
+-// +build freebsd linux
++// +build freebsd linux openbsd
+ // +build !nouname
+ 
+ package collector
Index: patches/patch-collector_uname_openbsd_go
===================================================================
RCS file: patches/patch-collector_uname_openbsd_go
diff -N patches/patch-collector_uname_openbsd_go
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-collector_uname_openbsd_go    15 Oct 2019 15:07:00 -0000
@@ -0,0 +1,63 @@
+$OpenBSD$
+
+Index: collector/uname_openbsd.go
+--- collector/uname_openbsd.go.orig
++++ collector/uname_openbsd.go
+@@ -0,0 +1,57 @@
++// Copyright 2019 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.
++
++// +build !nouname
++
++package collector
++
++import (
++      "bytes"
++      "strings"
++
++      "golang.org/x/sys/unix"
++)
++
++func getUname() (uname, error) {
++      var utsname unix.Utsname
++      if err := unix.Uname(&utsname); err != nil {
++              return uname{}, err
++      }
++
++      // We do a little bit of work here to emulate what happens in the Linux
++      // uname calls since FreeBSD uname doesn't have a Domainname.
++      nodename := 
string(utsname.Nodename[:bytes.IndexByte(utsname.Nodename[:], 0)])
++      split := strings.SplitN(nodename, ".", 2)
++
++      // We'll always have at least a single element in the array. We assume 
this
++      // is the hostname.
++      hostname := split[0]
++
++      // If we have more than one element, we assume this is the domainname.
++      // Otherwise leave it to "(none)" like Linux.
++      domainname := "(none)"
++      if len(split) > 1 {
++              domainname = split[1]
++      }
++
++      output := uname{
++              SysName:    
string(utsname.Sysname[:bytes.IndexByte(utsname.Sysname[:], 0)]),
++              Release:    
string(utsname.Release[:bytes.IndexByte(utsname.Release[:], 0)]),
++              Version:    
string(utsname.Version[:bytes.IndexByte(utsname.Version[:], 0)]),
++              Machine:    
string(utsname.Machine[:bytes.IndexByte(utsname.Machine[:], 0)]),
++              NodeName:   hostname,
++              DomainName: domainname,
++      }
++
++      return output, nil
++}

Reply via email to