Check Service Host Remote Ubuntu

Hello,

I’ve been trying for several days to monitor a service on a remote host not included in the nagios-plugin “Checks” without success.

In addition to installing the above package on LibreNMS and remote host (Ubuntu 22.04), where is hosted the Syslog-NG service that I need to monitor for my client.

I have created a simple script similar to the one in the tutorial hosted on Youtube from the LibreNMS channel (LibreNMS Services - YouTube) and added it as a service.

I attach the script:
[email protected]:/usr/lib/nagios/plugins$ cat check_syslog-ng.py
#!/usr/bin/python3
import os
import sys

output = os.system (‘systemctl is-active syslog-ng’)
print (output)

if output == 0:
print(“OK. Syslog-NG Service Running”)
sys.exit(0)
else:
print(“Critical. Syslog-NG Service Down”)
sys.exit(2)

Running this script from the CLI I get the following:

  • From the remote server:
    [email protected]_remote:/usr/lib/nagios/plugins$ ./check_syslog-ng.py
    active
    0
    OK. Syslog-NG Service Running

  • From the LibreNMS server:
    [email protected]:/usr/lib/nagios/plugins$ ./check_syslog-ng1.py
    inactive
    768
    Critical. Syslog-NG Service Down

  • From the LibreNMS server querying another host:
    [email protected]:/usr/lib/nagios/plugins$ ./check_syslog-ng1.py -H 172.X.X.X.X
    inactive
    768
    Critical. Syslog-NG Service Down

  • The same thing happens from WebUI (as expected):

Both hosts are on the same subnet. LibreNMS is monitoring it correctly.

Attached is ./validate.php
[email protected]:/opt/librenms$ ./validate.php

Component Version
LibreNMS 22.8.0-102-gfd6fdeeb5
DB Schema 2022_09_03_091314_update_ports_adsl_table_with_defaults (246)
PHP 8.1.8
Python 3.10.4
Database MariaDB 10.6.7-MariaDB-2ubuntu1.1
RRDTool 1.7.2
SNMP 5.9.1

====================================

[OK] Composer Version: 2.4.2
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK]
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok
[email protected]@librenms:/opt/librenms$

I would be very grateful if you could help me.

Thank you.