Please add Prometheus Exporter

Well only because I did not found Prometheus anywhere here, I add the request for a Prometheus Export for ipfire.org firewalls, basically it*s a JSON webservice listening on a port (default 9100) with a scraper before (how to develop).

P.S. No this is not an promoting ad for Prometheus. I am just using it for my own servers and would be happy to include my ipfire.org firewalls somehow.

P.S.S. I would contribute the development with a small bounty, maybe we find some more conributors?

1 Like

This would be really excellent. We’re doing all of our monitoring with alerting in Prometheus / Grafana (especially in light of the recent SolarWinds debacle) and IPFire will need to confirm to that model eventually as well.

Hi @teejay and @scaredycrow,

To get Prometheus Exporter built as an add-on then someone who wants this package and has the capability to test it needs to build it.

https://wiki.ipfire.org/devel/ipfire-2-x/addon-howto

This link gives information on how to do this. Initially this can be done as a local add-on. Once the add-on has been proved to work successfully then a patch can be provided into the development mailing list following this link.

https://wiki.ipfire.org/devel/submit-patches

Without someone being willing to take this package up then I doubt it will get done.
The core developers are focussing on the core programs in IPFire and there are a lot of things being worked on and only a small group of core developers.
There are already several monitoring add-ons in IPFire - Icinga, Monit, Nagios, Zabbix Agent and Observium Agent.

2 Likes

Hi @bonnietwin,

as a first step I’d like to test the prometheus node-exporter locally on my ipfire.
I managed to compile it on Ubuntu Focal (current LTS) and I set up an ipfire build environment.
As node-exporter requires go and a go-compiler to build, I guess next step is to include these into the ipfire build system.
How do I add these to the toolchain, or is it enough to have it present within the Ubuntu host OS?

Hi @selaron

Welcome to the IPFire Community.

The IPFire build system already has go in it.

Check in the make.sh file where go is built and make sure that your Prometheus build occurs after this step.

That’s true, I have placed my script at the last position of the buildipfire() function, but I keep getting “go: command not found” errors and a subsequent build failure:

   + cd /usr/src/lfs
    + make -f node_exporter LFS_BASEDIR=/usr/src install
    ====================================== Installing node_exporter-1.1.2 ...
    Install started; saving file list to /usr/src/lsalr ...
    cd /usr/src/node_exporter-1.1.2 && make build -j17
    make[1]: Entering directory '/usr/src/node_exporter-1.1.2'
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    make[1]: go: Command not found
    curl -s -L https://github.com/prometheus/promu/releases/download/v0.7.0/promu-0.7.0.-.tar.gz | tar -xvzf - -C /tmp/tmp.JrMCbAvlo9
    
    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now
    make[1]: *** [Makefile.common:265: /bin/promu] Error 2
    make[1]: Leaving directory '/usr/src/node_exporter-1.1.2'
    make: *** [node_exporter:79: /usr/src/log/node_exporter-1.1.2] Error 2

This is my build script so far:

 cat lfs/node_exporter 
##############################################################################
#                                                                             #
# IPFire.org - A linux based firewall                                         #
# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
#                                                                             #
# ...
#                                                                             #
###############################################################################

###############################################################################
# Definitions
###############################################################################

include Config

VER        = 1.1.2

THISAPP    = node_exporter-$(VER)
DL_FILE    = v$(VER).tar.gz
DL_FROM    = https://github.com/prometheus/node_exporter/archive/refs/tags/v1.1.2.tar.gz
DIR_APP    = $(DIR_SRC)/$(THISAPP)
TARGET     = $(DIR_INFO)/$(THISAPP)
PROG       = node_exporter
PAK_VER    = 1

DEPS       = ""

###############################################################################
# Top-level Rules
###############################################################################

objects = $(DL_FILE)

$(DL_FILE) = $(DL_FROM)/$(DL_FILE)

$(DL_FILE)_MD5 = 33c2be846dbd502f9c0efab149a8cbc5

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)
	cp node_exporter /usr/bin
	@rm -rf $(DIR_APP)
	@$(POSTBUILD)

Hi @selaron

I think the problem is that your DL_FILE and DL_FROM lines are not correct
I believe they should be

DL_FILE   = $(THISAPP).tar.gz
DL_FROM   = https://github.com/prometheus/node_exporter/releases/download/v1.1.2/

The DL_FROM is the location of the file and should not include the filename itself. That comes from the DL_FILE variable.

Let us know if that then works or if not, what error messages you get then.

Make sure to run ./make.sh downloadsrc first, after updating the lfs, as that checks that the correct file is being downloaded and matches the md5sum

I changed the variables to:

DL_FILE    = $(THISAPP).tar.gz
DL_FROM    = https://github.com/prometheus/node_exporter/archive/v$(VER)/

downloadsrc succeeds and MD5 matches, but the error is still the same. It failes while actually processing a Makefile from within the node_exporter package.

Only suggestion I have then is that you go into an IPFire build shell and run the commands and see what exactly is not working

./make.sh shell

This will start a chrooted shell in the IPFire build environment

cd /usr/src

This puts you in the same place for building as the lfs script would. Then run the tar command

tar zxf /build/cache/node_exporter-1.1.2.tar.gz

Change into the extracted source directory and run the make command from the lfs

cd node_exporter-1.1.2
make build -j17

When you get the error, all the files in the src directory will still be there so you can check what it is looking for and what is missing.

You can also compare what is happening in the shell compared to what happened when you built it on Ubuntu. Hopefully the error messages give more guidance on what is not working.

Thank you for your quick support so far. I found that “go” was never build because I am building for i586 architecture and lfs/go reads:

SUP_ARCH = x86_64

After a bit of tweaking lfs/Config and lfs/go the node_exporter built successfully now and I can continue the howto from here :slight_smile:

Glad to hear that you have figured out what was happening.

Good luck with the next steps. Hopefully everything will work fine from now on but if you have further problems just let us know.