Anchor | ||||
---|---|---|---|---|
|
Tip |
---|
Understand and learn how to setup new agent environment on this page. |
Panel | |
---|---|
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 should 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.
Th The below dynamicTemplate example is for GitHub.
Panel title 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.
Steps to upgrade existing Agents
1. Stop all existing running agents
2. Take backup of existing agent code
3. Note down last run date/time from tracking.json
4. Let Insights Engine consume all queues data. Verify all the queues have 0 pending data
5. Shut down Insights Engine.
6. Undeploy PlatformService WAR
7. Take back up of AGENT_CONFIGURATION table in PostgreSQL
8. DELETE all records from AGENT_CONFIGURATION table in PostgreSQL after taking backup
9. Deploy new PlatformService WAR and verify it has created below new columns in AGENT_CONFIGURATION table -
- agent_key
- agent_status
- agent_version
- os_version
10. Run SQL DDL script –
Panel |
---|
ALTER TABLE public.agent_configuration ADD CONSTRAINT agentKeyUnique UNIQUE(unique_key); |
11. Run below SQL query to register Daemon Agent -
Panel |
---|
INSERT INTO public.agent_configuration( id, agent_id, agent_json, agent_key, agent_status, agent_version, data_update_supported, os_version, tool_category, tool_name, unique_key, update_date) VALUES (1, 0,'','daemon-1523257126' ,'' ,'' , FALSE,'' , 'DAEMONAGENT', 'AGENTDAEMON', 'daemon-1523257126', current_date); |
12. Follow Agent 2.0 installation steps
13. Register all required agents using Agent management screen in Admin tab.
While registering, startTime should be from the time it was last update in tracking.json as mentioned above in step #314. Run latest new updated Insights Engine Jar
15. Validate all agents are running successfully and collecting data as usualVerify 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"]}