Skip to content

Commit

Permalink
Merge pull request #4242 from nvollmar/T6953
Browse files Browse the repository at this point in the history
T6953: merges node and frr exporter under prometheus section
  • Loading branch information
c-po authored Dec 20, 2024
2 parents ff13d4d + 5a44b71 commit 637e4ce
Show file tree
Hide file tree
Showing 13 changed files with 272 additions and 332 deletions.
8 changes: 4 additions & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ Depends:
squidclient,
squidguard,
# End "service webproxy"
# For "service monitoring node-exporter"
# For "service monitoring prometheus node-exporter"
node-exporter,
# End "service monitoring node-exporter"
# For "service monitoring frr-exporter"
# End "service monitoring prometheus node-exporter"
# For "service monitoring prometheus frr-exporter"
frr-exporter,
# End "service monitoring frr-exporter"
# End "service monitoring prometheus frr-exporter"
# For "service monitoring telegraf"
telegraf (>= 1.20),
# End "service monitoring telegraf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- include start from include/version/monitoring-version.xml.i -->
<syntaxVersion component='monitoring' version='1'></syntaxVersion>
<syntaxVersion component='monitoring' version='2'></syntaxVersion>
<!-- include end -->
25 changes: 0 additions & 25 deletions interface-definitions/service_monitoring_frr_exporter.xml.in

This file was deleted.

25 changes: 0 additions & 25 deletions interface-definitions/service_monitoring_node_exporter.xml.in

This file was deleted.

45 changes: 45 additions & 0 deletions interface-definitions/service_monitoring_prometheus.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<interfaceDefinition>
<node name="service">
<children>
<node name="monitoring">
<children>
<node name="prometheus" owner="${vyos_conf_scripts_dir}/service_monitoring_prometheus.py">
<properties>
<help>Prometheus metric exporter</help>
<priority>1280</priority>
</properties>
<children>
<node name="node-exporter">
<properties>
<help>Prometheus exporter for hardware and operating system metrics</help>
</properties>
<children>
#include <include/listen-address.xml.i>
#include <include/port-number.xml.i>
<leafNode name="port">
<defaultValue>9100</defaultValue>
</leafNode>
#include <include/interface/vrf.xml.i>
</children>
</node>
<node name="frr-exporter">
<properties>
<help>Prometheus exporter for FRR metrics</help>
</properties>
<children>
#include <include/listen-address.xml.i>
#include <include/port-number.xml.i>
<leafNode name="port">
<defaultValue>9342</defaultValue>
</leafNode>
#include <include/interface/vrf.xml.i>
</children>
</node>
</children>
</node>
</children>
</node>
</children>
</node>
</interfaceDefinition>
64 changes: 0 additions & 64 deletions smoketest/scripts/cli/test_service_monitoring_node-exporter.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@
from vyos.utils.process import process_named_running
from vyos.utils.file import read_file

PROCESS_NAME = 'frr_exporter'
base_path = ['service', 'monitoring', 'frr-exporter']
service_file = '/etc/systemd/system/frr_exporter.service'
NODE_EXPORTER_PROCESS_NAME = 'node_exporter'
FRR_EXPORTER_PROCESS_NAME = 'frr_exporter'

base_path = ['service', 'monitoring', 'prometheus']
listen_if = 'dum3421'
listen_ip = '192.0.2.1'
node_exporter_service_file = '/etc/systemd/system/node_exporter.service'
frr_exporter_service_file = '/etc/systemd/system/frr_exporter.service'


class TestMonitoringFrrExporter(VyOSUnitTestSHIM.TestCase):
class TestMonitoringPrometheus(VyOSUnitTestSHIM.TestCase):
@classmethod
def setUpClass(cls):
# call base-classes classmethod
super(TestMonitoringFrrExporter, cls).setUpClass()
super(TestMonitoringPrometheus, cls).setUpClass()
# create a test interfaces
cls.cli_set(
cls, ['interfaces', 'dummy', listen_if, 'address', listen_ip + '/32']
Expand All @@ -40,24 +43,37 @@ def setUpClass(cls):
@classmethod
def tearDownClass(cls):
cls.cli_delete(cls, ['interfaces', 'dummy', listen_if])
super(TestMonitoringFrrExporter, cls).tearDownClass()
super(TestMonitoringPrometheus, cls).tearDownClass()

def tearDown(self):
self.cli_delete(base_path)
self.cli_commit()
self.assertFalse(process_named_running(PROCESS_NAME))
self.assertFalse(process_named_running(NODE_EXPORTER_PROCESS_NAME))
self.assertFalse(process_named_running(FRR_EXPORTER_PROCESS_NAME))

def test_01_node_exporter(self):
self.cli_set(base_path + ['node-exporter', 'listen-address', listen_ip])

# commit changes
self.cli_commit()

file_content = read_file(node_exporter_service_file)
self.assertIn(f'{listen_ip}:9100', file_content)

# Check for running process
self.assertTrue(process_named_running(NODE_EXPORTER_PROCESS_NAME))

def test_01_basic_config(self):
self.cli_set(base_path + ['listen-address', listen_ip])
def test_02_frr_exporter(self):
self.cli_set(base_path + ['frr-exporter', 'listen-address', listen_ip])

# commit changes
self.cli_commit()

file_content = read_file(service_file)
file_content = read_file(frr_exporter_service_file)
self.assertIn(f'{listen_ip}:9342', file_content)

# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
self.assertTrue(process_named_running(FRR_EXPORTER_PROCESS_NAME))


if __name__ == '__main__':
Expand Down
101 changes: 0 additions & 101 deletions src/conf_mode/service_monitoring_frr-exporter.py

This file was deleted.

Loading

0 comments on commit 637e4ce

Please sign in to comment.