From 5f142e9722b00dd22e5474994323c9b68e8c2ddb Mon Sep 17 00:00:00 2001
From: Erik von Reis <evonreis@caltech.edu>
Date: Mon, 19 Oct 2020 18:18:01 -0700
Subject: [PATCH] rtcds status improved to not look for dolphin on non-dolphin
 hosts.  Hosts must have IS_DOLPHIN_NODE=true for rtcds to check dolphin
 modules etc. Likewise, rtcds will not check streamers and local DC if there
 there is no DAQ streaming.  Set DAQ_STREAMING=true to force rtcds to check
 streamers.

---
 support/bin/rtcds.in | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/support/bin/rtcds.in b/support/bin/rtcds.in
index dbe542e22..1f5174dc1 100755
--- a/support/bin/rtcds.in
+++ b/support/bin/rtcds.in
@@ -12,8 +12,13 @@ fi
 
 # this should define all USER_VARS (see below)
 ENV_FILE=${RTS_ENV:-/etc/advligorts/env}
+HOST_ENV_FILE=/etc/advligorts/systemd_env_`hostname`
 set -o allexport
 source "$ENV_FILE" 2>/dev/null || true
+if [[ -e $HOST_ENV_FILE ]] ; then
+    log "found host specific environment file '$HOST_ENV_FILE'"
+    source $HOST_ENV_FILE 2>/dev/null || true
+fi
 set +o allexport
 
 SITE=${SITE^^*}
@@ -21,6 +26,9 @@ site=${SITE,,*}
 IFO=${IFO^^*}
 ifo=${IFO,,*}
 
+IS_DOLPHIN_NODE=${IS_DOLPHIN_NODE:-false}
+DAQ_STREAMING=${DAQ_STREAMING:-false}
+
 RCG_SRC=${RCG_SRC:-/usr/share/advligorts/src}
 RCG_BUILD_ROOT=${RCG_BUILD_ROOT:-/var/cache/advligorts}
 RCG_BUILDD=${RCG_BUILDD:-$RCG_BUILD_ROOT/rcg-$RTS_VERSION}
@@ -250,7 +258,11 @@ _lsmod() {
     local dolphin=(dis_kosif dis_ix_ntb dis_ix_dma dis_irm dis_sisci dis_intel_dma)
 
     # FIXME: how to test for needed modules?
-    modules=(${rts[*]} ${dolphin[*]})
+    if $IS_DOLPHIN_NODE ; then
+    	local modules=(${rts[*]} ${dolphin[*]})
+    else
+    	local modules=(${rts[*]})
+    fi
     
     local allloaded=
     for m in ${modules[*]}; do
@@ -370,13 +382,16 @@ global_status() {
   fi
 
   echo
+
   local streamer_health=0
-  echo
-  if streamer_status ; then
-    echo "Streamer Status =      ALL ACTIVE"
-  else
-    echo "Streamer Status =      DEGRADED"
-    streamer_health=12
+  if $DAQ_STREAMING ; then
+    echo
+    if streamer_status ; then
+      echo "Streamer Status =      ALL ACTIVE"
+    else
+      echo "Streamer Status =      DEGRADED"
+      streamer_health=12
+    fi
   fi
 
   echo
-- 
GitLab