Date: Fri, 15 May 2026 11:24:47 +0000 From: Vladimir Druzenko <vvd@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Cc: Moggie <moggie@elasticmind.net> Subject: git: 38251f8f8e18 - main - net-mgmt/junos_exporter: New port: Prometheus exporter for JunOS device metrics via SSH Message-ID: <6a07027f.455eb.4930bbd8@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by vvd: URL: https://cgit.FreeBSD.org/ports/commit/?id=38251f8f8e18d0b99e5d29d11bbb95444613b9c0 commit 38251f8f8e18d0b99e5d29d11bbb95444613b9c0 Author: Moggie <moggie@elasticmind.net> AuthorDate: 2026-05-15 11:21:05 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2026-05-15 11:21:05 +0000 net-mgmt/junos_exporter: New port: Prometheus exporter for JunOS device metrics via SSH PR: 295280 Sponsored by: UNIS Labs --- net-mgmt/Makefile | 1 + net-mgmt/junos_exporter/Makefile | 25 ++++++++++ net-mgmt/junos_exporter/distinfo | 5 ++ net-mgmt/junos_exporter/files/junos_exporter.in | 63 +++++++++++++++++++++++++ net-mgmt/junos_exporter/files/pkg-message.in | 41 ++++++++++++++++ net-mgmt/junos_exporter/pkg-descr | 5 ++ 6 files changed, 140 insertions(+) diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile index 9bde311fde71..8f324f2ec0c9 100644 --- a/net-mgmt/Makefile +++ b/net-mgmt/Makefile @@ -129,6 +129,7 @@ SUBDIR += irrtoolset SUBDIR += isic SUBDIR += jnettop + SUBDIR += junos_exporter SUBDIR += kapacitor SUBDIR += kf6-networkmanager-qt SUBDIR += kismet diff --git a/net-mgmt/junos_exporter/Makefile b/net-mgmt/junos_exporter/Makefile new file mode 100644 index 000000000000..43924582a807 --- /dev/null +++ b/net-mgmt/junos_exporter/Makefile @@ -0,0 +1,25 @@ +PORTNAME= junos_exporter +DISTVERSIONPREFIX= v +DISTVERSION= 0.15.4 +CATEGORIES= net-mgmt + +MAINTAINER= moggie@elasticmind.net +COMMENT= Prometheus exporter for Juniper device metrics +WWW= https://github.com/czerwonk/junos_exporter/ + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go:1.26+,modules +USE_RC_SUBR= junos_exporter +GO_MODULE= github.com/czerwonk/junos_exporter + +SUB_FILES= pkg-message +SUB_LIST= USERS="${USERS}" GROUPS="${GROUPS}" + +USERS= prometheus +GROUPS= prometheus + +PLIST_FILES= bin/junos_exporter + +.include <bsd.port.mk> diff --git a/net-mgmt/junos_exporter/distinfo b/net-mgmt/junos_exporter/distinfo new file mode 100644 index 000000000000..bbccfea21a37 --- /dev/null +++ b/net-mgmt/junos_exporter/distinfo @@ -0,0 +1,5 @@ +TIMESTAMP = 1778749425 +SHA256 (go/net-mgmt_junos_exporter/junos_exporter-v0.15.4/v0.15.4.mod) = 6ec46567006b27774adedd1610664b42b21d8e58836f9dfd91de23a83e2d5b8b +SIZE (go/net-mgmt_junos_exporter/junos_exporter-v0.15.4/v0.15.4.mod) = 1860 +SHA256 (go/net-mgmt_junos_exporter/junos_exporter-v0.15.4/v0.15.4.zip) = c1ad31eed4374c87f821c6a8dbf4f10dc390e7e1ead1321cae266d61f1f02fbd +SIZE (go/net-mgmt_junos_exporter/junos_exporter-v0.15.4/v0.15.4.zip) = 817263 diff --git a/net-mgmt/junos_exporter/files/junos_exporter.in b/net-mgmt/junos_exporter/files/junos_exporter.in new file mode 100644 index 000000000000..08c40a31fc58 --- /dev/null +++ b/net-mgmt/junos_exporter/files/junos_exporter.in @@ -0,0 +1,63 @@ +#!/bin/sh + +# PROVIDE: junos_exporter +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# junos_exporter_enable (bool): Set to NO by default. +# Set it to YES to enable junos_exporter. +# junos_exporter_user (string): Set user that junos_exporter will run under +# Default is "%%USERS%%". +# junos_exporter_group (string): Set group that junos_exporter will run under +# Default is "%%GROUPS%%". +# junos_exporter_args (string): Set extra arguments to pass to junos_exporter +# Default is "". +# junos_exporter_listen_address (string): Set ip:port that junos_exporter will listen on +# Default is "localhost:9326". +# junos_exporter_config (string): Set configuration file path for junos_exporter +# Default is "%%PREFIX%%/etc/junos_exporter.yml". + +. /etc/rc.subr + +name=junos_exporter +desc="junos_exporter for use with Prometheus" +rcvar=junos_exporter_enable + +load_rc_config $name + +: ${junos_exporter_enable:="NO"} +: ${junos_exporter_user:="%%USERS%%"} +: ${junos_exporter_group:="%%GROUPS%%"} +: ${junos_exporter_args:=""} +: ${junos_exporter_listen_address:="localhost:9326"} +: ${junos_exporter_config:="%%PREFIX%%/etc/junos_exporter.yml"} + +conf_file="--config.file=${junos_exporter_config}" + +pidfile=/var/run/junos_exporter.pid +command="/usr/sbin/daemon" +procname="%%PREFIX%%/bin/junos_exporter" +command_args="-f -p ${pidfile} -T ${name} \ + /usr/bin/env ${procname} \ + --web.listen-address=${junos_exporter_listen_address} \ + ${conf_file} \ + ${junos_exporter_args}" + +start_precmd=junos_exporter_startprecmd + +junos_exporter_startprecmd() +{ + if [ ! -e ${pidfile} ]; then + install \ + -o ${junos_exporter_user} \ + -g ${junos_exporter_group} \ + /dev/null ${pidfile}; + else + chown ${junos_exporter_user}:${junos_exporter_group} ${pidfile}; + fi +} + +run_rc_command "$1" diff --git a/net-mgmt/junos_exporter/files/pkg-message.in b/net-mgmt/junos_exporter/files/pkg-message.in new file mode 100644 index 000000000000..32dec87803e6 --- /dev/null +++ b/net-mgmt/junos_exporter/files/pkg-message.in @@ -0,0 +1,41 @@ +[ +{ type: install + message: <<EOM +To start junos_exporter, create a configuration file at: + + %%PREFIX%%/etc/junos_exporter.yml + +With a configuration like this basic example: + + devices: + - host: router1 + username: exporter + key_file: /path/to/key + - host: router2 + username: exporter + password: secret + features: + alarm: true + environment: true + interfaces: true + + # Optional + features: + alarm: true + environment: true + power: true + system: true + +then run "sysrc junos_exporter_enable=yes" to enable. + +For more configuration options, visit: + + https://github.com/czerwonk/junos_exporter + +Since junos_exporter can allow for the calling of arbitrary probe targets +via HTTP parameters, it is set to listen on localhost only by default. This +behaviour can be changed using its junos_exporter_listen_address option, but +please note the potential security implications of doing so. +EOM +} +] diff --git a/net-mgmt/junos_exporter/pkg-descr b/net-mgmt/junos_exporter/pkg-descr new file mode 100644 index 000000000000..8501cbfefc4a --- /dev/null +++ b/net-mgmt/junos_exporter/pkg-descr @@ -0,0 +1,5 @@ +junos_exporter is a Prometheus exporter for Juniper device metrics. + +This exporter also supports Prometheus' multi-target scraping pattern, which +enables a single running instance of the exporter to collect metrics from +multiple Juniper devices.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a07027f.455eb.4930bbd8>
