From 965055548b7a43cb42a63534aa10d8587e94401b Mon Sep 17 00:00:00 2001 From: babic_a Date: Wed, 25 Nov 2026 14:36:15 +0100 Subject: [PATCH] Monitoring Tools: picture instead of table, the services underneath (iocinfo, sysreport); Knowledge Center: iocinfo reference Co-Authored-By: Claude Fable 5.2 --- .../Tools/08_monitoring_tools.md | 22 +++++----- .../06_references/01_it_infrastructure.md | 44 +++++++++++++++++++ 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/docs/2._Services_Portfolio/Tools/08_monitoring_tools.md b/docs/2._Services_Portfolio/Tools/08_monitoring_tools.md index 55eb38ea..d3fb499e 100644 --- a/docs/2._Services_Portfolio/Tools/08_monitoring_tools.md +++ b/docs/2._Services_Portfolio/Tools/08_monitoring_tools.md @@ -13,17 +13,7 @@ tags: ![Which tool for which question: IOC running or red, host state, PVs and CA gateways in gfa-monitoring; host load history in Grafana; logs in Kibana or with journalctl; past PV values in the archiver viewer](images/08_monitoring_chooser.svg) -| Your question | Open | Where | -|---|---|---| -| Is my IOC running? Why is it red? | [gfa-monitoring](#gfa-monitoring), IOC details | [http://gfa-monitoring.psi.ch](http://gfa-monitoring.psi.ch) | -| Is my host all right? Which IOCs run on it? | gfa-monitoring, Host details | same | -| Is a PV served, and by which IOC? Is a CA gateway all right? | gfa-monitoring, PV list and Gateways | same | -| How loaded is a host? CPU and memory over time? | [Grafana](#grafana-host-metrics), dashboard "Linux GFA" | [https://metrics.psi.ch](https://metrics.psi.ch) | -| What did a service or IOC log? | [Kibana](#logs-kibana-and-journalctl) centrally, `journalctl` on the host | [https://kibana.psi.ch](https://kibana.psi.ch) | -| What was a PV doing in the past? | [Archiver Viewer](07_archiver_viewer.md) | | -| The same questions from a terminal | [IOC Utils](#ioc-utils-on-the-command-line), the `ioc` command | on every Controls host | - -What Controls IT collects and how the logs travel is described in [Controls IT Services: Logging](../Services/03_devops.md#logging) and [Monitoring](../Services/03_devops.md#monitoring). +The same questions can be answered from a terminal with the `ioc` command, see [IOC Utils: on the command line](#ioc-utils-on-the-command-line). What Controls IT collects and how the logs travel is described in [Controls IT Services: Logging](../Services/03_devops.md#logging) and [Monitoring](../Services/03_devops.md#monitoring). ## gfa-monitoring @@ -97,6 +87,16 @@ Open **PV list** and search for the PV name. The result shows the IOC and the ho Open **Gateways** and filter by facility or gateway name. The live status comes from the gateway's statistics PVs: ok when they answer, warn when fewer than half of the requested PVs are connected, unknown when the statistics PVs did not answer. Beamline gateways answer through `sls-cagw`. **Live statistics** on a row shows the gateway's counters (PVs connected, clients, rates, load). More on the gateways, and what to do when a channel is not reachable: [CA gateways](../Services/02_computingandboot.md#ca-gateways). +## What does the work underneath + +gfa-monitoring is the view. The data comes from services underneath it, which you can also use directly: + +- **iocinfo** ([http://iocinfo.psi.ch](http://iocinfo.psi.ch)): every IOC sends its information to iocinfo when it starts: where and when it booted, the libraries it loaded and its records. iocinfo stores this and serves it through a REST API. gfa-monitoring imports its list of IOCs from there, and the `ioc search`, `ioc records`, `ioc libraries` and `ioc boots` commands ask it directly. The API is described at [http://iocinfo.psi.ch/swagger-ui.html](http://iocinfo.psi.ch/swagger-ui.html). If your own application needs this data, use the REST API, not the `ioc` command. +- **sysreport** (`sysreport.psi.ch`): the host information database. Each Linux host reports about itself once per day; gfa-monitoring imports these reports every hour. +- **Channel Access**: the live state of IOCs and gateways is read directly from their PVs. + +How iocinfo works in detail is in the Knowledge Center: [IT Infrastructure reference: iocinfo](../../3._Knowledge_Center/06_references/01_it_infrastructure.md#iocinfo). + ## IOC Utils: on the command line The `ioc` command gives you the same information in a terminal. It is installed on every Controls host. The basic commands: diff --git a/docs/3._Knowledge_Center/06_references/01_it_infrastructure.md b/docs/3._Knowledge_Center/06_references/01_it_infrastructure.md index 0207e20f..ba23f8d5 100644 --- a/docs/3._Knowledge_Center/06_references/01_it_infrastructure.md +++ b/docs/3._Knowledge_Center/06_references/01_it_infrastructure.md @@ -81,6 +81,50 @@ Run it as a systemd unit and write to stdout and stderr; both go to the journal - **rsyslog** (`log_client::legacy_logs: true`): on EL7/EL8 Puppet writes `/etc/rsyslog.conf` and forwards `*.*` to each `log_client::forward_to` server over UDP; on EL9 only the max-open-files setting is managed. In the hiera data only `gfa-smtp-relay` (`data-cocos`) sets it. `role::log_server` (rsyslog plus `systemd-journal-remote`) is used by `xbl-log` in `data-cocos`. - **Logstash and Beats** (repository `controls_it/gfa_ansible_elastic`, Ansible, last change 2021): Logstash 7.9.2 on `gfa-logstash` receives syslog, RF logs, CA put logs and PCO logs and writes indices `logstash-gfa_-`; the CA put log is searched in Kibana with the index pattern `logstash-gfa_caputlog*`. Journalbeat 7.9.1 on the CA gateways ships selected units to the space `gfa` (alias `journalbeat-gfa_7.9.1`); the gateway logs are in the saved Kibana view on `https://kibana.psi.ch/s/gfa/`, filtered on `agent.hostname`. +## iocinfo + +iocinfo collects the information that IOCs send when they start and serves it through a REST API. It is the backend of the `ioc search`, `ioc records`, `ioc libraries`, `ioc boots` and `ioc duplicates` commands (formerly `findrecord`, `bootinfo` and `libversionShow`), it tells `ioc shell`, `ioc restart` and `ioc connect` where an IOC runs, and gfa-monitoring imports its list of IOCs from it. Users see it through [IOC Utils](../../2._Services_Portfolio/Tools/01_ioc_utils.md) and [Monitoring Tools](../../2._Services_Portfolio/Tools/08_monitoring_tools.md). + +### How the data gets in + +- An IOC loads the EPICS module `iocinfo`, which sends the IOC's boot information, its loaded libraries and its records to the server at startup. The server's upload endpoint is `POST /api/v2/upload`. +- For older IOCs the server also offers the API of the former bootinfo server (`upload-libinfo.ashx`, `records.aspx`, `bootnotify.aspx`), which upload scripts on the boot PCs call during IOC startup. +- Each IOC is assigned to a facility by the rules in `facility_mapping.csv`. + +### Query API + +Base address: `http://iocinfo.psi.ch/api/v2`. The full description is at [http://iocinfo.psi.ch/swagger-ui.html](http://iocinfo.psi.ch/swagger-ui.html); use the base address given here, not the one shown there. The v1 API is deprecated. + +| `GET` | Returns | Used by | +|---|---|---| +| `/ioc` | names of IOCs; filters `pattern`, `facility`, `library`, `libraryVersion` (regular expressions) | `ioc search` | +| `/ioc/{name}` | everything known about one IOC: boot, libraries, records, shell host and port | `ioc shell`, `ioc restart` | +| `/ioc/{name}/history` | the boot history of one IOC | `ioc boots -i` | +| `/boots` | boots of IOCs | `ioc boots` | +| `/records` | records, filtered by name, IOC or facility | `ioc records` | +| `/records/duplicates` | record names defined on more than one IOC | `ioc duplicates` | +| `/search` | IOCs with their boot and library data | `ioc libraries`, the gfa-monitoring import | +| `/cablings`, `/cabling/{ioc}` | port server cabling of IOC consoles | `ioc connect` | +| `/facilities` | the facilities known to the server | | + +If another application needs the data, or you need another format such as CSV, call the API directly and do not parse the output of the `ioc` command. Examples with `curl` and `jq`: + + # channel names of one IOC + curl http://iocinfo.psi.ch/api/v2/ioc/ | jq -r .records[].name + + # libraries and versions of one IOC + curl http://iocinfo.psi.ch/api/v2/ioc/ | jq -r '.libraries[] | .name + " " + .version' + + # all records of one facility + curl "http://iocinfo.psi.ch/api/v2/records?facility=swissfel" + +### Operation + +- The service runs as a container (`iocinfo.service`) on `iocinfo.psi.ch`. +- Its data is on NFS, mounted at `/data/iocinfo`: uploaded information in `infos`, the content of failed uploads in `upload_errors`. +- To change the facility mapping, update `facility_mapping.csv` in the repository, copy it to `/data/iocinfo` on the server and restart `iocinfo.service`. `facility_update.py` re-assigns the IOCs already stored; it can run for hours. +- Source and build instructions: [controls_it/iocinfo](https://gitea.psi.ch/controls_it/iocinfo) (access needed). + ## Host types and packages The host types from the Puppet hiera data, with the package groups and packages Puppet installs on each: [Host Types and Packages](04_host_types.md).