From 441073e91309bfb0c85a856127f52702d07a21bf Mon Sep 17 00:00:00 2001 From: Andy Lake Date: Tue, 19 Dec 2023 09:44:17 -0500 Subject: [PATCH] Initial commit to get some perfsonar prometheus stats. --- .../perfsonar-host-metrics/perfsonar_metrics.py | 16 ++++++++++++++++ .../unibuild-packaging/deb/control | 2 +- .../rpm/perfsonar-host-metrics.spec | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 perfsonar-host-metrics/perfsonar-host-metrics/perfsonar_metrics.py diff --git a/perfsonar-host-metrics/perfsonar-host-metrics/perfsonar_metrics.py b/perfsonar-host-metrics/perfsonar-host-metrics/perfsonar_metrics.py new file mode 100644 index 0000000..c87bf81 --- /dev/null +++ b/perfsonar-host-metrics/perfsonar-host-metrics/perfsonar_metrics.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +from psconfig.utilities.metrics import PSConfigMetricCalculator +from psconfig.utilities.cli import PSCONFIG_CLI_AGENTS + +## +# pSConfig Metrics +for psconfig_agent in PSCONFIG_CLI_AGENTS: + #Try each agent, but don't exit if exception since agent may not be installed + try: + psconfig_calculator = PSConfigMetricCalculator(psconfig_agent["name"].lower()) + psconfig_metrics = psconfig_calculator.run_metrics() + if psconfig_metrics.guid: + print(psconfig_metrics.to_prometheus()) + except: + pass diff --git a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/control b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/control index 240dde1..1e1482e 100644 --- a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/control +++ b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/deb/control @@ -9,7 +9,7 @@ Homepage: http://www.perfsonar.net Package: perfsonar-host-metrics Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends}, prometheus-node-exporter, - openssl, apache2, apache2-ssl-dev, perfsonar-common + openssl, apache2, apache2-ssl-dev, perfsonar-common, python-perfsonar-psconfig Description: Prometheus node-exporter integration with perfSONAR A package that installs and sets-up Prometheus node_exporter for a perfSONAR to collect and report host metrics. diff --git a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/rpm/perfsonar-host-metrics.spec b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/rpm/perfsonar-host-metrics.spec index d0d6b7d..ae95014 100644 --- a/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/rpm/perfsonar-host-metrics.spec +++ b/perfsonar-host-metrics/perfsonar-host-metrics/unibuild-packaging/rpm/perfsonar-host-metrics.spec @@ -25,6 +25,7 @@ BuildArch: noarch Requires: perfsonar-common Requires: openssl Requires: prometheus-node-exporter +Requires: python-perfsonar-psconfig Requires: httpd Requires: mod_ssl Requires: selinux-policy-%{selinuxtype}