3 changed files with 74 additions and 0 deletions
@ -0,0 +1,4 @@ |
|||||
|
CONFIG_FILE=/opt/snmp_exporter/etc/snmp.yaml |
||||
|
LISTEN_ADDRESS=127.0.0.1:9116 |
||||
|
LOG_LEVEL=info |
||||
|
EXPORTER_OPTIONS= |
||||
@ -0,0 +1,16 @@ |
|||||
|
[Unit] |
||||
|
Description=SNMP Exporter for Prometheus |
||||
|
Wants=network.target |
||||
|
After=network-online.target |
||||
|
|
||||
|
[Service] |
||||
|
Restart=always |
||||
|
Type=simple |
||||
|
EnvironmentFile=/opt/snmp_exporter/etc/snmp_exporter.env |
||||
|
ExecStart=/opt/snmp_exporter/bin/snmp_exporter --config.file=${CONFIG_FILE} --web.listen-address=${LISTEN_ADDRESS} --log.level=${LOG_LEVEL} $EXPORTER_OPTIONS |
||||
|
WorkingDirectory=/opt/snmp_exporter/etc |
||||
|
User=prometheus |
||||
|
Group=itix-svc |
||||
|
|
||||
|
[Install] |
||||
|
WantedBy=multi-user.target default.target |
||||
@ -0,0 +1,54 @@ |
|||||
|
Name: snmp_exporter |
||||
|
Version: 0.20.0 |
||||
|
Release: itix1 |
||||
|
Summary: SNMP Exporter for Prometheus |
||||
|
License: Apache-2.0 |
||||
|
Source0: https://github.com/prometheus/%{name}/releases/download/v%{version}/%{name}-%{version}.linux-amd64.tar.gz |
||||
|
Source1: %{name}.service |
||||
|
Source2: %{name}.env |
||||
|
ExclusiveArch: x86_64 |
||||
|
Requires(pre): shadow-utils |
||||
|
BuildRequires: systemd |
||||
|
|
||||
|
%description |
||||
|
|
||||
|
This exporter is the recommended way to expose SNMP data in a format which |
||||
|
Prometheus can ingest. |
||||
|
|
||||
|
# Since we don't recompile from source, disable the build_id checking |
||||
|
%global _missing_build_ids_terminate_build 0 |
||||
|
%global _build_id_links none |
||||
|
%global debug_package %{nil} |
||||
|
|
||||
|
%prep |
||||
|
%setup -q -n %{name}-%{version}.linux-amd64 |
||||
|
cp %{S:1} %{name}.service |
||||
|
cp %{S:2} %{name}.env |
||||
|
|
||||
|
%build |
||||
|
|
||||
|
%install |
||||
|
install -D snmp_exporter %{buildroot}/opt/%{name}/bin/snmp_exporter |
||||
|
install -D -m 0644 snmp.yml %{buildroot}/opt/%{name}/etc/snmp.yaml |
||||
|
install -D -m 0644 %{name}.env %{buildroot}/opt/%{name}/etc/%{name}.env |
||||
|
install -D -m 0644 %{name}.service %{buildroot}/%{_unitdir}/%{name}.service |
||||
|
|
||||
|
%files |
||||
|
%defattr(0644, root, root, 0755) |
||||
|
%license LICENSE |
||||
|
%dir /opt/%{name}/bin/ |
||||
|
%dir /opt/%{name}/etc/ |
||||
|
%attr(0755, root, root) /opt/%{name}/bin/%{name} |
||||
|
%config(noreplace) /opt/%{name}/etc/snmp.yaml |
||||
|
%config(noreplace) /opt/%{name}/etc/%{name}.env |
||||
|
%{_unitdir}/%{name}.service |
||||
|
|
||||
|
%pre |
||||
|
getent group itix-svc >/dev/null || groupadd -r itix-svc |
||||
|
getent passwd prometheus >/dev/null || useradd -r -g itix-svc \ |
||||
|
-d /srv/prometheus -s /sbin/nologin -c "Prometheus monitoring" \ |
||||
|
prometheus |
||||
|
|
||||
|
exit 0 |
||||
|
|
||||
|
%changelog |
||||
Loading…
Reference in new issue