[3/3] Added new node_exporter 1.2.0 package.

Message ID 20210724185639.3469623-4-holger.sunke@posteo.de
State Dropped
Headers show
Series Reworked patches introducing node_exporter on master | expand

Commit Message

Holger Sunke July 24, 2021, 6:56 p.m. UTC
---
 config/node_exporter/node_exporter_options | 203 +++++++++++++++++++++
 config/rootfiles/packages/node_exporter    |   4 +
 lfs/node_exporter                          |  98 ++++++++++
 make.sh                                    |   1 +
 src/initscripts/packages/node_exporter     |  39 ++++
 src/paks/node_exporter/install.sh          |  31 ++++
 src/paks/node_exporter/uninstall.sh        |  30 +++
 src/paks/node_exporter/update.sh           |  27 +++
 src/scripts/node_exporter_starter.sh       |   7 +
 9 files changed, 440 insertions(+)
 create mode 100644 config/node_exporter/node_exporter_options
 create mode 100644 config/rootfiles/packages/node_exporter
 create mode 100644 lfs/node_exporter
 create mode 100644 src/initscripts/packages/node_exporter
 create mode 100644 src/paks/node_exporter/install.sh
 create mode 100644 src/paks/node_exporter/uninstall.sh
 create mode 100644 src/paks/node_exporter/update.sh
 create mode 100644 src/scripts/node_exporter_starter.sh

Comments

Michael Tremer July 26, 2021, 3:26 p.m. UTC | #1
Hello,

There are some minor issues left in here...

> On 24 Jul 2021, at 19:56, Holger Sunke <holger.sunke@posteo.de> wrote:
> 
> ---
> config/node_exporter/node_exporter_options | 203 +++++++++++++++++++++
> config/rootfiles/packages/node_exporter    |   4 +
> lfs/node_exporter                          |  98 ++++++++++
> make.sh                                    |   1 +
> src/initscripts/packages/node_exporter     |  39 ++++
> src/paks/node_exporter/install.sh          |  31 ++++
> src/paks/node_exporter/uninstall.sh        |  30 +++
> src/paks/node_exporter/update.sh           |  27 +++
> src/scripts/node_exporter_starter.sh       |   7 +
> 9 files changed, 440 insertions(+)
> create mode 100644 config/node_exporter/node_exporter_options
> create mode 100644 config/rootfiles/packages/node_exporter
> create mode 100644 lfs/node_exporter
> create mode 100644 src/initscripts/packages/node_exporter
> create mode 100644 src/paks/node_exporter/install.sh
> create mode 100644 src/paks/node_exporter/uninstall.sh
> create mode 100644 src/paks/node_exporter/update.sh
> create mode 100644 src/scripts/node_exporter_starter.sh
> 
> diff --git a/config/node_exporter/node_exporter_options b/config/node_exporter/node_exporter_options
> new file mode 100644
> index 000000000..f614b1102
> --- /dev/null
> +++ b/config/node_exporter/node_exporter_options
> @@ -0,0 +1,203 @@
> +# Customize node_exporter startup command line flags by editing OPTIONS below:
> +
> +export OPTIONS="--web.listen-address=:9100"
> +
> +#Flags:
> +#  -h, --help                     Show context-sensitive help (also try
> +#                                 --help-long and --help-man).
> +#      --collector.bcache.priorityStats  
> +#                                 Expose expensive priority stats.
> +#      --collector.cpu.info       Enables metric cpu_info
> +#      --collector.cpu.info.flags-include=COLLECTOR.CPU.INFO.FLAGS-INCLUDE  
> +#                                 Filter the `flags` field in cpuInfo with a
> +#                                 value that must be a regular expression
> +#      --collector.cpu.info.bugs-include=COLLECTOR.CPU.INFO.BUGS-INCLUDE  
> +#                                 Filter the `bugs` field in cpuInfo with a value
> +#                                 that must be a regular expression
> +#      --collector.diskstats.ignored-devices="^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"  
> +#                                 Regexp of devices to ignore for diskstats.
> +#      --collector.filesystem.ignored-mount-points="^/(dev|proc|sys|var/lib/docker/.+)($|/)"  
> +#                                 Regexp of mount points to ignore for filesystem
> +#                                 collector.
> +#      --collector.filesystem.ignored-fs-types="^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$"  
> +#                                 Regexp of filesystem types to ignore for
> +#                                 filesystem collector.
> +#      --collector.ipvs.backend-labels="local_address,local_port,remote_address,remote_port,proto,local_mark"  
> +#                                 Comma separated list for IPVS backend stats
> +#                                 labels.
> +#      --collector.netclass.ignored-devices="^$"  
> +#                                 Regexp of net devices to ignore for netclass
> +#                                 collector.
> +#      --collector.netdev.device-include=COLLECTOR.NETDEV.DEVICE-INCLUDE  
> +#                                 Regexp of net devices to include (mutually
> +#                                 exclusive to device-exclude).
> +#      --collector.netdev.device-exclude=COLLECTOR.NETDEV.DEVICE-EXCLUDE  
> +#                                 Regexp of net devices to exclude (mutually
> +#                                 exclusive to device-include).
> +#      --collector.netstat.fields="^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans)|Tcp_(ActiveOpens|InSegs|OutSegs|OutRsts|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$"  
> +#                                 Regexp of fields to return for netstat
> +#                                 collector.
> +#      --collector.ntp.server="127.0.0.1"  
> +#                                 NTP server to use for ntp collector
> +#      --collector.ntp.protocol-version=4  
> +#                                 NTP protocol version
> +#      --collector.ntp.server-is-local  
> +#                                 Certify that collector.ntp.server address is
> +#                                 not a public ntp server
> +#      --collector.ntp.ip-ttl=1   IP TTL to use while sending NTP query
> +#      --collector.ntp.max-distance=3.46608s  
> +#                                 Max accumulated distance to the root
> +#      --collector.ntp.local-offset-tolerance=1ms  
> +#                                 Offset between local clock and local ntpd time
> +#                                 to tolerate
> +#      --path.procfs="/proc"      procfs mountpoint.
> +#      --path.sysfs="/sys"        sysfs mountpoint.
> +#      --path.rootfs="/"          rootfs mountpoint.
> +#      --collector.perf.cpus=""   List of CPUs from which perf metrics should be
> +#                                 collected
> +#      --collector.perf.tracepoint=COLLECTOR.PERF.TRACEPOINT ...  
> +#                                 perf tracepoint that should be collected
> +#      --collector.powersupply.ignored-supplies="^$"  
> +#                                 Regexp of power supplies to ignore for
> +#                                 powersupplyclass collector.
> +#      --collector.qdisc.fixtures=""  
> +#                                 test fixtures to use for qdisc collector
> +#                                 end-to-end testing
> +#      --collector.runit.servicedir="/etc/service"  
> +#                                 Path to runit service directory.
> +#      --collector.supervisord.url="http://localhost:9001/RPC2"  
> +#                                 XML RPC endpoint.
> +#      --collector.systemd.unit-include=".+"  
> +#                                 Regexp of systemd units to include. Units must
> +#                                 both match include and not match exclude to be
> +#                                 included.
> +#      --collector.systemd.unit-exclude=".+\\.(automount|device|mount|scope|slice)"  
> +#                                 Regexp of systemd units to exclude. Units must
> +#                                 both match include and not match exclude to be
> +#                                 included.
> +#      --collector.systemd.enable-task-metrics  
> +#                                 Enables service unit tasks metrics
> +#                                 unit_tasks_current and unit_tasks_max
> +#      --collector.systemd.enable-restarts-metrics  
> +#                                 Enables service unit metric
> +#                                 service_restart_total
> +#      --collector.systemd.enable-start-time-metrics  
> +#                                 Enables service unit metric
> +#                                 unit_start_time_seconds
> +#      --collector.textfile.directory=""  
> +#                                 Directory to read text files with metrics from.
> +#      --collector.vmstat.fields="^(oom_kill|pgpg|pswp|pg.*fault).*"  
> +#                                 Regexp of fields to return for vmstat
> +#                                 collector.
> +#      --collector.wifi.fixtures=""  
> +#                                 test fixtures to use for wifi collector metrics
> +#      --collector.arp            Enable the arp collector (default: enabled).
> +#      --collector.bcache         Enable the bcache collector (default: enabled).
> +#      --collector.bonding        Enable the bonding collector (default:
> +#                                 enabled).
> +#      --collector.btrfs          Enable the btrfs collector (default: enabled).
> +#      --collector.buddyinfo      Enable the buddyinfo collector (default:
> +#                                 disabled).
> +#      --collector.conntrack      Enable the conntrack collector (default:
> +#                                 enabled).
> +#      --collector.cpu            Enable the cpu collector (default: enabled).
> +#      --collector.cpufreq        Enable the cpufreq collector (default:
> +#                                 enabled).
> +#      --collector.diskstats      Enable the diskstats collector (default:
> +#                                 enabled).
> +#      --collector.drbd           Enable the drbd collector (default: disabled).
> +#      --collector.edac           Enable the edac collector (default: enabled).
> +#      --collector.entropy        Enable the entropy collector (default:
> +#                                 enabled).
> +#      --collector.fibrechannel   Enable the fibrechannel collector (default:
> +#                                 enabled).
> +#      --collector.filefd         Enable the filefd collector (default: enabled).
> +#      --collector.filesystem     Enable the filesystem collector (default:
> +#                                 enabled).
> +#      --collector.hwmon          Enable the hwmon collector (default: enabled).
> +#      --collector.infiniband     Enable the infiniband collector (default:
> +#                                 enabled).
> +#      --collector.interrupts     Enable the interrupts collector (default:
> +#                                 disabled).
> +#      --collector.ipvs           Enable the ipvs collector (default: enabled).
> +#      --collector.ksmd           Enable the ksmd collector (default: disabled).
> +#      --collector.loadavg        Enable the loadavg collector (default:
> +#                                 enabled).
> +#      --collector.logind         Enable the logind collector (default:
> +#                                 disabled).
> +#      --collector.mdadm          Enable the mdadm collector (default: enabled).
> +#      --collector.meminfo        Enable the meminfo collector (default:
> +#                                 enabled).
> +#      --collector.meminfo_numa   Enable the meminfo_numa collector (default:
> +#                                 disabled).
> +#      --collector.mountstats     Enable the mountstats collector (default:
> +#                                 disabled).
> +#      --collector.netclass       Enable the netclass collector (default:
> +#                                 enabled).
> +#      --collector.netdev         Enable the netdev collector (default: enabled).
> +#      --collector.netstat        Enable the netstat collector (default:
> +#                                 enabled).
> +#      --collector.network_route  Enable the network_route collector (default:
> +#                                 disabled).
> +#      --collector.nfs            Enable the nfs collector (default: enabled).
> +#      --collector.nfsd           Enable the nfsd collector (default: enabled).
> +#      --collector.ntp            Enable the ntp collector (default: disabled).
> +#      --collector.perf           Enable the perf collector (default: disabled).
> +#      --collector.powersupplyclass  
> +#                                 Enable the powersupplyclass collector (default:
> +#                                 enabled).
> +#      --collector.pressure       Enable the pressure collector (default:
> +#                                 enabled).
> +#      --collector.processes      Enable the processes collector (default:
> +#                                 disabled).
> +#      --collector.qdisc          Enable the qdisc collector (default: disabled).
> +#      --collector.rapl           Enable the rapl collector (default: enabled).
> +#      --collector.runit          Enable the runit collector (default: disabled).
> +#      --collector.schedstat      Enable the schedstat collector (default:
> +#                                 enabled).
> +#      --collector.sockstat       Enable the sockstat collector (default:
> +#                                 enabled).
> +#      --collector.softnet        Enable the softnet collector (default:
> +#                                 enabled).
> +#      --collector.stat           Enable the stat collector (default: enabled).
> +#      --collector.supervisord    Enable the supervisord collector (default:
> +#                                 disabled).
> +#      --collector.systemd        Enable the systemd collector (default:
> +#                                 disabled).
> +#      --collector.tcpstat        Enable the tcpstat collector (default:
> +#                                 disabled).
> +#      --collector.textfile       Enable the textfile collector (default:
> +#                                 enabled).
> +#      --collector.thermal_zone   Enable the thermal_zone collector (default:
> +#                                 enabled).
> +#      --collector.time           Enable the time collector (default: enabled).
> +#      --collector.timex          Enable the timex collector (default: enabled).
> +#      --collector.udp_queues     Enable the udp_queues collector (default:
> +#                                 enabled).
> +#      --collector.uname          Enable the uname collector (default: enabled).
> +#      --collector.vmstat         Enable the vmstat collector (default: enabled).
> +#      --collector.wifi           Enable the wifi collector (default: disabled).
> +#      --collector.xfs            Enable the xfs collector (default: enabled).
> +#      --collector.zfs            Enable the zfs collector (default: enabled).
> +#      --collector.zoneinfo       Enable the zoneinfo collector (default:
> +#                                 disabled).
> +#      --web.listen-address=":9100"  
> +#                                 Address on which to expose metrics and web
> +#                                 interface.
> +#      --web.telemetry-path="/metrics"  
> +#                                 Path under which to expose metrics.
> +#      --web.disable-exporter-metrics  
> +#                                 Exclude metrics about the exporter itself
> +#                                 (promhttp_*, process_*, go_*).
> +#      --web.max-requests=40      Maximum number of parallel scrape requests. Use
> +#                                 0 to disable.
> +#      --collector.disable-defaults  
> +#                                 Set all collectors to disabled by default.
> +#      --web.config=""            [EXPERIMENTAL] Path to config yaml file that
> +#                                 can enable TLS or authentication.
> +#      --log.level=info           Only log messages with the given severity or
> +#                                 above. One of: [debug, info, warn, error]
> +#      --log.format=logfmt        Output format of log messages. One of: [logfmt,
> +#                                 json]
> +#      --version                  Show application version.
> +
> diff --git a/config/rootfiles/packages/node_exporter b/config/rootfiles/packages/node_exporter
> new file mode 100644
> index 000000000..d20fb58a4
> --- /dev/null
> +++ b/config/rootfiles/packages/node_exporter
> @@ -0,0 +1,4 @@
> +usr/bin/node_exporter
> +usr/bin/node_exporter_starter.sh
> +etc/node_exporter_options
> +etc/rc.d/init.d/node_exporter
> diff --git a/lfs/node_exporter b/lfs/node_exporter
> new file mode 100644
> index 000000000..2d9ffb916
> --- /dev/null
> +++ b/lfs/node_exporter
> @@ -0,0 +1,98 @@
> +##############################################################################
> +#                                                                             #
> +# IPFire.org - A linux based firewall                                         #
> +# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
> +#                                                                             #
> +# This program is free software: you can redistribute it and/or modify        #
> +# it under the terms of the GNU General Public License as published by        #
> +# the Free Software Foundation, either version 3 of the License, or           #
> +# (at your option) any later version.                                         #
> +#                                                                             #
> +# This program is distributed in the hope that it will be useful,             #
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
> +# GNU General Public License for more details.                                #
> +#                                                                             #
> +# You should have received a copy of the GNU General Public License           #
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
> +#                                                                             #
> +###############################################################################
> +
> +###############################################################################
> +# Definitions
> +###############################################################################
> +
> +include Config
> +
> +VER        = 1.2.0
> +
> +THISAPP    = node_exporter-$(VER)
> +DL_FILE    = $(THISAPP).tar.gz
> +DL_FROM    = https://github.com/prometheus/node_exporter/archive/v$(VER)/

DL_FROM should point to our server (I believe that is URL_IPFIRE)

> +DIR_APP    = $(DIR_SRC)/$(THISAPP)
> +TARGET     = $(DIR_INFO)/$(THISAPP)
> +SUP_ARCH   = x86_64 i586 aarch64 armv5tel
> +PROG       = node_exporter
> +PAK_VER    = 1
> +
> +DEPS       = ""
> +
> +###############################################################################
> +# Top-level Rules
> +###############################################################################
> +
> +objects = $(DL_FILE)
> +
> +$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
> +
> +$(DL_FILE)_MD5 = 54a096edcaa0a3e1100573d603864fa6
> +
> +install : $(TARGET)
> +check : $(patsubst %,$(DIR_CHK)/%,$(objects))
> +
> +download : $(patsubst %,$(DIR_DL)/%,$(objects))
> +
> +md5 : $(subst %,%_MD5,$(objects))
> +
> +dist :
> +	@$(PAK)
> +
> +###############################################################################
> +# Downloading, checking, md5sum
> +###############################################################################
> +
> +$(patsubst %,$(DIR_CHK)/%,$(objects)) :
> +	@$(CHECK)
> +
> +$(patsubst %,$(DIR_DL)/%,$(objects)) :
> +	@$(LOAD)
> +
> +$(subst %,%_MD5,$(objects)) :
> +	@$(MD5)
> +
> +###############################################################################
> +# Installation Details
> +###############################################################################
> +
> +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
> +	@$(PREBUILD)
> +	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
> +	cd $(DIR_APP) && make build $(MAKETUNING) $(EXTRA_MAKE)
> +
> +	# install compiled binary
> +	cd $(DIR_APP) && cp node_exporter /usr/bin
> +
> +	# install configuration file
> +	install -v -m 644 $(DIR_SRC)/config/node_exporter/node_exporter_options \
> +		/etc/node_exporter_options
> +
> +	# install startup script
> +	install -v -m 744 $(DIR_SRC)/src/scripts/node_exporter_starter.sh \
> +		/usr/bin/node_exporter_starter.sh
> +
> +	# install initscript
> +	$(call INSTALL_INITSCRIPT,node_exporter)
> +
> +	@rm -rf $(DIR_APP)
> +	@$(POSTBUILD)
> +
> diff --git a/make.sh b/make.sh
> index 83bd9faeb..3dcfaf1db 100755
> --- a/make.sh
> +++ b/make.sh
> @@ -1624,6 +1624,7 @@ buildipfire() {
>   lfsmake2 socat
>   lfsmake2 libcdada
>   lfsmake2 pmacct
> +  lfsmake2 node_exporter
> }
> 
> buildinstaller() {
> diff --git a/src/initscripts/packages/node_exporter b/src/initscripts/packages/node_exporter
> new file mode 100644
> index 000000000..b26caaab9
> --- /dev/null
> +++ b/src/initscripts/packages/node_exporter
> @@ -0,0 +1,39 @@
> +#!/bin/sh
> +########################################################################
> +# Begin $rc_base/init.d/
> +#
> +# Description : Prometheus Node Exporter daemon
> +#
> +########################################################################
> +
> +. /etc/sysconfig/rc
> +. ${rc_functions}
> +
> +case "${1}" in
> +	start)
> +		boot_mesg "Starting..."

There is a description missing here. It should probably read like “Starting Node Exporter…"

> +		loadproc /usr/bin/node_exporter_starter.sh
> +		;;
> +
> +	stop)
> +		boot_mesg "Stopping..."

Likewise.

> +		killproc /usr/bin/node_exporter
> +		;;
> +
> +	restart)
> +		${0} stop
> +		sleep 1
> +		${0} start
> +		;;
> +
> +	status)
> +		statusproc /usr/bin/node_exporter
> +		;;
> +
> +	*)
> +		echo "Usage: ${0} {start|stop|restart|status}"
> +		exit 1
> +		;;
> +esac
> +
> +# End $rc_base/init.d/
> diff --git a/src/paks/node_exporter/install.sh b/src/paks/node_exporter/install.sh
> new file mode 100644
> index 000000000..e9272d7cb
> --- /dev/null
> +++ b/src/paks/node_exporter/install.sh
> @@ -0,0 +1,31 @@
> +#!/bin/bash
> +############################################################################
> +#                                                                          #
> +# This file is part of the IPFire Firewall.                                #
> +#                                                                          #
> +# IPFire is free software; you can redistribute it and/or modify           #
> +# it under the terms of the GNU General Public License as published by     #
> +# the Free Software Foundation; either version 2 of the License, or        #
> +# (at your option) any later version.                                      #
> +#                                                                          #
> +# IPFire is distributed in the hope that it will be useful,                #
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
> +# GNU General Public License for more details.                             #
> +#                                                                          #
> +# You should have received a copy of the GNU General Public License        #
> +# along with IPFire; if not, write to the Free Software                    #
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
> +#                                                                          #
> +# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
> +#                                                                          #
> +############################################################################
> +#
> +. /opt/pakfire/lib/functions.sh
> +extract_files
> +restore_backup ${NAME}
> +start_service --background ${NAME}
> +
> +ln -svf  ../init.d/node_exporter /etc/rc.d/rc0.d/K30node_exporter
> +ln -svf  ../init.d/node_exporter /etc/rc.d/rc3.d/S40node_exporter
> +ln -svf  ../init.d/node_exporter /etc/rc.d/rc6.d/K30node_exporter
> diff --git a/src/paks/node_exporter/uninstall.sh b/src/paks/node_exporter/uninstall.sh
> new file mode 100644
> index 000000000..710baf8b4
> --- /dev/null
> +++ b/src/paks/node_exporter/uninstall.sh
> @@ -0,0 +1,30 @@
> +#!/bin/bash
> +############################################################################
> +#                                                                          #
> +# This file is part of the IPFire Firewall.                                #
> +#                                                                          #
> +# IPFire is free software; you can redistribute it and/or modify           #
> +# it under the terms of the GNU General Public License as published by     #
> +# the Free Software Foundation; either version 2 of the License, or        #
> +# (at your option) any later version.                                      #
> +#                                                                          #
> +# IPFire is distributed in the hope that it will be useful,                #
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
> +# GNU General Public License for more details.                             #
> +#                                                                          #
> +# You should have received a copy of the GNU General Public License        #
> +# along with IPFire; if not, write to the Free Software                    #
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
> +#                                                                          #
> +# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
> +#                                                                          #
> +############################################################################
> +#
> +. /opt/pakfire/lib/functions.sh
> +/etc/init.d/node_exporter stop
> +make_backup ${NAME}
> +remove_files
> +
> +rm -rfv /etc/rc.d/rc*.d/*node_exporter
> +
> diff --git a/src/paks/node_exporter/update.sh b/src/paks/node_exporter/update.sh
> new file mode 100644
> index 000000000..99776659c
> --- /dev/null
> +++ b/src/paks/node_exporter/update.sh
> @@ -0,0 +1,27 @@
> +#!/bin/bash
> +############################################################################
> +#                                                                          #
> +# This file is part of the IPFire Firewall.                                #
> +#                                                                          #
> +# IPFire is free software; you can redistribute it and/or modify           #
> +# it under the terms of the GNU General Public License as published by     #
> +# the Free Software Foundation; either version 2 of the License, or        #
> +# (at your option) any later version.                                      #
> +#                                                                          #
> +# IPFire is distributed in the hope that it will be useful,                #
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
> +# GNU General Public License for more details.                             #
> +#                                                                          #
> +# You should have received a copy of the GNU General Public License        #
> +# along with IPFire; if not, write to the Free Software                    #
> +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
> +#                                                                          #
> +# Copyright (C) 2007-2020 IPFire-Team <info@ipfire.org>.                   #
> +#                                                                          #
> +############################################################################
> +#
> +. /opt/pakfire/lib/functions.sh
> +extract_backup_includes
> +./uninstall.sh
> +./install.sh
> diff --git a/src/scripts/node_exporter_starter.sh b/src/scripts/node_exporter_starter.sh
> new file mode 100644
> index 000000000..ec6d3582b
> --- /dev/null
> +++ b/src/scripts/node_exporter_starter.sh
> @@ -0,0 +1,7 @@
> +#/bin/bash
> +
> +# read configurable OPTIONS
> +. /etc/node_exporter_options
> +
> +/usr/bin/node_exporter $OPTIONS >> /var/log/node_exporter.log 2>&1 &
> +
> -- 
> 2.30.2
> 

What is this for again?

-Michael
Holger Sunke July 26, 2021, 7:27 p.m. UTC | #2
>> +++ b/src/initscripts/packages/node_exporter
>> @@ -0,0 +1,39 @@
>> +#!/bin/sh
>> +########################################################################
>> +# Begin $rc_base/init.d/
>> +#
99>> +++ b/src/scripts/node_exporter_starter.sh
>> @@ -0,0 +1,7 @@
>> +#/bin/bash
>> +
>> +# read configurable OPTIONS
>> +. /etc/node_exporter_options
>> +
>> +/usr/bin/node_exporter $OPTIONS >> /var/log/node_exporter.log 2>&1 &
>> +
>> -- 
>> 2.30.2
>>
> 
> What is this for again?
> 
> -Michael
> 
> 


The script above is a workaround for the issue that node_exporter does 
not have a fork functionality - we wrote about this earlier:


 > Hello,

 >> On 9 Jun 2021, at 07:14, Holger Sunke <holger.sunke@posteo.de> wrote:
 >>
 >> Hello Michael,
 >>
 >> the node exporter does not have a daemon mode.
 >> I could alternatively pip the output into a log file:
 >>
 >> loadproc /usr/bin/node_exporter $OPTIONS >> 
/var/log/node_exporter.log 2>&1 &

 > Hmm, so there are two problems here:

 >* loadproc shows [ OK ] or [ ERROR ] so that the user knows if the > 
program was started successfully. That is now being thrown away.

 > * Anything useful that node_exporter would print is also being thrown 
away

 > This seems to become a common thing that they remove the fork mode, 
maybe we need a special version of loadproc() that can handle that.

 > Should I add a third patch to do my fixes or adjust patch 1 & 2 each?

 > Let’s work on Go first and get that merged and then come back to this 
one.

 > We need to have a solution first and then implement it.

 > -Michael
Michael Tremer July 27, 2021, 9 a.m. UTC | #3
Hello Holger,

Yeah, I did remember and I think we should have a generic solution to avoid adding many scripts of this style.

I just sent a patch for testing. Could you please check if this works for you?

  https://patchwork.ipfire.org/project/ipfire/patch/20210727085900.2253-1-michael.tremer@ipfire.org/

Best,
-Michael

> On 26 Jul 2021, at 20:27, Holger Sunke <holger.sunke@posteo.de> wrote:
> 
> 
>>> +++ b/src/initscripts/packages/node_exporter
>>> @@ -0,0 +1,39 @@
>>> +#!/bin/sh
>>> +########################################################################
>>> +# Begin $rc_base/init.d/
>>> +#
> 99>> +++ b/src/scripts/node_exporter_starter.sh
>>> @@ -0,0 +1,7 @@
>>> +#/bin/bash
>>> +
>>> +# read configurable OPTIONS
>>> +. /etc/node_exporter_options
>>> +
>>> +/usr/bin/node_exporter $OPTIONS >> /var/log/node_exporter.log 2>&1 &
>>> +
>>> -- 
>>> 2.30.2
>>> 
>> What is this for again?
>> -Michael
> 
> 
> The script above is a workaround for the issue that node_exporter does not have a fork functionality - we wrote about this earlier:
> 
> 
> > Hello,
> 
> >> On 9 Jun 2021, at 07:14, Holger Sunke <holger.sunke@posteo.de> wrote:
> >>
> >> Hello Michael,
> >>
> >> the node exporter does not have a daemon mode.
> >> I could alternatively pip the output into a log file:
> >>
> >> loadproc /usr/bin/node_exporter $OPTIONS >> /var/log/node_exporter.log 2>&1 &
> 
> > Hmm, so there are two problems here:
> 
> >* loadproc shows [ OK ] or [ ERROR ] so that the user knows if the > program was started successfully. That is now being thrown away.
> 
> > * Anything useful that node_exporter would print is also being thrown away
> 
> > This seems to become a common thing that they remove the fork mode, maybe we need a special version of loadproc() that can handle that.
> 
> > Should I add a third patch to do my fixes or adjust patch 1 & 2 each?
> 
> > Let’s work on Go first and get that merged and then come back to this one.
> 
> > We need to have a solution first and then implement it.
> 
> > -Michael
>

Patch

diff --git a/config/node_exporter/node_exporter_options b/config/node_exporter/node_exporter_options
new file mode 100644
index 000000000..f614b1102
--- /dev/null
+++ b/config/node_exporter/node_exporter_options
@@ -0,0 +1,203 @@ 
+# Customize node_exporter startup command line flags by editing OPTIONS below:
+
+export OPTIONS="--web.listen-address=:9100"
+
+#Flags:
+#  -h, --help                     Show context-sensitive help (also try
+#                                 --help-long and --help-man).
+#      --collector.bcache.priorityStats  
+#                                 Expose expensive priority stats.
+#      --collector.cpu.info       Enables metric cpu_info
+#      --collector.cpu.info.flags-include=COLLECTOR.CPU.INFO.FLAGS-INCLUDE  
+#                                 Filter the `flags` field in cpuInfo with a
+#                                 value that must be a regular expression
+#      --collector.cpu.info.bugs-include=COLLECTOR.CPU.INFO.BUGS-INCLUDE  
+#                                 Filter the `bugs` field in cpuInfo with a value
+#                                 that must be a regular expression
+#      --collector.diskstats.ignored-devices="^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"  
+#                                 Regexp of devices to ignore for diskstats.
+#      --collector.filesystem.ignored-mount-points="^/(dev|proc|sys|var/lib/docker/.+)($|/)"  
+#                                 Regexp of mount points to ignore for filesystem
+#                                 collector.
+#      --collector.filesystem.ignored-fs-types="^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$"  
+#                                 Regexp of filesystem types to ignore for
+#                                 filesystem collector.
+#      --collector.ipvs.backend-labels="local_address,local_port,remote_address,remote_port,proto,local_mark"  
+#                                 Comma separated list for IPVS backend stats
+#                                 labels.
+#      --collector.netclass.ignored-devices="^$"  
+#                                 Regexp of net devices to ignore for netclass
+#                                 collector.
+#      --collector.netdev.device-include=COLLECTOR.NETDEV.DEVICE-INCLUDE  
+#                                 Regexp of net devices to include (mutually
+#                                 exclusive to device-exclude).
+#      --collector.netdev.device-exclude=COLLECTOR.NETDEV.DEVICE-EXCLUDE  
+#                                 Regexp of net devices to exclude (mutually
+#                                 exclusive to device-include).
+#      --collector.netstat.fields="^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans)|Tcp_(ActiveOpens|InSegs|OutSegs|OutRsts|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$"  
+#                                 Regexp of fields to return for netstat
+#                                 collector.
+#      --collector.ntp.server="127.0.0.1"  
+#                                 NTP server to use for ntp collector
+#      --collector.ntp.protocol-version=4  
+#                                 NTP protocol version
+#      --collector.ntp.server-is-local  
+#                                 Certify that collector.ntp.server address is
+#                                 not a public ntp server
+#      --collector.ntp.ip-ttl=1   IP TTL to use while sending NTP query
+#      --collector.ntp.max-distance=3.46608s  
+#                                 Max accumulated distance to the root
+#      --collector.ntp.local-offset-tolerance=1ms  
+#                                 Offset between local clock and local ntpd time
+#                                 to tolerate
+#      --path.procfs="/proc"      procfs mountpoint.
+#      --path.sysfs="/sys"        sysfs mountpoint.
+#      --path.rootfs="/"          rootfs mountpoint.
+#      --collector.perf.cpus=""   List of CPUs from which perf metrics should be
+#                                 collected
+#      --collector.perf.tracepoint=COLLECTOR.PERF.TRACEPOINT ...  
+#                                 perf tracepoint that should be collected
+#      --collector.powersupply.ignored-supplies="^$"  
+#                                 Regexp of power supplies to ignore for
+#                                 powersupplyclass collector.
+#      --collector.qdisc.fixtures=""  
+#                                 test fixtures to use for qdisc collector
+#                                 end-to-end testing
+#      --collector.runit.servicedir="/etc/service"  
+#                                 Path to runit service directory.
+#      --collector.supervisord.url="http://localhost:9001/RPC2"  
+#                                 XML RPC endpoint.
+#      --collector.systemd.unit-include=".+"  
+#                                 Regexp of systemd units to include. Units must
+#                                 both match include and not match exclude to be
+#                                 included.
+#      --collector.systemd.unit-exclude=".+\\.(automount|device|mount|scope|slice)"  
+#                                 Regexp of systemd units to exclude. Units must
+#                                 both match include and not match exclude to be
+#                                 included.
+#      --collector.systemd.enable-task-metrics  
+#                                 Enables service unit tasks metrics
+#                                 unit_tasks_current and unit_tasks_max
+#      --collector.systemd.enable-restarts-metrics  
+#                                 Enables service unit metric
+#                                 service_restart_total
+#      --collector.systemd.enable-start-time-metrics  
+#                                 Enables service unit metric
+#                                 unit_start_time_seconds
+#      --collector.textfile.directory=""  
+#                                 Directory to read text files with metrics from.
+#      --collector.vmstat.fields="^(oom_kill|pgpg|pswp|pg.*fault).*"  
+#                                 Regexp of fields to return for vmstat
+#                                 collector.
+#      --collector.wifi.fixtures=""  
+#                                 test fixtures to use for wifi collector metrics
+#      --collector.arp            Enable the arp collector (default: enabled).
+#      --collector.bcache         Enable the bcache collector (default: enabled).
+#      --collector.bonding        Enable the bonding collector (default:
+#                                 enabled).
+#      --collector.btrfs          Enable the btrfs collector (default: enabled).
+#      --collector.buddyinfo      Enable the buddyinfo collector (default:
+#                                 disabled).
+#      --collector.conntrack      Enable the conntrack collector (default:
+#                                 enabled).
+#      --collector.cpu            Enable the cpu collector (default: enabled).
+#      --collector.cpufreq        Enable the cpufreq collector (default:
+#                                 enabled).
+#      --collector.diskstats      Enable the diskstats collector (default:
+#                                 enabled).
+#      --collector.drbd           Enable the drbd collector (default: disabled).
+#      --collector.edac           Enable the edac collector (default: enabled).
+#      --collector.entropy        Enable the entropy collector (default:
+#                                 enabled).
+#      --collector.fibrechannel   Enable the fibrechannel collector (default:
+#                                 enabled).
+#      --collector.filefd         Enable the filefd collector (default: enabled).
+#      --collector.filesystem     Enable the filesystem collector (default:
+#                                 enabled).
+#      --collector.hwmon          Enable the hwmon collector (default: enabled).
+#      --collector.infiniband     Enable the infiniband collector (default:
+#                                 enabled).
+#      --collector.interrupts     Enable the interrupts collector (default:
+#                                 disabled).
+#      --collector.ipvs           Enable the ipvs collector (default: enabled).
+#      --collector.ksmd           Enable the ksmd collector (default: disabled).
+#      --collector.loadavg        Enable the loadavg collector (default:
+#                                 enabled).
+#      --collector.logind         Enable the logind collector (default:
+#                                 disabled).
+#      --collector.mdadm          Enable the mdadm collector (default: enabled).
+#      --collector.meminfo        Enable the meminfo collector (default:
+#                                 enabled).
+#      --collector.meminfo_numa   Enable the meminfo_numa collector (default:
+#                                 disabled).
+#      --collector.mountstats     Enable the mountstats collector (default:
+#                                 disabled).
+#      --collector.netclass       Enable the netclass collector (default:
+#                                 enabled).
+#      --collector.netdev         Enable the netdev collector (default: enabled).
+#      --collector.netstat        Enable the netstat collector (default:
+#                                 enabled).
+#      --collector.network_route  Enable the network_route collector (default:
+#                                 disabled).
+#      --collector.nfs            Enable the nfs collector (default: enabled).
+#      --collector.nfsd           Enable the nfsd collector (default: enabled).
+#      --collector.ntp            Enable the ntp collector (default: disabled).
+#      --collector.perf           Enable the perf collector (default: disabled).
+#      --collector.powersupplyclass  
+#                                 Enable the powersupplyclass collector (default:
+#                                 enabled).
+#      --collector.pressure       Enable the pressure collector (default:
+#                                 enabled).
+#      --collector.processes      Enable the processes collector (default:
+#                                 disabled).
+#      --collector.qdisc          Enable the qdisc collector (default: disabled).
+#      --collector.rapl           Enable the rapl collector (default: enabled).
+#      --collector.runit          Enable the runit collector (default: disabled).
+#      --collector.schedstat      Enable the schedstat collector (default:
+#                                 enabled).
+#      --collector.sockstat       Enable the sockstat collector (default:
+#                                 enabled).
+#      --collector.softnet        Enable the softnet collector (default:
+#                                 enabled).
+#      --collector.stat           Enable the stat collector (default: enabled).
+#      --collector.supervisord    Enable the supervisord collector (default:
+#                                 disabled).
+#      --collector.systemd        Enable the systemd collector (default:
+#                                 disabled).
+#      --collector.tcpstat        Enable the tcpstat collector (default:
+#                                 disabled).
+#      --collector.textfile       Enable the textfile collector (default:
+#                                 enabled).
+#      --collector.thermal_zone   Enable the thermal_zone collector (default:
+#                                 enabled).
+#      --collector.time           Enable the time collector (default: enabled).
+#      --collector.timex          Enable the timex collector (default: enabled).
+#      --collector.udp_queues     Enable the udp_queues collector (default:
+#                                 enabled).
+#      --collector.uname          Enable the uname collector (default: enabled).
+#      --collector.vmstat         Enable the vmstat collector (default: enabled).
+#      --collector.wifi           Enable the wifi collector (default: disabled).
+#      --collector.xfs            Enable the xfs collector (default: enabled).
+#      --collector.zfs            Enable the zfs collector (default: enabled).
+#      --collector.zoneinfo       Enable the zoneinfo collector (default:
+#                                 disabled).
+#      --web.listen-address=":9100"  
+#                                 Address on which to expose metrics and web
+#                                 interface.
+#      --web.telemetry-path="/metrics"  
+#                                 Path under which to expose metrics.
+#      --web.disable-exporter-metrics  
+#                                 Exclude metrics about the exporter itself
+#                                 (promhttp_*, process_*, go_*).
+#      --web.max-requests=40      Maximum number of parallel scrape requests. Use
+#                                 0 to disable.
+#      --collector.disable-defaults  
+#                                 Set all collectors to disabled by default.
+#      --web.config=""            [EXPERIMENTAL] Path to config yaml file that
+#                                 can enable TLS or authentication.
+#      --log.level=info           Only log messages with the given severity or
+#                                 above. One of: [debug, info, warn, error]
+#      --log.format=logfmt        Output format of log messages. One of: [logfmt,
+#                                 json]
+#      --version                  Show application version.
+
diff --git a/config/rootfiles/packages/node_exporter b/config/rootfiles/packages/node_exporter
new file mode 100644
index 000000000..d20fb58a4
--- /dev/null
+++ b/config/rootfiles/packages/node_exporter
@@ -0,0 +1,4 @@ 
+usr/bin/node_exporter
+usr/bin/node_exporter_starter.sh
+etc/node_exporter_options
+etc/rc.d/init.d/node_exporter
diff --git a/lfs/node_exporter b/lfs/node_exporter
new file mode 100644
index 000000000..2d9ffb916
--- /dev/null
+++ b/lfs/node_exporter
@@ -0,0 +1,98 @@ 
+##############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER        = 1.2.0
+
+THISAPP    = node_exporter-$(VER)
+DL_FILE    = $(THISAPP).tar.gz
+DL_FROM    = https://github.com/prometheus/node_exporter/archive/v$(VER)/
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+TARGET     = $(DIR_INFO)/$(THISAPP)
+SUP_ARCH   = x86_64 i586 aarch64 armv5tel
+PROG       = node_exporter
+PAK_VER    = 1
+
+DEPS       = ""
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = 54a096edcaa0a3e1100573d603864fa6
+
+install : $(TARGET)
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download : $(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+dist :
+	@$(PAK)
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+	@$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+	@$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+	@$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+	@$(PREBUILD)
+	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+	cd $(DIR_APP) && make build $(MAKETUNING) $(EXTRA_MAKE)
+
+	# install compiled binary
+	cd $(DIR_APP) && cp node_exporter /usr/bin
+
+	# install configuration file
+	install -v -m 644 $(DIR_SRC)/config/node_exporter/node_exporter_options \
+		/etc/node_exporter_options
+
+	# install startup script
+	install -v -m 744 $(DIR_SRC)/src/scripts/node_exporter_starter.sh \
+		/usr/bin/node_exporter_starter.sh
+
+	# install initscript
+	$(call INSTALL_INITSCRIPT,node_exporter)
+
+	@rm -rf $(DIR_APP)
+	@$(POSTBUILD)
+
diff --git a/make.sh b/make.sh
index 83bd9faeb..3dcfaf1db 100755
--- a/make.sh
+++ b/make.sh
@@ -1624,6 +1624,7 @@  buildipfire() {
   lfsmake2 socat
   lfsmake2 libcdada
   lfsmake2 pmacct
+  lfsmake2 node_exporter
 }
 
 buildinstaller() {
diff --git a/src/initscripts/packages/node_exporter b/src/initscripts/packages/node_exporter
new file mode 100644
index 000000000..b26caaab9
--- /dev/null
+++ b/src/initscripts/packages/node_exporter
@@ -0,0 +1,39 @@ 
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/
+#
+# Description : Prometheus Node Exporter daemon
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+	start)
+		boot_mesg "Starting..."
+		loadproc /usr/bin/node_exporter_starter.sh
+		;;
+
+	stop)
+		boot_mesg "Stopping..."
+		killproc /usr/bin/node_exporter
+		;;
+
+	restart)
+		${0} stop
+		sleep 1
+		${0} start
+		;;
+
+	status)
+		statusproc /usr/bin/node_exporter
+		;;
+
+	*)
+		echo "Usage: ${0} {start|stop|restart|status}"
+		exit 1
+		;;
+esac
+
+# End $rc_base/init.d/
diff --git a/src/paks/node_exporter/install.sh b/src/paks/node_exporter/install.sh
new file mode 100644
index 000000000..e9272d7cb
--- /dev/null
+++ b/src/paks/node_exporter/install.sh
@@ -0,0 +1,31 @@ 
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+extract_files
+restore_backup ${NAME}
+start_service --background ${NAME}
+
+ln -svf  ../init.d/node_exporter /etc/rc.d/rc0.d/K30node_exporter
+ln -svf  ../init.d/node_exporter /etc/rc.d/rc3.d/S40node_exporter
+ln -svf  ../init.d/node_exporter /etc/rc.d/rc6.d/K30node_exporter
diff --git a/src/paks/node_exporter/uninstall.sh b/src/paks/node_exporter/uninstall.sh
new file mode 100644
index 000000000..710baf8b4
--- /dev/null
+++ b/src/paks/node_exporter/uninstall.sh
@@ -0,0 +1,30 @@ 
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2007 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+/etc/init.d/node_exporter stop
+make_backup ${NAME}
+remove_files
+
+rm -rfv /etc/rc.d/rc*.d/*node_exporter
+
diff --git a/src/paks/node_exporter/update.sh b/src/paks/node_exporter/update.sh
new file mode 100644
index 000000000..99776659c
--- /dev/null
+++ b/src/paks/node_exporter/update.sh
@@ -0,0 +1,27 @@ 
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 2 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2007-2020 IPFire-Team <info@ipfire.org>.                   #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+extract_backup_includes
+./uninstall.sh
+./install.sh
diff --git a/src/scripts/node_exporter_starter.sh b/src/scripts/node_exporter_starter.sh
new file mode 100644
index 000000000..ec6d3582b
--- /dev/null
+++ b/src/scripts/node_exporter_starter.sh
@@ -0,0 +1,7 @@ 
+#/bin/bash
+
+# read configurable OPTIONS
+. /etc/node_exporter_options
+
+/usr/bin/node_exporter $OPTIONS >> /var/log/node_exporter.log 2>&1 &
+