1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 <2023> 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 <2023> 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Epics Archiver Online Status Question |
From: | Tynan Ford via Tech-talk <tech-talk at aps.anl.gov> |
To: | "Manoussakis, Adamandios" <manoussakis1 at llnl.gov> |
Cc: | EPICS tech-talk <tech-talk at aps.anl.gov> |
Date: | Wed, 3 May 2023 15:13:35 -0700 |
That sounds like exactly what I need Tynan. Any chance I could take a peak of your implementation for the PV?
Thanks
Adam
On May 3, 2023, at 11:11 AM, Tynan Ford <TFord at lbl.gov> wrote:
Hi Adam,
I don't know of a status PV associated with the archiver myself. We implemented a PV with a subroutine like you suggested. It queries an archiver appliance HTTP endpoint and determines if the archiver is up and running based on that.
For instance, you could check that mgmt/bpl/startupState, engine/bpl/startupState, etc. return "STARTUP_COMPLETE". Or query an endpoint like mgmt/bpl/getApplianceInfo and ensure it returns a valid response.
BestTynan
On Tue, May 2, 2023 at 1:11 PM Manoussakis, Adamandios via Tech-talk <tech-talk at aps.anl.gov> wrote:
Hi All,
Are there any PVs associated when you start up the Epic Archiver that you can read for status of the Archiver (Online, Running, Etc)? If not does anyone have a simple solution to display in CSS GUI (LED or Text Box) that the archiver is in fact running, one thought was an ASUB record with some C written to check if the web interface of the archiver was reachable.
Thanks,
Adam
import devsup.ptable as PT from devsup.hooks import addHook import time from threading import Thread import signal import channelfinder import requests import urllib3 urllib3.disable_warnings() class hlcSupport(PT.TableBase): cf_status = PT.Parameter(iointr=True) aa_status = PT.Parameter(iointr=True) def __init__(self, name, pv_prefix): super().__init__(name=name) self.cf = channelfinder.ChannelFinderClient(BaseURL="https://myhost.lbl.gov/ChannelFinder") self.aa = "https://myhost.lbl.gov/getApplianceInfo" self.aa_identity = "myappliance" self.stop = False self.sleep_time = 30 self.cf_thread = Thread(target=self.cf_mon) self.cf_thread.start() self.aa_thread = Thread(target=self.aa_mon) self.aa_thread.start() def stop_threads(self): self.stop = True def aa_mon(self): while True: if self.stop: return try: response = requests.get(self.aa) response.raise_for_status() except requests.exceptions.HTTPError as err: print("Error in HTTP respsonse") print(err) self.aa_status.value = False self.aa_status.notify() time.sleep(15) continue except requests.exceptions.RequestException as e: print("Couldn't connect to archiver appliance") print(e) self.aa_status.value = False self.aa_status.notify() time.sleep(15) continue aa_json = response.json() if aa_json['identity'] == self.aa_identity: self.aa_status.value = True self.aa_status.notify() else: self.aa_status.value = False self.aa_status.notify() time.sleep(self.sleep_time) def cf_mon(self): while True: if self.stop: return try: heartbeat_pvs = self.cf.find(name="*HEARTBEAT") if len(heartbeat_pvs) > 2: self.cf_status.value = True self.cf_status.notify() else: self.cf_status.value = False self.cf_status.notify() except requests.ConnectionError: print("Couldn't connect to channel finder") self.cf_status.value = False self.cf_status.notify() time.sleep(self.sleep_time) def build(prefix): sup = hlcSupport(name='hlc', pv_prefix=prefix) signal.signal(signal.SIGINT, signal.SIG_DFL) def stopThreads(): sup.stop_threads() addHook('AtIocExit', stopThreads)