-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
120 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
AUTO_TARBALL := 1 | ||
|
||
include unibuild/unibuild.make |
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Makefile for perfSONAR Host Metrics | ||
# | ||
default: | ||
@true | ||
|
||
install: | ||
ifndef PERFSONAR-ROOTPATH | ||
@echo No PERFSONAR-ROOTPATH specified for installation | ||
@false | ||
endif | ||
ifndef HTTPD-CONFIGPATH | ||
@echo No HTTPD-CONFIGPATH specified for installation | ||
@false | ||
endif | ||
mkdir -p ${PERFSONAR-ROOTPATH} | ||
mkdir -p ${HTTPD-CONFIGPATH} | ||
install -m 755 exporter_opts.sh ${PERFSONAR-ROOTPATH}/ | ||
install -m 644 apache-node_exporter.conf ${HTTPD-CONFIGPATH}/ |
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
perfsonar-host-metrics/perfsonar-host-metrics/exporter_opts.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
TARGET_FILE="/etc/default/node_exporter" | ||
EDIT_MARKER='#Edited by PS_HOST_METRICS' | ||
NODE_EXPORTER_OPTS='PS_NODE_EXPORTER_OPTS=""' | ||
grep -q PS_HOST_METRICS ${TARGET_FILE} | ||
if [ $? -eq 1 ]; then | ||
TEMPFILE=$(mktemp) | ||
echo ${EDIT_MARKER} | cat - ${TARGET_FILE} > ${TEMPFILE} | ||
sed -E 's/^NODE_EXPORTER_OPTS="(.*)"/NODE_EXPORTER_OPTS="\1 --collector.systemd --collector.systemd.unit-include=^(elmond|grafana-server|httpd|logstash|node_exporter|opensearch-dashboards|opensearch|owamp|(perfsonar-.+)|postgresql|(pscheduler-.+)|(psconfig-.+))\.service"/' -i ${TEMPFILE} | ||
mv ${TEMPFILE} ${TARGET_FILE} | ||
fi |
85 changes: 85 additions & 0 deletions
85
...ar-host-metrics/perfsonar-host-metrics/unibuild-packaging/rpm/perfsonar-host-metrics.spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
%define install_base /usr/lib/perfsonar | ||
%define pkg_install_base %{install_base}/host_metrics | ||
%define httpd_config_base /etc/httpd/conf.d | ||
|
||
#Version variables set by automated scripts | ||
%define perfsonar_auto_version 5.0.5 | ||
%define perfsonar_auto_relnum 1 | ||
|
||
# defining macros needed by SELinux | ||
# SELinux policy type - Targeted policy is the default SELinux policy used in Red Hat Enterprise Linux. | ||
%global selinuxtype targeted | ||
# default boolean value needs to be changed to enable http proxy | ||
%global selinuxbooleans httpd_can_network_connect=1 | ||
|
||
Name: perfsonar-host-metrics | ||
Version: %{perfsonar_auto_version} | ||
Release: %{perfsonar_auto_relnum}%{?dist} | ||
Summary: perfSONAR Host Metrics | ||
License: ASL 2.0 | ||
Group: Development/Libraries | ||
URL: http://www.perfsonar.net | ||
Source0: perfsonar-host-metrics-%{version}.tar.gz | ||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | ||
BuildArch: noarch | ||
Requires: perfsonar-common | ||
Requires: openssl | ||
Requires: prometheus-node-exporter | ||
Requires: httpd | ||
Requires: mod_ssl | ||
Requires: selinux-policy-%{selinuxtype} | ||
Requires(post): selinux-policy-%{selinuxtype} | ||
BuildRequires: selinux-policy-devel | ||
%{?selinux_requires} | ||
|
||
%description | ||
A package that installs sets-up Prometheus node_exporter for a perfSONAR install | ||
|
||
%prep | ||
%setup -q -n perfsonar-host-metrics-%{version} | ||
|
||
%build | ||
|
||
%install | ||
make PERFSONAR-ROOTPATH=%{buildroot}/%{pkg_install_base} HTTPD-CONFIGPATH=%{buildroot}/%{httpd_config_base} install | ||
|
||
%clean | ||
rm -rf %{buildroot} | ||
|
||
%post | ||
#Restart/enable opensearch and logstash | ||
%systemd_post node_exporter.service | ||
if [ "$1" = "1" ]; then | ||
#set SELinux booleans to allow httpd proxy to work | ||
%selinux_set_booleans -s %{selinuxtype} %{selinuxbooleans} | ||
#update node_exporter to monitor pS processes | ||
%{pkg_install_base}/exporter_opts.sh | ||
|
||
###### | ||
#if new install, then enable | ||
systemctl daemon-reload | ||
systemctl enable node_exporter.service | ||
systemctl restart node_exporter.service | ||
#Enable and restart apache for reverse proxy | ||
systemctl enable httpd | ||
systemctl restart httpd | ||
fi | ||
|
||
%preun | ||
%systemd_preun node_exporter.service | ||
|
||
%postun | ||
%systemd_postun_with_restart node_exporter.service | ||
if [ $1 -eq 0 ]; then | ||
%selinux_unset_booleans -s %{selinuxtype} %{selinuxbooleans} | ||
fi | ||
|
||
%files | ||
%defattr(0644,perfsonar,perfsonar,0755) | ||
%license LICENSE | ||
%attr(0755, perfsonar, perfsonar) %{pkg_install_base}/exporter_opts.sh | ||
%attr(0644, perfsonar, perfsonar) %{httpd_config_base}/apache-node_exporter.conf | ||
|
||
%changelog | ||
* Tue Oct 24 2023 [email protected] 5.0.5-0.0.a1 | ||
- Initial package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters