Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6953: merges node and frr exporter under prometheus section #4242

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading