plugins icon indicating copy to clipboard operation
plugins copied to clipboard

feat: Introduce xymon-client plugin

Open kumy opened this issue 1 year ago • 11 comments

Closes #4259 Relates opnsense/tools#434

image

kumy avatar Sep 27 '24 15:09 kumy

shown on dashboard Services widget

Can someone explain how to add the service to the widget? :pray:

image

kumy avatar Sep 27 '24 15:09 kumy

@kumy You create an inc file for your plugin like this, if I remember correctly. It returns the services.

https://github.com/opnsense/plugins/blob/bd009e41c3031453009da074225a307565d1a45d/www/caddy/src/etc/inc/plugins.inc.d/caddy.inc#L29

Monviech avatar Sep 27 '24 19:09 Monviech

@Monviech Thanks! Added :man_dancing:

kumy avatar Sep 28 '24 06:09 kumy

Another question, the service is not automatically started after boot. Anything special to do? :pray:

EDIT: problably something related to bootup

https://github.com/opnsense/plugins/blob/bd009e41c3031453009da074225a307565d1a45d/net/upnp/src/etc/inc/plugins.inc.d/miniupnpd.inc#L92

EDIT2: According to https://docs.opnsense.org/development/backend/overview.html#bootup, method 7 seems the new way. Trying…

EDIT3: got it working. EDIT4: will rename xymon to xymonclient

kumy avatar Sep 28 '24 07:09 kumy

@kumy did a very quick review and left some remarks/tips.

AdSchellevis avatar Oct 12 '24 16:10 AdSchellevis

@AdSchellevis thanks for the review.

Except the 2 comments left open above, everything else has been adjusted.

kumy avatar Nov 09 '24 15:11 kumy

@kumy ok, maybe the better question is then if there's anything in /usr/local/www/xymon/ that should be accessible (without any constraints) via http[s]. If that's not the case, we can try to search for alternatives, either by pushing a new WWWDIR during build in https://github.com/opnsense/ports/blob/3c574e41e4e45df72cbb64c060a5637dd1d64f29/net-mgmt/xymon-client/files/xymon-client.in#L16 or making a copy of the rc file which ships to something like /usr/local/etc/rc.d/opn-xymon-client with the proper attributes set.

AdSchellevis avatar Nov 09 '24 17:11 AdSchellevis

there's anything in /usr/local/www/xymon/ that should be accessible (without any constraints) via http[s]

The client does not publish any webservice. It collects status/metrics and send them to the Xymon Server(s).

making a copy of the rc file which ships to something like /usr/local/etc/rc.d/opn-xymon-client with the proper attributes set.

So a dedicated/forked rc init script.

@AdSchellevis Couldn't we do like Debian and just add one line to the /etc/xymon/xymonclient.cfg (eg Debian do: include /etc/default/xymon-client at the top of file.) This is technically what I did/need with the PostInstall script... I just add include /usr/local/etc/xymon/xymonclient.cfg

Do you have any pointer/example to create a patch for https://github.com/opnsense/ports/tree/3c574e41e4e45df72cbb64c060a5637dd1d64f29/net-mgmt/xymon-client. We would need to patch a file coming from the xymon-4.3.30.tar.gz.

Example from Debian:

$ cat /etc/xymon/xymonclient.cfg
# Environment settings for the Xymon client.

include /etc/default/xymon-client
include /var/run/xymon/bbdisp-runtime.cfg
CONFIGCLASS="$SERVEROSTYPE"     # Default configuration class for logfiles

PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/lib/xymon/client/bin"  # PATH setting for the client scripts.
SHELL="/bin/sh"				# Shell to use when forking programs

# You normally don't need to modify anything below here
XYMONDPORT="1984"                   # Portnumber where xymond listens
XYMONCLIENTHOME="/usr/lib/xymon/client"
XYMONHOME="$XYMONCLIENTHOME"       # Directory for the Xymon client files
XYMON="$XYMONHOME/bin/xymon"          # The Xymon client "xymon" utility
XYMONTMP="/var/lib/xymon/tmp"     # Where we may store temporary files.
XYMONCLIENTLOGS="/var/log/xymon"  # Where we store the client logfiles

include /var/run/xymon/xymonclient-include.cfg

# Options to logfetch, the xymon binary which examines log files for recent changes.
LOGFETCHOPTS=""
[…]
$ cat /etc/default/xymon-client
# Configure the Xymon client settings.

# You MUST set the list of Xymon servers that this
# client reports to.
# It is good to use IP-addresses here instead of DNS
# names - DNS might not work if there's a problem.
#
# E.g. (a single Xymon server)
#   XYMONSERVERS="192.168.1.1"
# or (multiple servers)
#   XYMONSERVERS="10.0.0.1 192.168.1.1"

XYMONSERVERS="myxymonserver.example"

# The defaults usually suffice for the rest of this file, 
# but you can tweak the hostname that the client reports 
# data with, and the OS name used (typically needed only on 
# RHEL or RHAS servers).

# CLIENTHOSTNAME=""
# CLIENTOS="rhel3"

CLIENTHOSTNAME="myhostname.example"

# Optionally mount a tmpfs on /var/lib/xymon/tmp. On client systems this has
# the advantage that client reports will continue to work even if the /var
# filesystem is out of space. This setting is ignored on server systems where
# this directory contains important information that must be preserved over
# reboots (xymond.chk).

#TMPFSSIZE="5000000"

kumy avatar Nov 09 '24 18:11 kumy

Patching in ports should work similar to the change already in the Makefile (https://github.com/opnsense/ports/blob/3c574e41e4e45df72cbb64c060a5637dd1d64f29/net-mgmt/xymon-client/files/patch-Makefile). If I'm not mistaken (@fichtner usually handles these), you can drop a file there and build / install from the ports directory in the usuall way.

AdSchellevis avatar Nov 11 '24 08:11 AdSchellevis

@AdSchellevis / @fichtner This PR and https://github.com/opnsense/ports/pull/206 should be ready for another review round :pray:

kumy avatar Nov 11 '24 11:11 kumy

Blocked by opnsense/ports#206

kumy avatar Mar 27 '25 06:03 kumy