New Agent development guide
Understand and learn how to setup new agent environment on this page.
On this page
Extend Base Agent
Extend Base Agent.py file present in the agent directory.
Define config.json file
- Property names in config.json must follow camelcase format.
- Every config.json must have property "toolCategory" with appropriate value in CAPITAL letters.
- For Example - "toolCategory" : "ALM".
- All complex JSON Objects must be kept under property name "dynamicTemplate". For example, Arrays, Properties having sub-properties as a JSON Object.
- "responseTemplate" shall always be part of the dynamicTemplate, to capture the response from the external tool.
The below dynamicTemplate example is for GitHub.
Dynamic Template Format"dynamicTemplate": {
"responseTemplate": {
"sha": "commitId",
"commit": {
"author": {
"name": "authorName",
"date": "commitTime"
}
}
}
}
Create OS Service files
- Create service files to run agents as service. The file names should be toolname+agant all in small case.
For Example - jiragent.sh, jiraagent.bat, jiraagent.service
- This file naming convention helps dynamically create service file name based on Instance id provided on agent registration UI screen.
- Create 3 files for Windows, Linux/CentOS and Ubuntu. If you are developing for any other operating system which has specific steps to run as service, add that too.
Update installagent.sh file
- Update "installagent.sh" file available in AgentDaemon, if the OS is other than Linux or Ubuntu.
Verify agent installation
- Once agent is registered from UI, zip packge is sent to INSIGHTS.AGENTS.PACKAGE queue.
- Daemon agent pickup file from INSIGHTS.AGENTS.PACKAGE queue and copy it to relevant folder give in daemon agents config.json (baseExtractionPath) and run installagent.sh with following inputs - OS, toolname, action(install, uninstall, START, STOP) and agentid.
- Go through "installagent.sh" or "installagent.bat" file for more details.
- While registration one more queue is created with name "agentId". This queue is used by agents running on Unix based OS to STOP agent service.
Data Update Supported
- Any agent which is publishing data in Neo4j and data node will be updated each time the agent is collecting data, based on the unique combination of properties(columns), and using dataUpdateSupported field as True.
The metadata which holds this unique key combinaton and data update supported should be proivided from agent or python files.
example:
metadata = {"dataUpdateSupported": True,"uniqueKeys":["property1","property2"]}
©2021 Cognizant, all rights reserved. US Patent 10,410,152