CC API for Discovery Agent Scheduler
CC API for Discovery Agent Scheduler in Supervisor Installation and Configuration Guide.
CC API for Discovery Agent Scheduler#
This feature allows users to manage the scheduling of the Discovery Agent via the Control Center API.
When the scheduling is enabled, the Discovery Agent is executed immediately upon receiving the command and is automatically scheduled for future executions based on the specified time interval.
Disabling the scheduling stops any automatic triggers (set at intervals) of the Discovery Agent.
To enable on-demand scheduling of the Discovery Agent through the CC API.
Activate: Trigger the Discovery Agent on demand and specify the interval for the next execution.
Deactivate: Stop the Discovery Agent and clear the scheduled interval for the next triggers.
Prerequisites#
1. Commands to enable or disable the Discovery Agent scheduling must be added in Percona, including the required command arguments for enabling the schedule.
2. As the UI screens for issuing commands are not yet available, requests must be made using tools like CURL, Postman, or similar applications to trigger the API.
API curl Commands#
Below are the sample curl commands:
a. Enable Scheduling.
curl --location 'https://<ip_address>:<port>/heal-
controlcenter/v2.0/api/accounts/<account_identifier>/services/<service_identifier>/forensic
-actions/trigger' \
--header 'Authorization:
<access_token>' \
--header 'Content-Type: application/json' \
--data '[
{
"agentType": "Supervisor",
"commandId": 35,
"agentIdentifier": "7d28e065-a960-40b7-9b11-cb7cbd16ea58",
"serviceIdentifier": null,
"compInstanceIdentifier": null,
"commandIdentifier": "enable_schedule",
"commandArguments": [
{
"key": "discovery_agent_path",
"value": "/home/user/Downloads",
"isPlaceHolder": true,
"defaultValue": ""
},
{
"key": "runAsSudo",
"value": "true",
"isPlaceHolder": true,
"defaultValue": "false"
},
{
"key": "interval",
"value": "90",
"isPlaceHolder": true,
"defaultValue": "1440"
},
{
"key": "scriptName",
"value": "RunDiscoveryAgent",
"isPlaceHolder": true,
"defaultValue": ""
}
]
}
]
Expected Output:
{
"message": "SUCCESS",
"responseStatus": "SUCCESS",
"data": [
{
"agentId": 0,
"agentTypeId": 220,
"commandJobId": "a38c292a-7333-476e-a4db-d5fac198de5c",
"agentIdentifier": "7d28e065-a960-40b7-9b11-cb7cbd16ea58",
"instanceIdentifier": null,
"physicalAgentIdentifier": null
}
]
}
b. Enable the scheduler for multiple supervisor agents.
curl --location 'https://localhost:8996/heal-
controlcenter/v2.0/api/accounts/app/services/GEMFIRE_DB_SERVICE/forensic-
actions/trigger' \
--header 'Authorization:
<access_token>' \
--header 'Content-Type: application/json' \
--data '[
{
"agentType": "Supervisor",
"commandId": 29,
"agentIdentifier": "192.0.2.12_sup_ba47b527478e6ecc998626597f851569",
"commandIdentifier": "enable_schedule",
"commandArguments": [
{
"key": "discovery_agent_path",
"value": "/home/user/Agents/discovery-agent",
"isPlaceHolder": true,
"defaultValue": ""
},
{
"key": "runAsSudo",
"value": "true",
"isPlaceHolder": true,
"defaultValue": "false"
},
{
"key": "interval",
"value": "1250",
"isPlaceHolder": true,
"defaultValue": "1440"
},
{
"key": "scriptName",
"value": "RunDiscoveryAgent",
"isPlaceHolder": true,
"defaultValue": ""
}
]
},
{
"agentType": "Supervisor",
"commandId": 29,
"agentIdentifier": "198.51.100.12_sup_ec0c82654bf158477e1f255a51034b21",
"commandIdentifier": "enable_schedule",
"commandArguments": [
{
"key": "discovery_agent_path",
"value": "/home/user/Agents/discovery-agent",
"isPlaceHolder": true,
"defaultValue": ""
},
{
"key": "runAsSudo",
"value": "true",
"isPlaceHolder": true,
"defaultValue": "false"
},
{
"key": "interval",
"value": "1250",
"isPlaceHolder": true,
"defaultValue": "1440"
},
{
"key": "scriptName",
"value": "RunDiscoveryAgent",
"isPlaceHolder": true,
"defaultValue": ""
}
]
}
]'
Expected Output:
{
"message": "SUCCESS",
"responseStatus": "SUCCESS",
"data": [
{
"agentId": 0,
"agentTypeId": 247,
"commandJobId": "b450629b-eb65-4a88-be61-84da0457c9ef",
"agentIdentifier": "192.0.2.12_sup_ba47b527478e6ecc998626597f851569",
"instanceIdentifier": null,
"physicalAgentIdentifier": null
},
{
"agentId": 0,
"agentTypeId": 247,
"commandJobId": "7cfb6fa6-4edf-4cae-bc34-08bb99f31660",
"agentIdentifier": "198.51.100.12_sup_ec0c82654bf158477e1f255a51034b21",
"instanceIdentifier": null,
"physicalAgentIdentifier": null
}
]
}
c. Disable Scheduling.
curl --location 'https://<ip_address>:<port>/heal-
controlcenter/v2.0/api/accounts/<account_identifier>/services/<service_identifier>/forensic
-actions/trigger' \
--header 'Authorization:
<access_token>' \
--header 'Content-Type: application/json' \
--data '[
{
"agentType": "Supervisor",
"commandId": 35,
"agentIdentifier": "7d28e065-a960-40b7-9b11-cb7cbd16ea58",
"serviceIdentifier": null,
"compInstanceIdentifier": null,
"commandIdentifier": "disable_schedule",
"commandArguments": [
{
"key": "scriptName",
"value": "RunDiscoveryAgent",
"isPlaceHolder": true,
"defaultValue": ""
}
]
}
]
Expected Output:
{
"message": "SUCCESS",
"responseStatus": "SUCCESS",
"data": [
{
"agentId": 0,
"agentTypeId": 220,
"commandJobId": "294071f2-61a4-4286-9520-a75f538fd774",
"agentIdentifier": "7d28e065-a960-40b7-9b11-cb7cbd16ea58",
"instanceIdentifier": null,
"physicalAgentIdentifier": null
}
]
}
d. Disable Scheduler for Multiple Supervisor Agents.
curl --location 'https://localhost:8996/heal-
controlcenter/v2.0/api/accounts/app/services/GEMFIRE_DB_SERVICE/forensic-
actions/trigger' \
--header 'Authorization:
<access_token>' \
--header 'Content-Type: application/json' \
--data '[
{
"agentType": "Supervisor",
"commandId": 28,
"agentIdentifier": "192.0.2.12_sup_ba47b527478e6ecc998626597f851569",
"commandIdentifier": "disable_schedule",
"commandArguments": [
{
"key": "scriptName",
"value": "RunDiscoveryAgent",
"isPlaceHolder": true,
"defaultValue": ""
}
]
},
{
"agentType": "Supervisor",
"commandId": 28,
"agentIdentifier": "198.51.100.12_sup_ec0c82654bf158477e1f255a51034b21",
"commandIdentifier": "disable_schedule",
"commandArguments": [
{
"key": "scriptName",
"value": "RunDiscoveryAgent",
"isPlaceHolder": true,
"defaultValue": ""
}
]
}
]
Expected Output:
{
"message": "SUCCESS",
"responseStatus": "SUCCESS",
"data": [
{
"agentId": 0,
"agentTypeId": 247,
"commandJobId": "b2e687c4-e4b2-47e5-8ffa-99d47ff393df",
"agentIdentifier": "192.0.2.12_sup_ba47b527478e6ecc998626597f851569",
"instanceIdentifier": null,
"physicalAgentIdentifier": null
},
{
"agentId": 0,
"agentTypeId": 247,
"commandJobId": "428f4b9d-3f3e-458f-8e5c-52fcc9eea5da",
"agentIdentifier": "198.51.100.12_sup_ec0c82654bf158477e1f255a51034b21",
"instanceIdentifier": null,
"physicalAgentIdentifier": null
}
]
}
e. Enable and disable scheduling in one request.
curl --location 'https://localhost:8996/heal-
controlcenter/v2.0/api/accounts/app/services/GEMFIRE_DB_SERVICE/forensic-
actions/trigger' \
--header 'Authorization:
<access_token>' \
--header 'Content-Type: application/json' \
--data '[
{
"agentType": "Supervisor",
"commandId": 28,
"agentIdentifier": "192.0.2.12_sup_ba47b527478e6ecc998626597f851569",
"commandIdentifier": "disable_schedule",
"commandArguments": [
{
"key": "scriptName",
"value": "RunDiscoveryAgent",
"isPlaceHolder": true,
"defaultValue": ""
}
]
},
{
"agentType": "Supervisor",
"commandId": 29,
"agentIdentifier": "198.51.100.12_sup_ec0c82654bf158477e1f255a51034b21",
"commandIdentifier": "enable_schedule",
"commandArguments": [
{
"key": "discovery_agent_path",
"value": "/home/user/Agents/discovery-agent",
"isPlaceHolder": true,
"defaultValue": ""
},
{
"key": "runAsSudo",
"value": "true",
"isPlaceHolder": true,
"defaultValue": "false"
},
{
"key": "interval",
"value": "1250",
"isPlaceHolder": true,
"defaultValue": "1440"
},
{
"key": "scriptName",
"value": "RunDiscoveryAgent",
"isPlaceHolder": true,
"defaultValue": ""
}
]
}
]
Expected output:
{
"message": "SUCCESS",
"responseStatus": "SUCCESS",
"data": [
{
"agentId": 0,
"agentTypeId": 247,
"commandJobId": "70be54dc-20b0-4825-84d9-fc2119aa83ff",
"agentIdentifier": "192.0.2.12_sup_ba47b527478e6ecc998626597f851569",
"instanceIdentifier": null,
"physicalAgentIdentifier": null
},
{
"agentId": 0,
"agentTypeId": 247,
"commandJobId": "cf1b2af9-0f5f-4adc-9e87-4627e6eb8001",
"agentIdentifier": "198.51.100.12_sup_ec0c82654bf158477e1f255a51034b21",
"instanceIdentifier": null,
"physicalAgentIdentifier": null
}
]
}
Supervisor Command#
Below is the command sent to the Supervisor from the supervisor controller when the supervisor agent requests it via long polling:
[
{
"supervisorIdentifier": "7d28e065-a960-40b7-9b11-cb7cbd16ea58",
"agentIdentifier": "7d28e065-a960-40b7-9b11-cb7cbd16ea58",
"commandJobID": "60dbb53e-6255-48a1-ab25-0664d102eb76",
"commandType": "AgentOperationCmds",
"commandOutputType": "Blob",
"commandExecType": "Execute",
"triggerSource": "ControlCenter",
"userDetailsId": "7640123a-fbde-4fe5-9812-581cd1e3a9c1",
"retryNumber": 3,
"triggerTime": 1723787015354,
"supervisorCtrlTTL": 300000,
"commandTimeout": 300000,
"violationTime": 1723787015354,
"metaData": {
"accountId": "example",
"agentType": "Supervisor",
"discovery_agent_path": "/home/user/Downloads",
"scriptName": "RunDiscoveryAgent",
"interval": "1440",
"runAsSudo": "true",
"commandId": "enable_schedule",
"status": "In-progress"
},
"command": "enableschedule",
"agentType": "Supervisor",
"arguments": {
"discovery_agent_path": "/home/user/Downloads"
},
"envArgs": {}
}
]
Exit Codes#
Below are the supervisor exit codes:
0 – 31 Supervisor-related exit codes#
0: Success
1: Script not found
2: Script execution timed out
3: Script sign verification failed
4: Exception information while executing the script
5: Invalid input to Supervisor Controller – either command or result
6: Duplicate Installation
7: md5sum mismatch
8: Symbolic link failure
9: Directory create/delete failure
10: Agent doesn’t exist
11: Agent rollback failure
12: Invalid Command Type
13: Failed to configure
14: Failed to self-upgrade
15: Prerequisite check failed during agent installation
16: Uninstall
17: Supervisor internal exception
18: Script contains not-allowed words
19: Script Extension is not allowed
20: Sudo Helper receives less arguments
21: Sudo Helper receives a shell, which is not allowed
22: Sudo Helper configuration failed
23: Invalid command JSON
24: Failed to disable scheduled job
25-30: Reserved for future
30: Downloading of the package failed
31: Unknown error
32-255 Script-specific exit codes#
Script pre-requirement specific exit codes:
32: Unsupported platform
33: “FORENSIC_LIB_FOLDER” variable not set for forensic lib file path
34: Forensic lib file not found
35: Failed to stop the agent
36: Failed to start agent
Script execution-specific error codes (command level):#
E5001: Invalid number of arguments passed to the script
E5002: Invalid data received at an argument
E5003: Command not found
E5004: Error at library dependency during ldd check
E5005: Not enough permission for execution
E5006: Unable to create a file in the directory
E5007: Failed to delete a file