Giter Site home page Giter Site logo

prometheus-rpm's Introduction

Prometheus RPM Packages

Build Status Lint Status Update Status

The repository contains the files needed to build Prometheus RPM packages for CentOS 7 & 8 and CentOS Stream 9.

Installing

The packages are available in the packagecloud repository and can be used by adding the following /etc/yum.repos.d/prometheus.repo:

CentOS

[prometheus]
name=prometheus
baseurl=https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch
repo_gpgcheck=1
enabled=1
gpgkey=https://packagecloud.io/prometheus-rpm/release/gpgkey
       https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm
gpgcheck=1
metadata_expire=300

Adding a new exporter

Auto generation

  1. Add a new section under packages in templating.yaml with the required information (overriding any defaults if required).
  2. Create a new directory with the name of the exporter and populate it with a file named <exporter_name>.default which will contain the default environment variables passed to the init and unit files.
  3. Once this is done add this exporter to the list of AUTO_GENERATED exporters in Makefile.
  4. Test that you can build this RPM using the command make <exporter_name>.

Custom

  1. Add the exporter to the list of MANUAL in the file Makefile.
  2. Make a new directory with the same name as the exporter.
  3. Populate this directory with all the required files to build the RPM.
  4. Test that you can build this RPM using the command make <exporter_name>.

Build RPMs manually

Build all packages with:

make all

or build a single package only, e.g.:

make node_exporter

The resulting RPMs will be created in the _dist7 or _dist8 directories depending on the version of CentOS that they were built for.

Ansible role

An Ansible role which installs Prometheus packages from these RPMs is available in Github or in Galaxy.

prometheus-rpm's People

Contributors

andreaskundig avatar atoms avatar b-a-t avatar benoitknecht avatar britcey avatar djvl avatar duritong avatar edgarswed avatar jenningsloy318 avatar josh-tilles avatar jrobersonaquent avatar karlism avatar lest avatar marcindulak avatar mitchellrj avatar nickb834 avatar northerngit avatar p37ruh4 avatar pandrieux avatar prometheus-rpm-bot avatar reachfh avatar rmyhren avatar rudd-o avatar sasah avatar spredzy avatar spynode avatar themeier avatar xocasdashdash avatar yumminhuang avatar zengwei2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prometheus-rpm's Issues

Permission denied while building(make all) on Centos7 locally

Fresh install of centos7. Steps:

# uname -a
Linux host 3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

su
yum install python36 python36-pip git docker
systemctl docker start
git clone
cd 
pip3 install -r requirements.txt
make all

The result:

[root@host prometheus-rpm]# make all
python3 ./generate.py --templates node_exporter
./generate.py:51: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = yaml.load(tc)
INFO:root:Building exporter node_exporter
tarball
sources
{'user': 'prometheus', 'group': 'prometheus', 'package': '%{name}-%{version}.linux-amd64', 'tarball_has_subdirectory': True, 'release': 2, 'version': '0.17.0', 'license': 'ASL 2.0', 'URL': 'https://github.com/prometheus/node_exporter', 'summary': 'Prometheus exporter for machine metrics, written in Go with pluggable metric collectors.', 'description': 'Prometheus exporter for hardware and OS metrics exposed by *NIX kernels,\nwritten in Go with pluggable metric collectors.\n', 'name': 'node_exporter', 'tarball': 'https://github.com/prometheus/node_exporter/releases/download/v%{version}/%{name}-%{version}.linux-amd64.tar.gz', 'sources': ['https://github.com/prometheus/node_exporter/releases/download/v%{version}/%{name}-%{version}.linux-amd64.tar.gz', 'autogen_%{name}.unit', '%{name}.default', 'autogen_%{name}.init']}
INFO:root:Rendering step spec for node_exporter
INFO:root:Writing node_exporter step spec to node_exporter/autogen_node_exporter.spec
INFO:root:Rendering step unit for node_exporter
INFO:root:Writing node_exporter step unit to node_exporter/autogen_node_exporter.unit
INFO:root:Rendering step init for node_exporter
INFO:root:Writing node_exporter step init to node_exporter/autogen_node_exporter.init
# Build for centos 6
docker run -it --rm \
        -v /root/prometheus-rpm/node_exporter:/rpmbuild/SOURCES \
        -v /root/prometheus-rpm/_dist6:/rpmbuild/RPMS/x86_64 \
        -v /root/prometheus-rpm/_dist6:/rpmbuild/RPMS/noarch \
        quay.io/zoonage/centos6-rpm-build \
        build-spec SOURCES/autogen_node_exporter.spec
Unable to find image 'quay.io/zoonage/centos6-rpm-build:latest' locally
Trying to pull repository quay.io/zoonage/centos6-rpm-build ...
latest: Pulling from quay.io/zoonage/centos6-rpm-build
987d765a926d: Pull complete
9e11cb0c3603: Pull complete
ae55badf2073: Pull complete
22273c078c42: Pull complete
ad214df4e0fa: Pull complete
Digest: sha256:b399db3454509b81f04aa099f33c8b024cc11189f881b5a8a862d11b8633f227
Status: Downloaded newer image for quay.io/zoonage/centos6-rpm-build:latest
+ SPEC=SOURCES/autogen_node_exporter.spec
++ stat -c%u SOURCES/autogen_node_exporter.spec
stat: cannot stat `SOURCES/autogen_node_exporter.spec': Permission denied
+ uid=

snmp.yml is missing from snmp_exporter

The snmp.yml file is needed for snmp_exporter to run.

I would be happy to submit a pull request but I am not sure where you would want to put the file.

-Scott

el6 rpms missing execute permission on /etc/rc.d/init.d/*_exporter

Unsure whether this is something odd in the binary rpms or caused by something odd about my target:

# uname -a
Linux xxxx 2.6.32-358.el6.x86_64

# rpm -i pkgs/node_exporter-0.17.0-1.el6.x86_64.rpm

# rpm -q --list node_exporter-0.17.0 | xargs ls -ld
-rw-r--r--. 1 root root 0 Dec 27 09:19 /etc/default/node_exporter
-rw-r--r--. 1 root root 1808 Dec 27 09:19 /etc/rc.d/init.d/node_exporter ### <======== rw only
-rwxr-xr-x. 1 root root 12325410 Dec 27 09:19 /usr/bin/node_exporter
drwxr-xr-x. 2 prometheus prometheus 4096 Dec 27 09:19 /var/lib/prometheus

rpm -i --noscripts = same result i.e. 644

From spec.tpl though, it's hard to see why this wouldn't end up 755? Tried other (postgres) exporters and older exporters for comparison and init.d entry was always 644. Any ideas?

Enabling service on install

Submission type

  • Bug report

Usual behavior of packages containing services upon installation is to register the service being installed and start it. However this is not true for prometheus packages.
RPM POSTIN spec does not contain systemctl enable prometheus.service but contains:

%post
%systemd_post prometheus.service

Looking at systemd sources:
I can translate it as:

%systemd_post() \
if [ $1 -eq 1 ] ; then \
        # Initial installation \
        systemctl --no-reload preset %{?*} >/dev/null 2>&1 || : \
fi \

First, enable prometheus autostart (to demonstrate effect):

# systemctl enable prometheus

so, that macros doing that:

# systemctl --no-reload preset prometheus
Removed symlink /etc/systemd/system/multi-user.target.wants/prometheus.service.

Same
Please, make service registration and autostart in postinstall.

systemd version the issue has been seen with

219-42.el7_4.4.x86_64

Used distribution

CentOS Linux release 7.4.1708 (Core)

Node exporter does not read defaults file

Hello,
looks like another small bug in node_exporter rpm.

cat /etc/systemd/system/multi-user.target.wants/node_exporter.service
# -- mode: conf --

[Unit]

Description=Prometheus exporter for machine metrics, written in Go with pluggable metric collectors.
Documentation=https://github.com/prometheus/node_exporter
After=network.target

[Service]

EnvironmentFile=-/etc/default/node_exporter
User=prometheus
ExecStart=/usr/bin/node_exporter $NODE_EXPORTER_EXPORTER_OPTS
Restart=on-failure

[Install]

WantedBy=multi-user.target

cat /etc/default/node_exporter
NODE_EXPORTER_OPTS='some_options_here'

Variable name is different, therefore node_exporter starts, but doesn't apply flags from /etc/default/node_exporter

Collaborator access to repository

@lest, can you please give me and @britcey collaborator access to prometheus-rpm repository so that we can push updates and merge requests? Sometimes it takes you quite some time to approve even minor changes, like version updates and we could probably help you with that.

429 too many requests from GitHub during the builds

I've noticed lately that there are 429 too many requests errors during the build:

Getting https://github.com/SuperQ/smokeping_prober/releases/download/v0.3.0/smokeping_prober-0.3.0.linux-amd64.tar.gz to /rpmbuild/SOURCES/smokeping_prober-0.3.0.linux-amd64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 429 too many requests
Makefile:49: recipe for target 'build8-smokeping_prober' failed
make: *** [build8-smokeping_prober] Error 22

Setting different user in templated exporters

I've tried to switch keepalived_exporter to root user (as it requires to be run as rootย since it needs to send SIGUSR1 to keepalivedย process, which runs as root on CentOS).

After adding user and group paramters to template as following I discovered couple of issues:

  keepalived_exporter:
    build_steps:
      <<: *default_build_steps
    context:
      <<: *default_context
      static:
        <<: *default_static_context
        version: 0.4.0
        license: ASL 2.0
        user: root
        group: root
        release: 2
        URL: https://github.com/gen2brain/keepalived_exporter
        package: '%{name}-%{version}-amd64'
        summary: Prometheus exporter for Keepalived metrics
        description: Export Keepalived service metrics to Prometheus.
      dynamic:
        <<: *default_dynamic_context
        tarball: '{{URL}}/releases/download/%{version}/{{package}}.tar.gz'

Package cannot be installed as it conflicts with other packages:

Transaction check error:
  file /var/lib/prometheus from install of keepalived_exporter-0.4.0-2.el7.x86_64 conflicts with file from package node_exporter-0.18.1-1.el7.centos.x86_64
  file /var/lib/prometheus from install of keepalived_exporter-0.4.0-2.el7.x86_64 conflicts with file from package blackbox_exporter-0.16.0-1.el7.centos.x86_64
  file /var/lib/prometheus from install of keepalived_exporter-0.4.0-2.el7.x86_64 conflicts with file from package snmp_exporter-0.17.0-2.el7.x86_64

It attempts to create /var/lib/prometheus directory with user and group root, which conflicts with other exporters:

$ cat keepalived_exporter/autogen_keepalived_exporter.spec | grep -e "%define" -e "%dir"
%define debug_package %{nil}
%define user root
%define group root
%dir %attr(755, %{user}, %{group}) %{_sharedstatedir}/prometheus

Additionally to that package still attempts to create prometheus user and group, despite the fact that they are not really necessary in this scenario:

$ cat keepalived_exporter/autogen_keepalived_exporter.spec | grep -A4 "%pre$"
%pre
getent group prometheus >/dev/null || groupadd -r prometheus
getent passwd prometheus >/dev/null || \
  useradd -r -g prometheus -d %{_sharedstatedir}/prometheus -s /sbin/nologin \
          -c "Prometheus services" prometheus

Services start before networking is up

We've run into scenario, where exporters are starting before networking is up during the system startup, and are failing to bind to network address:

Aug 11 14:06:23 hostname node_exporter[1024]: time="2020-08-11T14:06:23Z" level=fatal msg="listen tcp 172.16.XXX.XXX:9100: bind: cannot assign requested address" source="node_exporter.go:172"
Aug 11 14:06:23 hostname systemd[1]: node_exporter.service: Main process exited, code=exited, status=1/FAILURE
Aug 11 14:06:23 hostname systemd[1]: node_exporter.service: Failed with result 'exit-code'.
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Service RestartSec=100ms expired, scheduling restart.
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Scheduled restart job, restart counter is at 1.
Aug 11 14:06:24 hostname node_exporter[1059]: time="2020-08-11T14:06:24Z" level=fatal msg="listen tcp 172.16.XXX.XXX:9100: bind: cannot assign requested address" source="node_exporter.go:172"
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Main process exited, code=exited, status=1/FAILURE
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Failed with result 'exit-code'.
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Service RestartSec=100ms expired, scheduling restart.
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Scheduled restart job, restart counter is at 2.
Aug 11 14:06:24 hostname node_exporter[1064]: time="2020-08-11T14:06:24Z" level=fatal msg="listen tcp 172.16.XXX.XXX:9100: bind: cannot assign requested address" source="node_exporter.go:172"
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Main process exited, code=exited, status=1/FAILURE
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Failed with result 'exit-code'.
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Service RestartSec=100ms expired, scheduling restart.
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Scheduled restart job, restart counter is at 3.
Aug 11 14:06:24 hostname node_exporter[1110]: time="2020-08-11T14:06:24Z" level=fatal msg="listen tcp 172.16.XXX.XXX:9100: bind: cannot assign requested address" source="node_exporter.go:172"
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Main process exited, code=exited, status=1/FAILURE
Aug 11 14:06:24 hostname systemd[1]: node_exporter.service: Failed with result 'exit-code'.
Aug 11 14:06:25 hostname systemd[1]: node_exporter.service: Service RestartSec=100ms expired, scheduling restart.
Aug 11 14:06:25 hostname systemd[1]: node_exporter.service: Scheduled restart job, restart counter is at 4.
Aug 11 14:06:25 hostname node_exporter[1157]: time="2020-08-11T14:06:25Z" level=fatal msg="listen tcp 172.16.XXX.XXX:9100: bind: cannot assign requested address" source="node_exporter.go:172"
Aug 11 14:06:25 hostname systemd[1]: node_exporter.service: Main process exited, code=exited, status=1/FAILURE
Aug 11 14:06:25 hostname systemd[1]: node_exporter.service: Failed with result 'exit-code'.
Aug 11 14:06:25 hostname systemd[1]: node_exporter.service: Service RestartSec=100ms expired, scheduling restart.
Aug 11 14:06:25 hostname systemd[1]: node_exporter.service: Scheduled restart job, restart counter is at 5.
Aug 11 14:06:25 hostname systemd[1]: node_exporter.service: Start request repeated too quickly.
Aug 11 14:06:25 hostname systemd[1]: node_exporter.service: Failed with result 'exit-code'.
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5034] hostname: hostname: using hostnamed
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5036] hostname: hostname changed from (none) to "hostname"
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5038] dns-mgr[0x5595c4895250]: init: dns=none,systemd-resolved rc-manager=unmanaged
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5155] Loaded device plugin: NMTeamFactory (/usr/lib64/NetworkManager/1.22.8-5.el8_2/libnm-device-plugin-team.so)
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5156] manager: rfkill: Wi-Fi enabled by radio killswitch; enabled by state file
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5160] manager: rfkill: WWAN enabled by radio killswitch; enabled by state file
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5164] manager: Networking is enabled by state file
Aug 11 14:06:25 hostname dbus-daemon[965]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.8' (uid=0 pid=1012 comm="/usr/sbin/NetworkManager --no-daemon " label="system_u:system_r:NetworkManager_t:s0")
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5171] dhcp-init: Using DHCP client 'internal'
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5252] settings: Loaded settings plugin: ifcfg-rh ("/usr/lib64/NetworkManager/1.22.8-5.el8_2/libnm-settings-plugin-ifcfg-rh.so")
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5254] settings: Loaded settings plugin: keyfile (internal)
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5318] device (lo): carrier: link connected
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5367] manager: (lo): new Generic device (/org/freedesktop/NetworkManager/Devices/1)
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5457] manager: (ens192): new Ethernet device (/org/freedesktop/NetworkManager/Devices/2)
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5535] device (ens192): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.5678] device (ens192): carrier: link connected
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6096] device (ens192): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed')
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6152] policy: auto-activating connection 'System ens192' (03da7500-2101-c722-2438-d0d006c28c73)
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6233] device (ens192): Activation: starting connection 'System ens192' (03da7500-2101-c722-2438-d0d006c28c73)
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6254] device (ens192): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6299] manager: NetworkManager state is now CONNECTING
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6320] device (ens192): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6633] device (ens192): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6690] device (ens192): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6748] device (ens192): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6774] device (ens192): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6810] manager: NetworkManager state is now CONNECTED_LOCAL
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6899] manager: NetworkManager state is now CONNECTED_SITE
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6910] policy: set 'System ens192' (ens192) as default for IPv4 routing and DNS
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6925] device (ens192): Activation: successful, device activated.
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.6984] manager: NetworkManager state is now CONNECTED_GLOBAL
Aug 11 14:06:25 hostname NetworkManager[1012]: <info>  [1597154785.7050] manager: startup complete

Services have Restart=on-failure systemd parameter, but default value of RestartSec parameter is only 100ms, and they are restarted way too quickly. I suggest increasing value of RestartSec to 5 seconds, to avoid this issue.

packagecloud.io setup disables gpgkey

it would be good if the packagecloud.io information included pointers to RPM-GPG-KEY-prometheus-rpm so that the gpgcheck doesn't need to be disabled by their automatic scripts. also, it would be nice if this gpg key was uploaded to the normal PGP keyservers.

Ownership/permissions don't allow textfile_collector files to be read

Under CentOS 7, node_exporter runs as the prometheus user in the prometheus group.

The /var/lib/node_exporter/textfile_collector directory is owned by root:node_exporter with 771 permissions, so files created inside can't be read by the node_exporter process

Solutions include changing permissions on the textfile_collector directory or adding the prometheus user to the node_exporter group.

repomd.xml missing in packagecloud.io

Hi,

It seems that the metadata of the repository is missing

root@localhost root]# reposync -l --repoid=prometheus --download_path=/var/repos/prometheus-centos7
Loaded plugins: product-id, subscription-manager
rhel-7-server-rpms | 3.5 kB 00:00:00
Error setting up repositories: failure: repodata/repomd.xml from prometheus: [Errno 256] No more mirrors to try.
https://packagecloud.io/prometheus-rpm/release/el/7/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 302 - Found

Can you generate it?

Best Regards,

Joaquin

nginx_exporter el6 issues

Hello, there are some issues with nginx_exporter on el6 OS.

  1. daemonize pkg is needed and its better to add it in req list
  2. in /etc/init.d/nginx_exporter
    line 33 u have to change ${EXPORTER_ARGS} to ${NGINX_EXPORTER_OPTS}

node_exporter probably should be run as root

So if I am not mistaken, about 50% of node_exporter's collectors (sockstat , netstat, hwmon, ext.) require it running as root. The service file has it running as the prometheus user. Although it would be nice to have it not run as root, I think it really has too.

CentOS 6 EoL

@lest & @britcey, CentOS 6 has reached EoL, I suggest we should also drop support and stop building new packages for it, what's your opinion on that?

Node exporter

Please prepare spec file and systemd file for node_exporter

Bump limits in unit files?

I find myself adding override files for several of these packages (blackbox, snmp & prometheus itself) - the default file limit of 4096 is just too low.

Should we just add

LimitNOFILE=65536

(or some other value) to the unit files by default?

Sysv init scripts running as none root user fail to start node_exporter (at least)

The current rpm for sysv init based distros [RedHat|CentOS] 6.x can't start the service due to:

prometheus user has shell set /sbin/nologin - a quick workaround without changing shell is to add su -s /bin/sh to init script line 24 after ${USER} var:

su - "${USER}" -s /bin/sh -c "${CMD} &> ${LOGFILE} & echo \$! > ${tmp_pid}"

However - the prometheus user doesn't have perms to write pid file in /var/run nor log file in /var/log

I've looked at changing the init script to source /etc/init.d/functions and making use of daemon function that will take care of the perms issue:

source functions; daemon --user=prometheus --pidfile=/var/run/node_exporter.pid /usr/bin/node_exporter

Not sure of best way forward tbh.......

Missing BuildRequires systemd-rpm-macros

On Fedora, these packages (e.g. alertmanager) do not build because the %{_unitdir} macro does not expand. The solution is to add the following:

s/%[{][?]systemd_requires[}]/BuildRequires: systemd-rpm-macros\\nRequires(preun): systemd\\nRequires(post): systemd\\nRequires(postun): systemd/'

Then the macros expand. It looks like the systemd_requires macro is provided by that package, and unfortunately that package is not installed on a base system, therefore the macro can't expand.

Permanent solution would be to ensure that if the macro is empty, the systemd-rpm-macros package is installed, and the additional requires are added by hand like I have done.

I have not tested whether adding just BuildRequires: systemd-rpm-macros suffices to build the package with the correct macros on clean chroots without the systemd-rpm-macros package already.

Centos 7 Node_exporter package systemd file issue

Hi

I have installed node_exporter-0.18.1-1.el7.centos.x86_64 rpm on centos 7
After install systemd ("/usr/lib/systemd/system/node_exporter.service") file created with different 'ExecStart' Argument and EnvironmentFile needs change.

Please look into this and compile and update new RPM for centos7.

Thanks
Murali

Host operating system: output of uname -a
Linux example.com 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

node_exporter version: output of node_exporter --version
node_exporter, version 0.18.1 (branch: HEAD, revision: 3db7773)
build user: root@b50852a1acba
build date: 20190604-16:41:18
go version: go1.12.5

node_exporter command line flags
/usr/bin/node_exporter --collector.systemd

Are you running node_exporter in Docker?
NO

What did you do that produced an error?
Installed node_exporter-0.18.1-1.el7.centos.x86_64 rpm

What did you expect to see?
EnvironmentFile=/etc/default/node_exporter
User=prometheus
ExecStart=/usr/bin/node_exporter $EXPORTER_ARGS

What did you see instead?
EnvironmentFile=-/etc/default/node_exporter
User=prometheus
ExecStart=/usr/bin/node_exporter $NODE_EXPORTER_OPTS

Support Debain packages

It would be good if we could support systems that use DPKG as well as RPM based systems.

Proposed solution: We could use alien to convert the outputted RPMs to DPKG format, however I don't know how reliable that is.

Another solution would be to template the DPKG builds in a similar way to what we do with RPMs, but that is more work

@lest Would this need any changes on the Package Cloud side to support .debs in the same repo?

Move of blackbox_exporter to auto generated package lost capabilities config

@karlism - the old blackbox_exporter.spec had:

%caps(cap_net_raw=ep) %{_bindir}/%{name}

under the %files section.

which set CAP_NET_RAW on blackbox_exporter, which is needed to send ICMP as non-root.

That has been lost with the move to auto generated package (and just bit me hard in a production update).

Do we want to add another static default context? We could probably torture additional_sources to accomplish that otherwise.

prometheus2 SPEC file tsdb build error

Hello,

I believe there is an issue with the prometheus2 SPEC file here that causes builds to fail with the following error:
install: omitting directory 'tsdb'

It appears to be due to the following line (34):
install -D -m 755 tsdb %{buildroot}%{_bindir}/tsdb

This line is pointing to a sub-directory within the prometheus source where the tsdb binary is located, and not pointing to the actual binary within that tsdb sub-directory.

A proposed fix would look something like this:
install -D -m 755 tsdb/tsdb %{buildroot}%{_bindir}/tsdb

Prometheus version/tag build that I tested against: v2.13.1

Very respectfully,
Tyler

Some kind of mess with node_exporter package.

New version of node_exporter 0.16.0 is buggy. During install it doesn't create 'prometheus' user.
Also yum info output is strange:

 # cat prometheus.repo 
[prometheus]
baseurl = https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/prometheus.pub
name = Prometheus RPM package repository
sslverify = 1

~ # yum info node_exporter
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * centos-extras: centos.01link.hk
Installed Packages
Name        : node_exporter
Arch        : x86_64
Version     : 0.15.2
Release     : 1.el7.centos
Size        : 12 M
Repo        : installed
From repo   : prometheus
Summary     : Prometheus exporter for machine metrics, written in Go with pluggable metric collectors.
URL         : https://github.com/prometheus/node_exporter
License     : ASL 2.0
Description : 
            : Prometheus exporter for machine metrics, written in Go with pluggable metric collectors.

Available Packages
Name        : node_exporter
Arch        : x86_64
Version     : 0.16.0
Release     : 1.el7.centos
Size        : 3.2 M
Repo        : prometheus/7/x86_64
Summary     : Prometheus exporter for MySQL server metrics.
URL         : https://github.com/prometheus/node_exporter
License     : ASL 2.0
Description : Prometheus exporter for MySQL server metrics.

Size and description are seems to be weird...

Building fails when run locally

Problem

Running make for exporters fails locally due to bad owners / groups. However it passes the builds in TravisCI.

Expected

Running make to succeed and produce the appropriate RPM

Example

aaron@neptune:~/Programming/prometheus-rpm$ make consul_exporter
docker run --rm \
	-v /home/aaron/Programming/prometheus-rpm/consul_exporter:/rpmbuild/SOURCES \
	-v /home/aaron/Programming/prometheus-rpm/_dist:/rpmbuild/RPMS/x86_64 \
	-v /home/aaron/Programming/prometheus-rpm/_dist:/rpmbuild/RPMS/noarch \
	lest/centos7-rpm-builder \
	build-spec SOURCES/consul_exporter.spec
+ SPEC=SOURCES/consul_exporter.spec
+ yum-builddep -y SOURCES/consul_exporter.spec
Loaded plugins: fastestmirror, ovl
Enabling base-source repository
Enabling extras-source repository
Enabling updates-source repository
Determining fastest mirrors
 * base: repo.uk.bigstepcloud.com
 * extras: mirrors.clouvider.net
 * updates: mirrors.vooservers.com
Checking for new repos for mirrors
Getting requirements for SOURCES/consul_exporter.spec
No uninstalled build requires
+ spectool -g -R SOURCES/consul_exporter.spec
/rpmbuild/SOURCES/consul_exporter-0.3.0.linux-amd64.tar.gz already exists, skipping download
Getting https://github.com/prometheus/consul_exporter/releases/download/v0.3.0/consul_exporter-0.3.0.linux-amd64.tar.gz to /rpmbuild/SOURCES/consul_exporter-0.3.0.linux-amd64.tar.gz
+ rpmbuild -ba SOURCES/consul_exporter.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.3QzLCQ
+ umask 022
+ cd /rpmbuild/BUILD
+ cd /rpmbuild/BUILD
+ rm -rf consul_exporter-0.3.0.linux-amd64
+ /usr/bin/gzip -dc /rpmbuild/SOURCES/consul_exporter-0.3.0.linux-amd64.tar.gz
+ /usr/bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd consul_exporter-0.3.0.linux-amd64
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.7fLGhH
+ umask 022
+ cd /rpmbuild/BUILD
+ cd consul_exporter-0.3.0.linux-amd64
+ /bin/true
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.Jqg2Wx
+ umask 022
+ cd /rpmbuild/BUILD
+ '[' /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64 '!=' / ']'
+ rm -rf /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64
++ dirname /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64
+ mkdir -p /rpmbuild/BUILDROOT
+ mkdir /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64
+ cd consul_exporter-0.3.0.linux-amd64
+ mkdir -vp /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/var/lib/prometheus
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/var'
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/var/lib'
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/var/lib/prometheus'
+ mkdir -vp /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/usr/bin
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/usr'
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/usr/bin'
+ mkdir -vp /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/usr/lib/systemd/system
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/usr/lib'
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/usr/lib/systemd'
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/usr/lib/systemd/system'
+ mkdir -vp /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/etc/default
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/etc'
mkdir: created directory '/rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/etc/default'
+ install -m 755 consul_exporter /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/usr/bin/consul_exporter
+ install -m 644 /rpmbuild/SOURCES/consul_exporter.service /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/usr/lib/systemd/system/consul_exporter.service
+ install -m 644 /rpmbuild/SOURCES/consul_exporter.default /rpmbuild/BUILDROOT/consul_exporter-0.3.0-1.el7.centos.x86_64/etc/default/consul_exporter
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
error: Bad owner/group: /rpmbuild/SOURCES/consul_exporter.spec
error: Bad owner/group: /rpmbuild/SOURCES/consul_exporter.default


RPM build errors:
error: Bad owner/group: /rpmbuild/SOURCES/consul_exporter.service
    Bad owner/group: /rpmbuild/SOURCES/consul_exporter.spec
    Bad owner/group: /rpmbuild/SOURCES/consul_exporter.default
    Bad owner/group: /rpmbuild/SOURCES/consul_exporter.service
make: *** [Makefile:27: consul_exporter] Error 1

Exporters for Red Hat and CentOS 6

Hello,

We would like to use Prometheus to monitor ou servers, which also has some Red Hat and CentOS 6.

We wonder if you plan to add RHEL6 / CentOS 6 packages for client side exporter (especially node_exporter, procfs, pushgateway...)

Thanks

Packaging question - thanos?

This is not exactly an issue, just some questions:

  1. Any interest in adding Thanos? https://github.com/improbable-eng/thanos

  2. If 'yes', a packaging question:

Thanos is really a variety of components - a single 'thanos' binary with various subcommands:

'thanos sidecar'
'thanos store'
'thanos query'
'thanos compact'

etc.

What makes more sense:

  1. a single 'thanos' package, with thanos_sidecar, thanos_store, thanos_query, etc. service and default files

  2. a 'thanos-base' package with just the binary and 'thanos-sidecar', 'thanos-store', etc. packages that just contain service & default files?

Add dnsmasq_exporter

I would like to add the dnsmasq_exporter, but I am not sure how to add it because it does not have a release.
Go get is also broken atm so I had to build it with go build .

Any pointers?

Thanks in advance for the hard work!

Init script should exit with value > 0 when 'status' action is not running

Condition: node_exporter is not running
User action: user calls the status action of the init script
Expected: init script exits with value > 0
Actual: init script exits with value 0

Example:

[root@aort-alerta-s3 ~]# /etc/init.d/node_exporter status
node_exporter is not running
[root@aort-alerta-s3 ~]# echo $?
0

The exit value of this script is consulted by infrastructure tooling (e.g. Chef) to determine if the service needs to be restarted, so this bug interferes with automated lifecycle management.

I don't expect this to be a controversial change, but here is the references to the LSB spec just in case:

http://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/iniscrptact.html

service node_exporter restart fails on el6

(see related Issue #51 )

# rpm -i ./pkgs/node_exporter-0.17.0-1.el6.x86_64.rpm
# rpm -q --list node_exporter
/etc/default/node_exporter
/etc/rc.d/init.d/node_exporter
/usr/bin/node_exporter
/var/lib/prometheus

init.d script restart works ok:

# /etc/rc.d/init.d/node_exporter restart
Stopping node_exporter...
node_exporter stopped
Starting node_exporter
node_exporter started with PID 209146
node_exporter started successfully.

service restart fails:

# service node_exporter restart
Stopping node_exporter...
node_exporter stopped
Starting node_exporter
su: user does not exist
mv: cannot stat `/tmp/node_exporter.pid': No such file or directory
cat: /var/run/node_exporter.pid: No such file or directory

node_exporter started with PID
node_exporter was not started OK

If I add in USER=root that works around it. If I add in USER=prometheus that fails because of nologin shell setup for this account.

Following on from ticket 51, updating the startup script to use daemon from init.d/functions allows this to be run as root or prometheus - also make sure $USER defaults to root so that service restart works. End user can then add USER=prometheus into /etc/default/node_exporter to run as prometheus user if desired:

So proposed fix is:

#!/bin/sh

# chkconfig: 2345 60 20
# description: node_exporter

source /etc/init.d/functions

NAME=node_exporter
SCRIPT="/usr/bin/${NAME}"
PIDFILE="/var/run/${NAME}.pid"
LOGFILE="/var/log/${NAME}.log"
ENVFILE="/etc/default/${NAME}"

start() {

if [ -f "${PIDFILE}" ] && kill -0 $(cat "${PIDFILE}") &> /dev/null; then
echo "${NAME} already running with PID $(cat ${PIDFILE})" >&2
return 1
fi

echo "Starting ${NAME}" >&2
. "${ENVFILE}"

if [ -z $USER ]; then
USER=root
fi

daemon --user $USER --pidfile="$PIDFILE" "${SCRIPT} &" 2&> $LOGFILE

echo pidof $NAME > ${PIDFILE}

echo "${NAME} started with PID $(cat ${PIDFILE})" >&2
sleep 1
if [ -f "${PIDFILE}" ] && kill -0 $(cat "${PIDFILE}") &> /dev/null; then
echo "${NAME} started successfully." >&2
else
echo "${NAME} was not started OK"
return 1
fi

}

How to go about adding golang dependency?

Hello,

I've added support for dnsmasq_exporter but I need the docker images to include epel-release or some other way to acquire the build dependency golang.

I've been able to test that with this one additional repo enabled, the build works. via changing:
build-spec SOURCES/autogen_${PACKAGE}.spec to:

/bin/bash -c '/usr/bin/yum install --verbose -y epel-release && build-spec SOURCES/autogen_${PACKAGE}.spec'

How would you suggest proceeding?

Thanks,
Wes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.