From e8550a4f8dc61822c1816da5b17d18544868ee06 Mon Sep 17 00:00:00 2001 From: Niklas Schnelle Date: Tue, 9 Dec 2025 17:53:57 +0100 Subject: [PATCH] opticsmon: zpcimon: Rename opticsmon to zpcimon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The opticsmon tool started out as a tool for monitoring the health of optical modules in directly attached PCI NICs. In the future however it will also monitor the health of other PCI devices. In particular in a first step it will monitor the health of directly attached NVMe devices. To reflect this broadening of its scope rename opticsmon to zpcimon. Add zpcimon.service and install it both under the new name and symlinked as opticsmon.service for backwards compatibility. Since users are expected to mostly just enable the service this keeps old instructions just working. Reviewed-by: Jan Höppner Signed-off-by: Niklas Schnelle Signed-off-by: Jan Höppner --- .gitignore | 8 +++++--- Makefile | 2 +- README.md | 10 +++++----- scripts/dbginfo.sh | 2 +- systemd/Makefile | 5 ++++- ...pticsmon.service.in => zpcimon.service.in} | 6 +++--- {opticsmon => zpcimon}/Makefile | 20 ++++++++++--------- .../autocompletion_generator_host.c | 3 ++- {opticsmon => zpcimon}/ethtool.c | 0 {opticsmon => zpcimon}/ethtool.h | 0 {opticsmon => zpcimon}/link_mon.c | 0 {opticsmon => zpcimon}/link_mon.h | 0 {opticsmon => zpcimon}/optics_info.c | 0 {opticsmon => zpcimon}/optics_info.h | 0 {opticsmon => zpcimon}/optics_sclp.c | 0 {opticsmon => zpcimon}/optics_sclp.h | 0 opticsmon/opticsmon.8 => zpcimon/zpcimon.8 | 10 +++++----- opticsmon/opticsmon.c => zpcimon/zpcimon.c | 5 ++--- .../opticsmon_cli.h => zpcimon/zpcimon_cli.h | 0 19 files changed, 39 insertions(+), 32 deletions(-) rename systemd/{opticsmon.service.in => zpcimon.service.in} (66%) rename {opticsmon => zpcimon}/Makefile (79%) rename {opticsmon => zpcimon}/autocompletion_generator_host.c (72%) rename {opticsmon => zpcimon}/ethtool.c (100%) rename {opticsmon => zpcimon}/ethtool.h (100%) rename {opticsmon => zpcimon}/link_mon.c (100%) rename {opticsmon => zpcimon}/link_mon.h (100%) rename {opticsmon => zpcimon}/optics_info.c (100%) rename {opticsmon => zpcimon}/optics_info.h (100%) rename {opticsmon => zpcimon}/optics_sclp.c (100%) rename {opticsmon => zpcimon}/optics_sclp.h (100%) rename opticsmon/opticsmon.8 => zpcimon/zpcimon.8 (88%) rename opticsmon/opticsmon.c => zpcimon/zpcimon.c (98%) rename opticsmon/opticsmon_cli.h => zpcimon/zpcimon_cli.h (100%) diff --git a/.gitignore b/.gitignore index 36a2c851..37ec4d8b 100644 --- a/.gitignore +++ b/.gitignore @@ -102,9 +102,11 @@ lsstp/_lsstp lsstp/lsstp.bash mon_tools/mon_fsstatd mon_tools/mon_procd -opticsmon/opticsmon -opticsmon/_opticsmon -opticsmon/opticsmon.bash +zpcimon/zpcimon +zpcimon/zpcimon.bash +zpcimon/_zpcimon +zpcimon/opticsmon.bash +zpcimon/_opticsmon osasnmpd/osasnmpd qetharp/qetharp qethqoat/qethqoat diff --git a/Makefile b/Makefile index 4dbce8cc..5aafb56c 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ TOOL_DIRS = zipl zdump fdasd dasdfmt dasdview tunedasd \ vmcp man mon_tools dasdinfo vmur cpuplugd ipl_tools \ ziomon iucvterm hyptop cmsfs-fuse qethqoat zfcpdump zdsfs cpumf \ systemd hmcdrvfs cpacfstats zdev dump2tar zkey netboot etc zpcictl \ - lsstp hsci hsavmcore chreipl-fcp-mpath ap_tools rust opticsmon \ + lsstp hsci hsavmcore chreipl-fcp-mpath ap_tools rust zpcimon \ zpwr zmemtopo else diff --git a/README.md b/README.md index 91d61c5a..4045b0f8 100644 --- a/README.md +++ b/README.md @@ -316,7 +316,7 @@ build options: | glibc-static | `HAVE_LIBC_STATIC` | zfcpdump | | openssl | `HAVE_OPENSSL` | zkey, libekmfweb, libkmipclient, | | | | zgetdump, rust/pvattest, rust/pvimg, | -| | | zgetdump/pvsecret, opticsmon | +| | | zgetdump/pvsecret, zpcimon | | cryptsetup | `HAVE_CRYPTSETUP2` | zkey-cryptsetup | | json-c | `HAVE_JSONC` | zkey-cryptsetup, libekmfweb, | | | | libkmipclient | @@ -326,7 +326,7 @@ build options: | libxml2 | `HAVE_LIBXML2` | libkmipclient | | systemd | `HAVE_SYSTEMD` | hsavmcore | | libudev | `HAVE_LIBUDEV` | cpacfstatsd | -| libnl3 | `HAVE_LIBNL3` | opticsmon | +| libnl3 | `HAVE_LIBNL3` | zpcimon | This table lists additional build or install options: @@ -374,10 +374,10 @@ the different tools are provided: The runtime requirements are: openssl-libs (>= 1.1.1) and libcurl. -* opticsmon: - For building opticsmon OpenSSL and the Netlink Library Suite (libnl3) are +* zpcimon: + For building zpcimon OpenSSL and the Netlink Library Suite (libnl3) are required. - Tip: you may skip the opticsmon build by adding + Tip: you may skip the zpcimon build by adding `HAVE_OPENSSL=0` or `HAVE_LIBNL3=0` * osasnmpd: diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh index e5c35bbf..ec6227f1 100755 --- a/scripts/dbginfo.sh +++ b/scripts/dbginfo.sh @@ -629,7 +629,7 @@ NETWORK_CMDS="ip -br a\ :nstat -az\ :openssl engine # deprecated in OpenSSL 3.n\ :openssl list --providers 2>/dev/null # redirect help on older systems\ - :opticsmon --module-info\ + :opticsmon --module-info\ # Now called zpcimon but kept for compatibility :route -n\ " diff --git a/systemd/Makefile b/systemd/Makefile index 9388fd9c..29e29b63 100644 --- a/systemd/Makefile +++ b/systemd/Makefile @@ -4,7 +4,7 @@ SYSTEM_UNITS = ttyrun-getty@.service iucvtty-login@.service \ cpacfstatsd.service cpuplugd.service \ dumpconf.service cpi.service \ mon_fsstatd.service mon_procd.service \ - opticsmon.service + zpcimon.service all: @@ -19,6 +19,9 @@ install: system_units $(INSTALL) -g $(GROUP) -o $(OWNER) \ -m 644 $$unit $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) ; \ done + # Make the legacy opticsmon.service a link to zpcimon.service + ln -sf zpcimon.service \ + $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)/opticsmon.service else diff --git a/systemd/opticsmon.service.in b/systemd/zpcimon.service.in similarity index 66% rename from systemd/opticsmon.service.in rename to systemd/zpcimon.service.in index 335d9165..cf1ea122 100644 --- a/systemd/opticsmon.service.in +++ b/systemd/zpcimon.service.in @@ -1,5 +1,5 @@ # -# Systemd unit for mon_fsstatd (monitor z/VM guest file systems) +# Systemd unit for zpcimon PCI NIC optical module monitoring # # Copyright IBM Corp. 2024 # @@ -9,11 +9,11 @@ [Unit] Description=Monitor health of directly attached PCI NIC optical modules -# Documentation=man:opticsmon +# Documentation=man:zpcimon [Service] Type=exec -ExecStart=@usrsbin_path@/opticsmon --send-report --monitor --interval 86400 +ExecStart=@usrsbin_path@/zpcimon --send-report --monitor --interval 86400 KillMode=control-group [Install] diff --git a/opticsmon/Makefile b/zpcimon/Makefile similarity index 79% rename from opticsmon/Makefile rename to zpcimon/Makefile index e42b6329..43fc2a04 100644 --- a/opticsmon/Makefile +++ b/zpcimon/Makefile @@ -2,8 +2,8 @@ include ../common.mak TESTS := tests/ -zsh-completions = _opticsmon -bash-completions = opticsmon.bash +zsh-completions = _zpcimon +bash-completions = zpcimon.bash include ../common_autocomp.mak @@ -12,7 +12,7 @@ libs =$(rootdir)/libzpci/libzpci.a $(rootdir)/libutil/libutil.a ifneq (${HAVE_OPENSSL},0) check_dep_openssl: $(call check_dep, \ - "opticsmon", \ + "zpcimon", \ "openssl/evp.h", \ "openssl-devel", \ "HAVE_OPENSSL=0") @@ -22,7 +22,7 @@ endif # HAVE_OPENSSL ifneq (${HAVE_LIBNL3},0) check_dep_libnl3: $(call check_dep, \ - "opticsmon", \ + "zpcimon", \ "netlink/socket.h", \ "libnl3-devel", \ "HAVE_LIBNL3=0") @@ -69,20 +69,22 @@ endif ALL_CPPFLAGS += $(LIB_CFLAGS) LDLIBS += $(LIB_LFLAGS) -BUILDTARGET += opticsmon +BUILDTARGET += zpcimon all: ${BUILDTARGET} -opticsmon: opticsmon.o optics_info.o optics_sclp.o ethtool.o link_mon.o $(libs) +zpcimon: zpcimon.o optics_info.o optics_sclp.o ethtool.o link_mon.o $(libs) install: all $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man8 - $(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 opticsmon $(DESTDIR)$(BINDIR) - $(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 opticsmon.8 \ + $(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 zpcimon $(DESTDIR)$(BINDIR) + $(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 zpcimon.8 \ $(DESTDIR)$(MANDIR)/man8 + ln -sf zpcimon $(DESTDIR)$(BINDIR)/opticsmon + ln -sf zpcimon.8 $(DESTDIR)$(MANDIR)/man8/opticsmon.8 endif # HAVE_OPENSSL3=0 or HAVE_LIBNL3=0 clean: - rm -f *.o *~ opticsmon core + rm -f *.o *~ zpcimon core .PHONY: all install clean diff --git a/opticsmon/autocompletion_generator_host.c b/zpcimon/autocompletion_generator_host.c similarity index 72% rename from opticsmon/autocompletion_generator_host.c rename to zpcimon/autocompletion_generator_host.c index 4ce9fdf1..aeefab2f 100644 --- a/opticsmon/autocompletion_generator_host.c +++ b/zpcimon/autocompletion_generator_host.c @@ -6,10 +6,11 @@ #include "lib/util_autocomp.h" -#include "opticsmon_cli.h" +#include "zpcimon_cli.h" int main(void) { + generate_autocomp(opt_vec, "zpcimon"); generate_autocomp(opt_vec, "opticsmon"); return 0; diff --git a/opticsmon/ethtool.c b/zpcimon/ethtool.c similarity index 100% rename from opticsmon/ethtool.c rename to zpcimon/ethtool.c diff --git a/opticsmon/ethtool.h b/zpcimon/ethtool.h similarity index 100% rename from opticsmon/ethtool.h rename to zpcimon/ethtool.h diff --git a/opticsmon/link_mon.c b/zpcimon/link_mon.c similarity index 100% rename from opticsmon/link_mon.c rename to zpcimon/link_mon.c diff --git a/opticsmon/link_mon.h b/zpcimon/link_mon.h similarity index 100% rename from opticsmon/link_mon.h rename to zpcimon/link_mon.h diff --git a/opticsmon/optics_info.c b/zpcimon/optics_info.c similarity index 100% rename from opticsmon/optics_info.c rename to zpcimon/optics_info.c diff --git a/opticsmon/optics_info.h b/zpcimon/optics_info.h similarity index 100% rename from opticsmon/optics_info.h rename to zpcimon/optics_info.h diff --git a/opticsmon/optics_sclp.c b/zpcimon/optics_sclp.c similarity index 100% rename from opticsmon/optics_sclp.c rename to zpcimon/optics_sclp.c diff --git a/opticsmon/optics_sclp.h b/zpcimon/optics_sclp.h similarity index 100% rename from opticsmon/optics_sclp.h rename to zpcimon/optics_sclp.h diff --git a/opticsmon/opticsmon.8 b/zpcimon/zpcimon.8 similarity index 88% rename from opticsmon/opticsmon.8 rename to zpcimon/zpcimon.8 index a810792d..3c274b45 100644 --- a/opticsmon/opticsmon.8 +++ b/zpcimon/zpcimon.8 @@ -30,20 +30,20 @@ . br .. . -.TH opticsmon 8 "Oct 2024" s390-tools zpcictl +.TH zpcimon 8 "Oct 2024" s390-tools zpcictl . .SH NAME -opticsmon - Monitor optical modules for directly attached PCI based NICs +zpcimon - Monitor optical modules for directly attached PCI based NICs . . .SH SYNOPSIS -.B "opticsmon" +.B "zpcimon" .I "OPTIONS" . . .SH DESCRIPTION Use -.B opticsmon +.B zpcimon to monitor the health of the optical modules of directly attached PCI based NICs. When executed without the \fB--monitor\fR option it will collect optical module data from all available PCI network interface physical functions and @@ -80,7 +80,7 @@ on". .B Example: Extract module information for the first adapter -.CL opticsmon --module-info | jq -r '.adapters[0].netdevs[0].optics.module_info' | base64 -d | hexdump -C +.CL zpcimon --module-info | jq -r '.adapters[0].netdevs[0].optics.module_info' | base64 -d | hexdump -C .PP .PP . diff --git a/opticsmon/opticsmon.c b/zpcimon/zpcimon.c similarity index 98% rename from opticsmon/opticsmon.c rename to zpcimon/zpcimon.c index f86056d4..7df87e81 100644 --- a/opticsmon/opticsmon.c +++ b/zpcimon/zpcimon.c @@ -31,7 +31,7 @@ #include "link_mon.h" #include "optics_info.h" #include "optics_sclp.h" -#include "opticsmon_cli.h" +#include "zpcimon_cli.h" #define API_LEVEL 1 @@ -52,8 +52,7 @@ struct opticsmon_ctx { }; static const struct util_prg prg = { - .desc = "Use opticsmon to monitor the health of the optical modules\n" - "of directly attached PCI based NICs", + .desc = "Use zpcimon to monitor the health of PCI devices", .copyright_vec = { { .owner = "IBM Corp.", .pub_first = 2024, diff --git a/opticsmon/opticsmon_cli.h b/zpcimon/zpcimon_cli.h similarity index 100% rename from opticsmon/opticsmon_cli.h rename to zpcimon/zpcimon_cli.h