1. How to install, update and remove SSH Monitor#
1.1. How to install#
Prerequisites:
Gawk should be installed on the SSH Monitor host computer, in order to be able to run
awkin a shell.Iputils should be installed on the SSH Monitor host computer, in order to be able to run
pingin a shell.Openssh should be installed on the SSH Monitor host computer, in order to be able to run
sshin a shell.The EPICS base
v7should be installed on the SSH Monitor host computer like described in the official documentation: https://docs.epics-controls.org/projects/how-tos/en/latest/getting-started/installation.html (note that you can install the EPICS base e.g. in/opt/epics/baseinstead of$HOME/EPICS/epics-base, or anywhere else).The EPICS base should be at least
v7.0.7+in order to avoid the aSub constant input bug.
After installing the EPICS base on the host computer, you will first have to patch it in order to increase the maximum size of a macro. By default, the maximum size of a macro is 256 characters long, which is too short for the common SSH Monitor use case. Let’s increase it to 65535:
$ cd /opt/epics/base $ sed -i 's/MAC_SIZE 256/MAC_SIZE 65535/' modules/libcom/src/macLib/macLib.h $ sed -i 's/MY_BUFFER_SIZE 1024/MY_BUFFER_SIZE 65535/' modules/database/src/ioc/dbStatic/dbLexRoutines.c $ sed -i 's/MAX_VAR_FACTOR 50/MAX_VAR_FACTOR 1000/' modules/database/src/ioc/dbtemplate/dbLoadTemplate.y $ sed -i 's/MAXLINE BUFSIZ/MAXLINE 65535/' modules/libcom/src/flex/flexdef.h $ sed -i 's/YY_TRAILING_MASK 0x2000/YY_TRAILING_MASK 0x20000/' modules/libcom/src/flex/flexdef.h $ sed -i 's/YY_TRAILING_HEAD_MASK 0x4000/YY_TRAILING_HEAD_MASK 0x40000/' modules/libcom/src/flex/flexdef.h $ sed -i 's/YY_READ_BUF_SIZE 8192/YY_READ_BUF_SIZE 65535/' modules/libcom/src/flex/flex.skel $ sed -i 's/YY_READ_BUF_SIZE 8192/YY_READ_BUF_SIZE 65535/' modules/libcom/src/flex/scan.c $ sed -i 's/YY_READ_BUF_SIZE 8192/YY_READ_BUF_SIZE 65535/' modules/libcom/src/flex/flex.skel.static $ make clean && make && echo OK || echo KO
On the host computer, clone SSH Monitor somewhere (e.g. in
/opt/epics/support):$ mkdir -p /opt/epics/support $ cd /opt/epics/support $ git clone git@gitlab.com:sshmonitor/sshmonitor.git $ cd sshmonitor $ latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) $ git checkout $latestTag # checkout to the latest release $ vi configure/RELEASE # configure the path to your EPICS base location > ... > > # EPICS_BASE should appear last so earlier modules can override stuff: ~ > EPICS_BASE = /path/to/your/epics/base > > # Set RULES here if you want to use build rules from somewhere > # other than EPICS_BASE: > #RULES = $(MODULES)/build-rules > > # These lines allow developers to override these RELEASE settings > # without having to modify this file directly. > -include $(TOP)/../RELEASE.local > -include $(TOP)/../RELEASE.$(EPICS_HOST_ARCH).local > -include $(TOP)/configure/RELEASE.local $ make && echo OK || echo KO
On the host computer, create the Top that will monitor your target(s) and import SSH Monitor into it:
$ mkdir myTargetMonitoringTop $ cd myTargetMonitoringTop $ makeBaseApp.pl -a linux-x86_64 -t ioc myTargetMonitoring $ makeBaseApp.pl -a linux-x86_64 -i -p myTargetMonitoring MyTargetMonitoring $ vi configure/RELEASE > ... > > # Variables and paths to dependent modules: > #MODULES = /path/to/modules > #MYMODULE = $(MODULES)/my-module > > # If using the sequencer, point SNCSEQ at its top directory: > #SNCSEQ = $(MODULES)/seq-ver + > SSHMONITOR = /opt/epics/support/sshmonitor > > # EPICS_BASE should appear last so earlier modules can override stuff: > EPICS_BASE = /path/to/your/epics/base > > # Set RULES here if you want to use build rules from somewhere > # other than EPICS_BASE: > #RULES = $(MODULES)/build-rules > > # These lines allow developers to override these RELEASE settings > # without having to modify this file directly. > -include $(TOP)/../RELEASE.local > -include $(TOP)/../RELEASE.$(EPICS_HOST_ARCH).local > -include $(TOP)/configure/RELEASE.local $ vi myTargetMonitoringApp/Db/Makefile > TOP=../.. > include $(TOP)/configure/CONFIG > #---------------------------------------- > # ADD MACRO DEFINITIONS AFTER THIS LINE > > #---------------------------------------------------- > # Create and install (or just install) into <top>/db > # databases, templates, substitutions like this > #DB += xxx.db > + > DB_INSTALLS += $(SSHMONITOR)/db/ssh_monitor_core.template + > DB_INSTALLS += $(wildcard $(SSHMONITOR)/db/*.substitutions) > > #---------------------------------------------------- > # If <anyname>.db template is not named <anyname>*.template add > # <anyname>_template = <templatename> > > include $(TOP)/configure/RULES > #---------------------------------------- > # ADD RULES AFTER THIS LINE $ vi myTargetMonitoringApp/src/Makefile > TOP=../.. > > include $(TOP)/configure/CONFIG > #---------------------------------------- > # ADD MACRO DEFINITIONS AFTER THIS LINE > #============================= > > #============================= > # Build the IOC application > > PROD_IOC = myTargetMonitoring > # myTargetMonitoring.dbd will be created and installed > DBD += myTargetMonitoring.dbd > > # myTargetMonitoring.dbd will be made up from these files: > myTargetMonitoring_DBD += base.dbd + > myTargetMonitoring_DBD += system.dbd > > # Include dbd files from all support applications: > #myTargetMonitoring_DBD += xxx.dbd + > myTargetMonitoring_DBD += sshmonitorSupport.dbd > > # Add all the support libraries needed by this IOC > #myTargetMonitoring_LIBS += xxx + > myTargetMonitoring_LIBS += sshmonitorSupport > > # myTargetMonitoring_registerRecordDeviceDriver.cpp derives from myTargetMonitoring.dbd > myTargetMonitoring_SRCS += myTargetMonitoring_registerRecordDeviceDriver.cpp > > # Build the main IOC entry point on workstation OSs. > myTargetMonitoring_SRCS_DEFAULT += myTargetMonitoringMain.cpp > myTargetMonitoring_SRCS_vxWorks += -nil- > > # Add support from base/src/vxWorks if needed > #myTargetMonitoring_OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary > > # Finally link to the EPICS Base libraries > myTargetMonitoring_LIBS += $(EPICS_BASE_IOC_LIBS) > > #=========================== > > include $(TOP)/configure/RULES > #---------------------------------------- > # ADD RULES AFTER THIS LINE $ make && echo OK || echo KO
1.2. How to update#
Pull the latest changes and re-build the SSH Monitor Top:
$ cd /path/to/sshmonitor # e.g. `/opt/epics/support/sshmonitor`, like in the previous section $ git checkout master $ git pull $ git pull --tags $ latestTag=$(git describe --tags `git rev-list --tags --max-count=1`) $ git checkout $latestTag # checkout to the latest release $ make clean && make
1.3. How to remove#
Just delete the whole SSH Monitor Top:
$ rm -rf /path/to/sshmonitor # e.g. `/opt/epics/support/sshmonitor`, like in the previous section