From 392ada202f1951e2ba355270225cd6306490b2f8 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Sun, 16 Jun 2019 20:36:06 +0200 Subject: [PATCH 1/4] Add pfSense-pkg-node_exporter Signed-off-by: Calle Pettersson --- sysutils/node_exporter/Makefile | 2 +- sysutils/pfSense-pkg-node_exporter/Makefile | 39 +++++ .../files/pkg-deinstall.in | 3 + .../files/pkg-install.in | 7 + .../usr/local/etc/rc.conf.d/node_exporter | 1 + .../files/usr/local/pkg/node_exporter.inc | 133 ++++++++++++++++++ .../files/usr/local/pkg/node_exporter.xml | 99 +++++++++++++ .../share/pfSense-pkg-node_exporter/info.xml | 10 ++ .../interface-collector.py | 36 +++++ .../node_exporter.sh | 68 +++++++++ sysutils/pfSense-pkg-node_exporter/pkg-descr | 1 + sysutils/pfSense-pkg-node_exporter/pkg-plist | 6 + 12 files changed, 404 insertions(+), 1 deletion(-) create mode 100644 sysutils/pfSense-pkg-node_exporter/Makefile create mode 100644 sysutils/pfSense-pkg-node_exporter/files/pkg-deinstall.in create mode 100644 sysutils/pfSense-pkg-node_exporter/files/pkg-install.in create mode 100644 sysutils/pfSense-pkg-node_exporter/files/usr/local/etc/rc.conf.d/node_exporter create mode 100644 sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.inc create mode 100644 sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.xml create mode 100644 sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/info.xml create mode 100644 sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/interface-collector.py create mode 100644 sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/node_exporter.sh create mode 100644 sysutils/pfSense-pkg-node_exporter/pkg-descr create mode 100644 sysutils/pfSense-pkg-node_exporter/pkg-plist diff --git a/sysutils/node_exporter/Makefile b/sysutils/node_exporter/Makefile index d1fa0b85bfab..d9cea12916ee 100644 --- a/sysutils/node_exporter/Makefile +++ b/sysutils/node_exporter/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= node_exporter -PORTVERSION= 0.17.0 +PORTVERSION= 0.18.1 DISTVERSIONPREFIX=v PORTREVISION= 1 CATEGORIES= sysutils diff --git a/sysutils/pfSense-pkg-node_exporter/Makefile b/sysutils/pfSense-pkg-node_exporter/Makefile new file mode 100644 index 000000000000..21c4731c5ecc --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/Makefile @@ -0,0 +1,39 @@ +# $FreeBSD$ + +PORTNAME= pfSense-pkg-node_exporter +PORTVERSION= 0.18.1 +PORTEPOCH= 1 +CATEGORIES= sysutils +MASTER_SITES= # empty +DISTFILES= # empty +EXTRACT_ONLY= # empty + +MAINTAINER= coreteam@pfsense.org +COMMENT= pfSense package node_exporter + +LICENSE= APACHE20 + +RUN_DEPENDS= ${LOCALBASE}/bin/node_exporter:sysutils/node_exporter + +NO_BUILD= yes +NO_MTREE= yes + +SUB_FILES= pkg-install pkg-deinstall +SUB_LIST= PORTNAME=${PORTNAME} + +do-extract: + ${MKDIR} ${WRKSRC} + +do-install: + ${MKDIR} ${STAGEDIR}${PREFIX}/pkg + ${MKDIR} ${STAGEDIR}${PREFIX}/etc/rc.conf.d + ${MKDIR} ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/node_exporter.xml ${STAGEDIR}${PREFIX}/pkg + ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/node_exporter.inc ${STAGEDIR}${PREFIX}/pkg + ${INSTALL_DATA} ${FILESDIR}${PREFIX}/etc/rc.conf.d/node_exporter ${STAGEDIR}${PREFIX}/etc/rc.conf.d/ + ${INSTALL_DATA} ${FILESDIR}${DATADIR}/info.xml ${STAGEDIR}${DATADIR} + ${INSTALL_SCRIPT} ${FILESDIR}${DATADIR}/node_exporter.sh ${STAGEDIR}${DATADIR} + ${INSTALL_SCRIPT} ${FILESDIR}${DATADIR}/interface-collector.py ${STAGEDIR}${DATADIR} + @${REINPLACE_CMD} -i '' -e "s|%%PKGVERSION%%|${PKGVERSION}|" ${STAGEDIR}${DATADIR}/info.xml + +.include diff --git a/sysutils/pfSense-pkg-node_exporter/files/pkg-deinstall.in b/sysutils/pfSense-pkg-node_exporter/files/pkg-deinstall.in new file mode 100644 index 000000000000..83d1c3dcab9e --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/files/pkg-deinstall.in @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/local/bin/php -f /etc/rc.packages %%PORTNAME%% ${2} diff --git a/sysutils/pfSense-pkg-node_exporter/files/pkg-install.in b/sysutils/pfSense-pkg-node_exporter/files/pkg-install.in new file mode 100644 index 000000000000..25b18865994c --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/files/pkg-install.in @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ "${2}" != "POST-INSTALL" ]; then + exit 0 +fi + +/usr/local/bin/php -f /etc/rc.packages %%PORTNAME%% ${2} diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/etc/rc.conf.d/node_exporter b/sysutils/pfSense-pkg-node_exporter/files/usr/local/etc/rc.conf.d/node_exporter new file mode 100644 index 000000000000..b50602361be4 --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/files/usr/local/etc/rc.conf.d/node_exporter @@ -0,0 +1 @@ +node_exporter_enable="NO" \ No newline at end of file diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.inc b/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.inc new file mode 100644 index 000000000000..407553b45dbd --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.inc @@ -0,0 +1,133 @@ + NODE_EXPORTER_DEFAULT_COLLECTORS, + "listen_port" => "9100", + "extra_flags" => "--log.level=warn", + ]; + } + + // Set up textfile cron job + install_cron_job(NODE_EXPORTER_TEXTFILE_CRONTASK, true, "*"); + + node_exporter_sync_config(); +} + +function node_exporter_deinstall_command() { + if (is_service_running('node_exporter')) { + log_error("Stopping service node_exporter"); + stop_service('node_exporter'); + } + unlink_if_exists(NODE_EXPORTER_RCFILE); + unlink_if_exists(NODE_EXPORTER_CONFIG_FILE); + + // Set up textfile cron job + install_cron_job(NODE_EXPORTER_TEXTFILE_CRONTASK, false); +} + +function node_exporter_validate_form($post, &$input_errors) { + if (empty($post['listen_iface'])) { + $input_errors[] = 'You must select an interface to listen to'; + } + + if (!is_port($post['listen_port'])) { + $input_errors[] = 'You must enter a valid port number in the \'Listen Port\' field'; + } +} + +?> diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.xml b/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.xml new file mode 100644 index 000000000000..b60a22edfd2b --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.xml @@ -0,0 +1,99 @@ + + + + + + + + node_exporter + node_exporter + /usr/local/pkg/node_exporter.inc + + Prometheus node_exporter + Setup node_exporter specific settings +
Services
+ /pkg_edit.php?xml=node_exporter.xml +
+ + node_exporter + node_exporter.sh + node_exporter + node_exporter + + + + Enable node_exporter + enable + checkbox + + + Interface + listen_iface + interfaces_selection + Pick an interface to serve the metrics endpoint on. + wan + + + Listen port + listen_port + input + Pick the port to serve the metrics endpoint on. + + + + Collectors + collectors + Select enabled collectors. Those marked with (*) are the default set. + select + + 15 + + + + + + + + + + + + + + + + + + + + Extra flags + extra_flags + input + Extra flags to pass + + + node_exporter_validate_form($_POST, $input_errors); + node_exporter_sync_config(); + node_exporter_deinstall_command(); + node_exporter_install_command(); +
diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/info.xml b/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/info.xml new file mode 100644 index 000000000000..d7f120be1376 --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/info.xml @@ -0,0 +1,10 @@ + + + + node_exporter + Prometheus exporter for machine metrics + http://github.com/prometheus/node_exporter + %%PKGVERSION%% + node_exporter.xml + + diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/interface-collector.py b/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/interface-collector.py new file mode 100644 index 000000000000..ce4f3e90b8cd --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/interface-collector.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +import xml.etree.ElementTree as ET + +class simplemetric: + template = """# HELP {name} {help} +# TYPE {name} gauge +{series}""" + def __init__(self, name, help): + self.name = name + self.help = help + self.series = [] + def __str__(self): + return simplemetric.template.format(name=self.name, help=self.help, series='\n'.join(self.series)) + def __repr__(self): + return self.__str__() + def add(self, val, **labelpairs): + lvs = ['{key}="{value}"'.format(key=key, value=value) for key,value in labelpairs.items()] + self.series.append('{name}{{{labels}}} {val}'.format(name=self.name, labels=','.join(lvs), val=val)) + +metrics = { + 'up': simplemetric('node_pfsense_interface_up','1 if interface is enabled, else 0.'), + 'info': simplemetric('node_pfsense_interface_info', 'Information about the interface. Always 1.') +} + +root = ET.parse('/conf/config.xml') +for elem in root.find("interfaces"): + pf_name = elem.tag + if_name = elem.find('if').text + descr = elem.find('descr').text + enabled = 1 if elem.find('enable') is not None else 0 + metrics['up'].add(enabled, name=pf_name) + metrics['info'].add(enabled, description=descr, interface=if_name, name=pf_name) + +textfile = open('/var/tmp/node_exporter/pfsense.prom','w') +textfile.write('\n'.join(str(m) for m in metrics.values())) +textfile.write('\n') # Ensure trailing newline diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/node_exporter.sh b/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/node_exporter.sh new file mode 100644 index 000000000000..c388105c9243 --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/node_exporter.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# PROVIDE: node_exporter +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# node_exporter_enable (bool): Set to NO by default. +# Set it to YES to enable node_exporter. +# node_exporter_user (string): Set user that node_exporter will run under +# Default is "nobody". +# node_exporter_group (string): Set group that node_exporter will run under +# Default is "nobody". +# node_exporter_args (string): Set extra arguments to pass to node_exporter +# Default is "". +# node_exporter_listen_address (string):Set ip:port that node_exporter will listen on +# Default is ":9100". +# node_exporter_textfile_dir (string): Set directory that node_exporter will watch +# Default is "/var/tmp/node_exporter". + +. /etc/rc.subr + +name=node_exporter +rcvar=node_exporter_enable + +load_rc_config $name + +: ${node_exporter_enable:="NO"} +: ${node_exporter_user:="nobody"} +: ${node_exporter_group:="nobody"} +: ${node_exporter_args:=""} +: ${node_exporter_listen_address:=":9100"} +: ${node_exporter_textfile_dir:="/var/tmp/node_exporter"} + + +pidfile=/var/run/node_exporter.pid +command="/usr/sbin/daemon" +procname="/usr/local/bin/node_exporter" +command_args="-p ${pidfile} -T ${name} \ + /usr/bin/env ${procname} \ + --web.listen-address=${node_exporter_listen_address} \ + --collector.textfile.directory=${node_exporter_textfile_dir} \ + ${node_exporter_args}" + +start_precmd=node_exporter_startprecmd + +node_exporter_startprecmd() +{ + if [ ! -e ${pidfile} ]; then + install \ + -o ${node_exporter_user} \ + -g ${node_exporter_group} \ + /dev/null ${pidfile}; + fi + if [ ! -d ${node_exporter_textfile_dir} ]; then + install \ + -d \ + -o ${node_exporter_user} \ + -g ${node_exporter_group} \ + -m 1755 \ + ${node_exporter_textfile_dir} + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/sysutils/pfSense-pkg-node_exporter/pkg-descr b/sysutils/pfSense-pkg-node_exporter/pkg-descr new file mode 100644 index 000000000000..982ed93d6213 --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/pkg-descr @@ -0,0 +1 @@ +Prometheus exporter for machine metrics \ No newline at end of file diff --git a/sysutils/pfSense-pkg-node_exporter/pkg-plist b/sysutils/pfSense-pkg-node_exporter/pkg-plist new file mode 100644 index 000000000000..60cf93d7e27a --- /dev/null +++ b/sysutils/pfSense-pkg-node_exporter/pkg-plist @@ -0,0 +1,6 @@ +pkg/node_exporter.xml +pkg/node_exporter.inc +etc/rc.conf.d/node_exporter +%%DATADIR%%/node_exporter.sh +%%DATADIR%%/interface-collector.py +%%DATADIR%%/info.xml From 2f4df36e0ffa474ca7056725a01537b9d9c54fec Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Thu, 8 Aug 2019 08:44:40 +0200 Subject: [PATCH 2/4] Fix review comments --- sysutils/node_exporter/Makefile | 2 +- sysutils/pfSense-pkg-node_exporter/Makefile | 3 +-- .../files/usr/local/etc/rc.conf.d/node_exporter | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 sysutils/pfSense-pkg-node_exporter/files/usr/local/etc/rc.conf.d/node_exporter diff --git a/sysutils/node_exporter/Makefile b/sysutils/node_exporter/Makefile index d9cea12916ee..d1fa0b85bfab 100644 --- a/sysutils/node_exporter/Makefile +++ b/sysutils/node_exporter/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= node_exporter -PORTVERSION= 0.18.1 +PORTVERSION= 0.17.0 DISTVERSIONPREFIX=v PORTREVISION= 1 CATEGORIES= sysutils diff --git a/sysutils/pfSense-pkg-node_exporter/Makefile b/sysutils/pfSense-pkg-node_exporter/Makefile index 21c4731c5ecc..bf3b4f80ba2b 100644 --- a/sysutils/pfSense-pkg-node_exporter/Makefile +++ b/sysutils/pfSense-pkg-node_exporter/Makefile @@ -2,7 +2,6 @@ PORTNAME= pfSense-pkg-node_exporter PORTVERSION= 0.18.1 -PORTEPOCH= 1 CATEGORIES= sysutils MASTER_SITES= # empty DISTFILES= # empty @@ -13,7 +12,7 @@ COMMENT= pfSense package node_exporter LICENSE= APACHE20 -RUN_DEPENDS= ${LOCALBASE}/bin/node_exporter:sysutils/node_exporter +RUN_DEPENDS= node_exporter>0:sysutils/node_exporter NO_BUILD= yes NO_MTREE= yes diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/etc/rc.conf.d/node_exporter b/sysutils/pfSense-pkg-node_exporter/files/usr/local/etc/rc.conf.d/node_exporter deleted file mode 100644 index b50602361be4..000000000000 --- a/sysutils/pfSense-pkg-node_exporter/files/usr/local/etc/rc.conf.d/node_exporter +++ /dev/null @@ -1 +0,0 @@ -node_exporter_enable="NO" \ No newline at end of file From 6bec0ed2a45dc8fb36c14187f2d94714ca9b01f0 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Fri, 13 Dec 2019 01:03:13 +0100 Subject: [PATCH 3/4] Fix more review comments --- .../files/usr/local/pkg/node_exporter.inc | 15 +++++---------- .../interface-collector.py | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.inc b/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.inc index 407553b45dbd..1ceb2d315bf4 100644 --- a/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.inc +++ b/sysutils/pfSense-pkg-node_exporter/files/usr/local/pkg/node_exporter.inc @@ -38,14 +38,14 @@ function node_exporter_write_config($node_exporter_config) { $listen_addr = get_interface_ip($node_exporter_config["listen_iface"]); $listen_port = $node_exporter_config["listen_port"] ?: "9100"; - $txt .= "node_exporter_listen_address=\"" . $listen_addr . ":" . $listen_port . "\"\n"; + $txt .= "node_exporter_listen_address=\"{$listen_addr}:{$listen_port}\"\n"; $collectorTxt = ""; foreach (explode(",", $node_exporter_config["collectors"]) as $collector) { $collectorTxt .= " --collector.".$collector; } - $txt .= "node_exporter_args=\"". $collectorTxt ." " . $node_exporter_config["extra_flags"] . "\"\n"; + $txt .= "node_exporter_args=\"{$collectorTxt} {$node_exporter_config['extra_flags']}\"\n"; if (!file_put_contents(NODE_EXPORTER_CONFIG_FILE, $txt)) { log_error("ERROR: Could not open {" . NODE_EXPORTER_CONFIG_FILE . "} for writing"); @@ -60,12 +60,7 @@ function node_exporter_sync_config() { } $node_exporter_config = &$config['installedpackages']['nodeexporter']['config'][0]; - if (isset($node_exporter_config['enable'])) { - $enable = $node_exporter_config['enable']; - } else { - $enable = 'no'; - } - if ($enable !== 'on') { + if ($node_exporter_config['enable'] !== 'on') { unlink_if_exists(NODE_EXPORTER_RCFILE); return; } @@ -122,11 +117,11 @@ function node_exporter_deinstall_command() { function node_exporter_validate_form($post, &$input_errors) { if (empty($post['listen_iface'])) { - $input_errors[] = 'You must select an interface to listen to'; + $input_errors[] = gettext('You must select an interface to listen to'); } if (!is_port($post['listen_port'])) { - $input_errors[] = 'You must enter a valid port number in the \'Listen Port\' field'; + $input_errors[] = gettext('You must enter a valid port number in the \'Listen Port\' field'); } } diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/interface-collector.py b/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/interface-collector.py index ce4f3e90b8cd..2d1394324216 100644 --- a/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/interface-collector.py +++ b/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/interface-collector.py @@ -14,7 +14,7 @@ def __str__(self): def __repr__(self): return self.__str__() def add(self, val, **labelpairs): - lvs = ['{key}="{value}"'.format(key=key, value=value) for key,value in labelpairs.items()] + lvs = ['{key}="{value}"'.format(key=key, value=value) for key,value in list(labelpairs.items())] self.series.append('{name}{{{labels}}} {val}'.format(name=self.name, labels=','.join(lvs), val=val)) metrics = { @@ -32,5 +32,5 @@ def add(self, val, **labelpairs): metrics['info'].add(enabled, description=descr, interface=if_name, name=pf_name) textfile = open('/var/tmp/node_exporter/pfsense.prom','w') -textfile.write('\n'.join(str(m) for m in metrics.values())) +textfile.write('\n'.join(str(m) for m in list(metrics.values()))) textfile.write('\n') # Ensure trailing newline From 7e944fea50b1a18927d500897ee04b1476caad67 Mon Sep 17 00:00:00 2001 From: Calle Pettersson Date: Tue, 17 Dec 2019 13:59:46 +0100 Subject: [PATCH 4/4] Fix some more review comments --- sysutils/pfSense-pkg-node_exporter/Makefile | 4 +- .../node_exporter.sh | 68 ------------------- 2 files changed, 1 insertion(+), 71 deletions(-) delete mode 100644 sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/node_exporter.sh diff --git a/sysutils/pfSense-pkg-node_exporter/Makefile b/sysutils/pfSense-pkg-node_exporter/Makefile index bf3b4f80ba2b..e610a53608cd 100644 --- a/sysutils/pfSense-pkg-node_exporter/Makefile +++ b/sysutils/pfSense-pkg-node_exporter/Makefile @@ -13,6 +13,7 @@ COMMENT= pfSense package node_exporter LICENSE= APACHE20 RUN_DEPENDS= node_exporter>0:sysutils/node_exporter +USES= python NO_BUILD= yes NO_MTREE= yes @@ -25,13 +26,10 @@ do-extract: do-install: ${MKDIR} ${STAGEDIR}${PREFIX}/pkg - ${MKDIR} ${STAGEDIR}${PREFIX}/etc/rc.conf.d ${MKDIR} ${STAGEDIR}${DATADIR} ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/node_exporter.xml ${STAGEDIR}${PREFIX}/pkg ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/node_exporter.inc ${STAGEDIR}${PREFIX}/pkg - ${INSTALL_DATA} ${FILESDIR}${PREFIX}/etc/rc.conf.d/node_exporter ${STAGEDIR}${PREFIX}/etc/rc.conf.d/ ${INSTALL_DATA} ${FILESDIR}${DATADIR}/info.xml ${STAGEDIR}${DATADIR} - ${INSTALL_SCRIPT} ${FILESDIR}${DATADIR}/node_exporter.sh ${STAGEDIR}${DATADIR} ${INSTALL_SCRIPT} ${FILESDIR}${DATADIR}/interface-collector.py ${STAGEDIR}${DATADIR} @${REINPLACE_CMD} -i '' -e "s|%%PKGVERSION%%|${PKGVERSION}|" ${STAGEDIR}${DATADIR}/info.xml diff --git a/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/node_exporter.sh b/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/node_exporter.sh deleted file mode 100644 index c388105c9243..000000000000 --- a/sysutils/pfSense-pkg-node_exporter/files/usr/local/share/pfSense-pkg-node_exporter/node_exporter.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# PROVIDE: node_exporter -# REQUIRE: LOGIN -# KEYWORD: shutdown -# -# Add the following lines to /etc/rc.conf.local or /etc/rc.conf -# to enable this service: -# -# node_exporter_enable (bool): Set to NO by default. -# Set it to YES to enable node_exporter. -# node_exporter_user (string): Set user that node_exporter will run under -# Default is "nobody". -# node_exporter_group (string): Set group that node_exporter will run under -# Default is "nobody". -# node_exporter_args (string): Set extra arguments to pass to node_exporter -# Default is "". -# node_exporter_listen_address (string):Set ip:port that node_exporter will listen on -# Default is ":9100". -# node_exporter_textfile_dir (string): Set directory that node_exporter will watch -# Default is "/var/tmp/node_exporter". - -. /etc/rc.subr - -name=node_exporter -rcvar=node_exporter_enable - -load_rc_config $name - -: ${node_exporter_enable:="NO"} -: ${node_exporter_user:="nobody"} -: ${node_exporter_group:="nobody"} -: ${node_exporter_args:=""} -: ${node_exporter_listen_address:=":9100"} -: ${node_exporter_textfile_dir:="/var/tmp/node_exporter"} - - -pidfile=/var/run/node_exporter.pid -command="/usr/sbin/daemon" -procname="/usr/local/bin/node_exporter" -command_args="-p ${pidfile} -T ${name} \ - /usr/bin/env ${procname} \ - --web.listen-address=${node_exporter_listen_address} \ - --collector.textfile.directory=${node_exporter_textfile_dir} \ - ${node_exporter_args}" - -start_precmd=node_exporter_startprecmd - -node_exporter_startprecmd() -{ - if [ ! -e ${pidfile} ]; then - install \ - -o ${node_exporter_user} \ - -g ${node_exporter_group} \ - /dev/null ${pidfile}; - fi - if [ ! -d ${node_exporter_textfile_dir} ]; then - install \ - -d \ - -o ${node_exporter_user} \ - -g ${node_exporter_group} \ - -m 1755 \ - ${node_exporter_textfile_dir} - fi -} - -load_rc_config $name -run_rc_command "$1"