Agent FAQ and Troubleshooting
FAQ
Q: How do I exclude specific files from a watch folder from being uploaded for an agent that uploads files and runs flows?
A: To exclude specific files from being uploaded, you can use the fp
function to specify which files should be included. For example, to exclude files that contain the string "exclude" in the filename, you can use the following code:
def fp_res(x: str):
x = parse.unquote(x)
# files excluding temp files
files_to_capture = [filename in glob.glob(os.path.join(watch_dir, pattern), recursive=True) if not 'exclude' in filename]
return files_to_capture
return fp_res
Q: How do I capture a file that is periodically overwritten by an instrument?
A: File watcher Agents automatically capture modified files, which they then upload for processing in flows. You can implement logic within the flow or agent to handle the intended behavior, depending on whether the instrument appends to or overwrites the file.
Q: Can I access environment secrets from the Agent?
A: Yes, environment secrets can be accessed from the Agent by using the get_secret method.
Q: Can I access an environment variable from a cron Agent? For example, can I access the input_path
variable configured upon installation?
A: Yes, environment variables can be accessed from a cron Agent through the kwargs
dictionary. For example, to access the input_path
variable, you can use the following code:
# .get method for dictionries is used to handle the case where the variable may not be present without erroring out
# note: assumes DEFAULT_PATH is configured in the agent
watch_directory = Path(kwargs.get("vars", {}).get("input_path", DEFAULT_PATH))
Q: Can Windows Agents be installed headlessly?
A: Yes - Agent installers (v4.10+) can be installed headlessly.
Requirements
The following files are needed:
- Agent installer (EXE, not MSI) with a minimum core Agent version of 4.10
- Configuration file (YAML); examples of this can be found in the directory specified by the installer when not installed headlessly. Start with an existing YAML configuration and modify as follows:
- Include:
- environment (required)
- name (required)
- variables
- tagParams (if applicable)
- Exclude:
- id
- inferredData (any)
- startTime
- Version
- Include:
A Windows batch script, such as the one shown below, saved to a .bat file:
@ECHO OFF
:: Agent name (used for defining install path) defined by passed argument:
set agentname=%1
:: Set install path assuming agentname was passed:
set installpath=C:\Program Files\Ganymede\%agentname%\
:: If agentname was not passed, remove double filesep:
IF "%~1" == "" (
set installpath=C:\Program Files\Ganymede\
)
ECHO Step 1: Creating install path: %installpath%
mkdir "%installpath%"
ECHO Step 2: Copying exe file
:: Note: %~dp0 is the path of the script (needed when running as admin)
:: Note: /v verifies the copied file, /y forces a replace if file with same name exists
copy "%~dp0agent.exe" "%installpath%" /v /y
ECHO Step 3: Copying config file
copy "%~dp0connection.yaml" "%installpath%" /v /y
ECHO Step 4: Running installer
start "%installpath%" "%installpath%agent.exe"
:: Uncomment next line for testing purposes if needed
:: PAUSE
Execution steps
- Rename agent installer “agent.exe”
- Name configuration file “connection.yaml” (if it has a different name)
- If desired, zip up a folder containing the agent installer, connection.yaml, and Windows batch script to facilitate sharing.
- On the target Windows machine, run the batch script via command prompt or Power Shell (as Administrator).
- To do this manually, unzip the installation package if necessary, and run command prompt or PowerShell (as Administrator).
- In command prompt or PowerShell, run the batch script via command line, optionally supplying the agent name as an argument
- (e.g. "C:\user\agent_install.bat HamiltonAgent")
- If argument is not supplied (e.g. when batch script is run from Windows directly), the install path will default to "C:\Program Files\Ganymede"
- To do this via a script, create a task in Task Scheduler pointing to the Windows batch script.
- Name the task, and check Run with highest privileges.
- In the Actions tab, add a new action pointing to your batch script.
- In the "Add Arguments" field, optionally provide the agent name. If argument is not supplied, the install path will default to "C:\Program Files\Ganymede"
- In the Settings tab, ensure that the task is configured to run without user intervention.
- In the Triggers tab, set an appropriate condition to trigger the task.
Once set, invoke the task using schtasks
:
schtasks /run /tn "TaskName"
Q: Are there any command-line scripts (e.g. - .vbs or .bat) that need to run for Windows Agents to work?
A: No, there are no command-line scripts that need to execute for the Windows Agent.
Q: Are there any known application dependencies or pre-requisites for the Windows Agent (e.g. - .NET, KBs, Redist)?
A: No, the full set of Agent requirements can be found on the Agent System Requirements page.