SPB Git

Repository Public License

10-system-health-report.yaml 5.6 KB 153 lines yaml

1# =============================================================================2# SP BOUCHER | SOURCE FILE3# =============================================================================4# Project      : ORIX OS Automation5# File         : Workflows/Examples/10-system-health-report.yaml6# Author       : Simon-Pierre Boucher | https://spboucher.ai7# Contact      : support@spboucher.ai8# Copyright    : (c) 2026 Simon-Pierre Boucher9# License      : Proprietary, all rights reserved (see license file)10# =============================================================================11# END OF SP BOUCHER SOURCE HEADER12# =============================================================================1314# ORIX OS Automation15# File: Workflows/Examples/10-system-health-report.yaml16# Description: Built-in automation: collects system, disk, process, power and network facts into a dated Markdown report.17#18# Author: Simon-Pierre Boucher19# Contact: contact@spboucher.ai20#21# Limitations22# - Read-only observation: nothing is cleaned, quit or changed. The only write is the report file.23# - Values are what the system tools report at the moment of the run (a snapshot, not a trend).24# - "Free" is the space macOS reports as available for important usage on the startup volume (purgeable space25#   included), which is what Finder shows; it can differ from `df`.26# - The low-disk notification compares that free fraction with `minFreeFraction`. It needs the ORIX app (a command-line27#   run has no application bundle): there the warning step fails by itself and the run ends PARTIALLY_SUCCEEDED.28# - Sections are written as JSON blocks, exactly as the tools returned them. Process names are those of `ps`.29# - A dry run executes no read tool, so it has no disk figures: the steps after the collection are reported as skipped.30apiVersion: orix.ai/v131kind: Automation32metadata:33  id: system-health-report34  name: Local system health report35  description: >-36    Collects system information, disk usage, the busiest processes, power state and network state at the37    same time, writes them into a dated Markdown report and warns when the startup disk is nearly full.38  tags: [system, health, report]39spec:40  triggers:41    - type: manual42    - type: schedule43      cron: "0 12 * * *"44  parameters:45    - name: outputFolder46      type: path47      default: ~/ORIX Samples/system-health-report/Reports48      description: Folder that receives the report.49    - name: minFreeFraction50      type: number51      default: 0.152      description: Warn when less than this fraction of the startup disk is free.53  permissions:54    filesystem:55      read: ["${{ params.outputFolder }}"]56      write: ["${{ params.outputFolder }}"]57    notifications: true58  budget:59    maxDurationSeconds: 18060    maxToolCalls: 1561  steps:62    - id: paths63      set:64        report: ${{ params.outputFolder }}/health-${{ env.DATE }}.md65    - id: prepare66      tool: filesystem.mkdir67      with:68        path: ${{ params.outputFolder }}69    - id: collect70      name: Collect facts in parallel71      parallel:72        - name: machine73          steps:74            - id: info75              tool: system.info76        - name: disk77          steps:78            - id: disk79              tool: system.diskUsage80        - name: processes81          steps:82            - id: processes83              tool: system.processes84              with:85                limit: 1086                sortBy: cpu87        - name: power88          steps:89            - id: power90              tool: system.powerState91        - name: network92          steps:93            - id: network94              tool: system.networkState95    - id: startup96      name: Pick the startup volume97      needs: [collect]98      transform: ${{ first(filter(steps.collect.output.disk.disk.volumes, v => v.path == "/")) }}99    - id: freeFraction100      needs: [startup]101      when: ${{ steps.startup.output != null }}102      transform: ${{ steps.startup.output.availableBytes / steps.startup.output.totalBytes }}103    - id: write104      name: Write the report105      needs: [paths, prepare, freeFraction]106      tool: filesystem.write107      with:108        path: ${{ vars.report }}109        overwrite: true110        content: |111          # System health — ${{ env.DATETIME }}112113          Free space on the startup disk: ${{ steps.freeFraction.output * 100 }} % (${{ steps.startup.output.availableBytes }} of ${{ steps.startup.output.totalBytes }} bytes)114115          ## Machine116          ${{ toJSON(steps.collect.output.machine.info) }}117118          ## Disk119          ${{ toJSON(steps.collect.output.disk.disk.volumes) }}120121          ## Busiest processes122          ${{ toJSON(steps.collect.output.processes.processes.processes) }}123124          ## Power125          ${{ toJSON(steps.collect.output.power.power) }}126127          ## Network128          ${{ toJSON(steps.collect.output.network.network) }}129    - id: check130      needs: [write]131      verify:132        - fileContains: ${{ vars.report }}133          text: "## Network"134        - truthy: ${{ steps.freeFraction.output > 0 && steps.freeFraction.output <= 1 }}135        - truthy: ${{ steps.collect.output.machine.info.cores > 0 }}136    - id: result137      needs: [check]138      output:139        report: ${{ vars.report }}140        freeFraction: ${{ steps.freeFraction.output }}141        lowDisk: ${{ steps.freeFraction.output < params.minFreeFraction }}142        osVersion: ${{ steps.collect.output.machine.info.osVersion }}143      artifacts:144        - ${{ vars.report }}145    - id: lowDisk146      needs: [result]147      if: ${{ steps.freeFraction.output < params.minFreeFraction }}148      then: [warn]149    - id: warn150      notify: Less than ${{ params.minFreeFraction * 100 }} % of the startup disk is free.151      title: System health152      continueOnError: true153
Files main
Menu

Theme