Skip to content

Agent Maintenance Tool: Agent File

Use the PushFile command to copy files to the agent directory on the target box.

6 min read Updated SS MR

Agent File#

Copying an Agent File#

To copy the agent file, follow the steps below:

1. Copy any type of file to the target box.
2. The PushFile command is similar to the Config command (you can also copy binary files to the agent directory, including the Supervisor directory).

Execute the below PushFile command:

./agent-maintenance-tool.sh SupervisorId:<Sup_ID> AgentType:<type> AgentId:<Agent_ID>
UserDetailsId:<user_ID> Command:PushFile CommandType:MaintenanceCmds CommandTimeout:
<time_out> SupervisorCtrlTTL:<sup_ctrl_ttl> Metadata:"config_file1=<filename>;
config_file1_path=<file1 path>; config_file1_compression=<compression type>"

For example:

./agent-maintenance-tool.sh SupervisorId:7b83ddad-3720-43d6-9049-a2051c1cb1fa
AgentType:ComponentAgent AgentId:c570de02-c585-4917-bbb7-5c97b35e-200
UserDetailsId:7640123a-fbde-4fe5-9812-581cd1e3a9c1 Command:PushFile
CommandType:MaintenanceCmds Metadata:"
config_file1=ComponentAgent.jar;config_file1_path=/opt/Agent_Maintenance_Tool/target-files/ComponentAgent_c570de02-c585-4917-bbb7-5c97b35e-200_ComponentAgent.jar;config_file1_compression=gzip"

Expected Output:

2021-02-16 18:01:59.034 [main] INFO c.a.healutil.AgentMaintenanceMain:18 - Starting Agent maintenance util
2021-02-16 18:01:59.045 [main] INFO c.a.a.common.util.ConfProperties:44 - successfully loaded conf.properties file
2021-02-16 18:01:59.049 [main] INFO c.a.a.common.util.ConfProperties:44 - successfully loaded conf.properties file
2021-02-16 18:01:59.082 [main] INFO com.appnomic.healutil.QueueHandler:113 - Command request queue haproxy.example:5672/tls:enabled, name: command-messages
2021-02-16 18:01:59.511 [main] WARN c.r.c.TrustEverythingTrustManager:33 - SECURITY ALERT:this trust manager trusts every certificate, effectively disabling peer verification. This
is convenient for local development but offers no protection against man-in-the-middle attacks. Please see https://www.rabbitmq.com/ssl.html to learn more about peer certificate verification.
2021-02-16 18:01:59.931 [main] INFO com.appnomic.healutil.QueueHandler:149 - Command response queue haproxy.example:5672/tls:enabled, name: agent-maintenance-response-messages
2021-02-16 18:02:00.001 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> Host:192.0.2.77
2021-02-16 18:02:00.007 [main] WARN com.appnomic.healutil.CommandRequest:365 - Found unknown argument, skipping it. Arg: Host:192.0.2.77, Host: 192.0.2.77
2021-02-16 18:02:00.007 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> SupervisorId:7b83ddad-3720-43d6-9049-a2051c1cb1fa
2021-02-16 18:02:00.009 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> AgentId:c570de02-c585-4917-bbb7-5c97b35e-200
2021-02-16 18:02:00.010 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> UserDetailsId:7640123a-fbde-4fe5-9812-581cd1e3a9c1
2021-02-16 18:02:00.010 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> AgentType:ComponentAgent
2021-02-16 18:02:00.011 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> Command:PushFile
2021-02-16 18:02:00.011 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> CommandType:MaintenanceCmds
2021-02-16 18:02:00.012 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> Metadata:config_file1=ComponentAgent.jar;config_file1_path=/opt/Agent_Maintenance_Tool/target-files/ComponentAgent_c570de02-c585-4917-bbb7-5c97b35e-200_ComponentAgent.jar;config_file1_compression=gzip
2021-02-16 18:02:00.034 [main] INFO com.appnomic.healutil.CommandHandler:67 - Sending
Command: PushFile SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa AgentType:
ComponentAgent AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 CommandJobId: 53eef43a-c566-43b2-b242-ff0628201b11 to Queue: command-messages queue
2021-02-16 18:02:00.239 [main] INFO com.appnomic.healutil.CommandHandler:69 - Command is sent to queue, response wait time 300s
2021-02-16 18:02:00.239 [main] INFO com.appnomic.healutil.CommandHandler:70 - Waiting for response for 7b83ddad-3720-43d6-9049-a2051c1cb1fa agentName:ComponentAgent command:PushFile
2021-02-16 18:02:01.010 [main] INFO com.appnomic.healutil.CommandHandler:171 - Response Command: PushFile SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa AgentType:
ComponentAgent AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 CommandJobId: 53eef43a-c566-43b2-b242-ff0628201b11 ExitCode: 0[Success] CommandStartTime: 1613478724972
CommandCompleteTime: 1613478724978 received for Command: PushFile SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa AgentType: ComponentAgent AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 CommandJobId: 53eef43a-c566-43b2-b242-ff0628201b11
2021-02-16 18:02:01.012 [main] INFO com.appnomic.healutil.CommandHandler:279 - Command:PushFile of Agent: ComponentAgent with AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 on
target with SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa Status: Success Info:Received empty response data
2021-02-16 18:02:01.013 [main] INFO com.appnomic.healutil.CommandHandler:107 - processing of all commands completed

Retrieving an Agent File#

Retrieve any type of file from the target box.

You can also retrieve binary files from the agent directory, including the Supervisor directory. The FetchFile command is similar to the GetConfig command.

The format of the FetchFile command is as follows:

./agent-maintenance-tool.sh SupervisorId:<Sup_ID> AgentType:<type> AgentId:<Agent_ID>
UserDetailsId:<user_ID> Command:FetchFile CommandType:MaintenanceCmds CommandTimeout:
<time_out> SupervisorCtrlTTL:<sup_ctrl_ttl> Metadata:"config_file1=<filename>;
config_file1_compression=<compression type>"

For example:

./agent-maintenance-tool.sh SupervisorId:7b83ddad-3720-43d6-9049-a2051c1cb1fa
AgentType:ComponentAgent AgentId:c570de02-c585-4917-bbb7-5c97b35e-200
UserDetailsId:7640123a-fbde-4fe5-9812-581cd1e3a9c1 Command:FetchFile
CommandType:MaintenanceCmds Metadata:"config_file1= config/keyfiles/cacerts"

Expected Output:

2021-02-16 17:54:53.780 [main] INFO c.a.healutil.AgentMaintenanceMain:18 - Starting Agent maintenance util
2021-02-16 17:54:53.790 [main] INFO c.a.a.common.util.ConfProperties:44 - successfully loaded conf.properties file
2021-02-16 17:54:53.793 [main] INFO c.a.a.common.util.ConfProperties:44 - successfully loaded conf.properties file
2021-02-16 17:54:53.820 [main] INFO com.appnomic.healutil.QueueHandler:113 - Command request queue haproxy.example:5672/tls:enabled, name: command-messages
2021-02-16 17:54:54.250 [main] WARN c.r.c.TrustEverythingTrustManager:33 - SECURITY ALERT:this trust manager trusts every certificate, effectively disabling peer verification. This
is convenient for local development but offers no protection against man-in-the-middle attacks. Please see https://www.rabbitmq.com/ssl.html to learn more about peer certificate verification.
2021-02-16 17:54:54.570 [main] INFO com.appnomic.healutil.QueueHandler:149 - Command response queue haproxy.example:5672/tls:enabled, name: agent-maintenance-response-messages
2021-02-16 17:54:54.643 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> Host:192.0.2.77
2021-02-16 17:54:54.648 [main] WARN com.appnomic.healutil.CommandRequest:365 - Found unknown argument, skipping it. Arg: Host:192.0.2.77, Host: 192.0.2.77
2021-02-16 17:54:54.649 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> SupervisorId:7b83ddad-3720-43d6-9049-a2051c1cb1fa
2021-02-16 17:54:54.651 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> AgentId:c570de02-c585-4917-bbb7-5c97b35e-200
2021-02-16 17:54:54.651 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> UserDetailsId:7640123a-fbde-4fe5-9812-581cd1e3a9c1
2021-02-16 17:54:54.652 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> AgentType:ComponentAgent
2021-02-16 17:54:54.653 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> Command:FetchFile
2021-02-16 17:54:54.653 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> CommandType:MaintenanceCmds
2021-02-16 17:54:54.654 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> Metadata:config_file1=ComponentAgent.jar
2021-02-16 17:54:54.662 [main] INFO com.appnomic.healutil.CommandHandler:67 - Sending
Command: FetchFile SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa AgentType:
ComponentAgent AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 CommandJobId: 785a8ac8-c12e-49ff-8529-1eb377cf6eec to Queue: command-messages queue
2021-02-16 17:54:54.815 [main] INFO com.appnomic.healutil.CommandHandler:69 - Command is sent to queue, response wait time 300s
2021-02-16 17:54:54.816 [main] INFO com.appnomic.healutil.CommandHandler:70 - Waiting for response for 7b83ddad-3720-43d6-9049-a2051c1cb1fa agentName:ComponentAgent
command:FetchFile
2021-02-16 17:54:56.003 [main] INFO com.appnomic.healutil.CommandHandler:171 - Response
Command: FetchFile SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa AgentType:
ComponentAgent AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 CommandJobId: 785a8ac8-c12e-49ff-8529-1eb377cf6eec ExitCode: 0[Success] CommandStartTime: 1613478299743
CommandCompleteTime: 1613478299761 received for Command: FetchFile SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa AgentType: ComponentAgent AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 CommandJobId: 785a8ac8-c12e-49ff-8529-1eb377cf6eec
2021-02-16 17:54:56.006 [main] INFO com.appnomic.healutil.CommandHandler:316 - Command:
FetchFile of Agent: ComponentAgent with AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 on target with SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa Status: Success Info:Received empty response data
2021-02-16 17:54:56.024 [main] INFO com.appnomic.healutil.CommandHandler:107 - processing of all commands completed

Renaming an Agent File#

Rename any type of file in the target box. You can also rename binary files in the agent directory, including the Supervisor directory.

Execute the below command to rename the file:

./agent-maintenance-tool.sh SupervisorId:<Sup_ID> AgentType:<type> AgentId:<Agent_ID>
UserDetailsId:<user_ID> Command:renameFile CommandType:MaintenanceCmds CommandTimeout:<time_out> SupervisorCtrlTTL:<sup_ctrl_ttl> Metadata:"rename_file1=<filename>"

For example:

./agent-maintenance-tool.sh SupervisorId:7b83ddad-3720-43d6-9049-a2051c1cb1fa
AgentType:ComponentAgent AgentId:c570de02-c585-4917-bbb7-5c97b35e-200
UserDetailsId:7640123a-fbde-4fe5-9812-581cd1e3a9c1 Command:renameFile
CommandType:MaintenanceCmds Metadata:"rename_file1=config/basic123.properties=config/basic.properties"

Expected Output:

2021-02-16 17:53:43.920 [main] INFO c.a.healutil.AgentMaintenanceMain:18 - Starting Agent maintenance util
2021-02-16 17:53:43.931 [main] INFO c.a.a.common.util.ConfProperties:44 - successfully loaded conf.properties file
2021-02-16 17:53:43.934 [main] INFO c.a.a.common.util.ConfProperties:44 - successfully loaded conf.properties file
2021-02-16 17:53:43.959 [main] INFO com.appnomic.healutil.QueueHandler:113 - Command request queue haproxy.example:5672/tls:enabled, name: command-messages
2021-02-16 17:53:44.334 [main] WARN c.r.c.TrustEverythingTrustManager:33 - SECURITY ALERT:this trust manager trusts every certificate, effectively disabling peer verification. This
is convenient for local development but offers no protection against man-in-the-middle attacks. Please see https://www.rabbitmq.com/ssl.html to learn more about peer certificate verification.
2021-02-16 17:53:44.672 [main] INFO com.appnomic.healutil.QueueHandler:149 - Command response queue haproxy.example:5672/tls:enabled, name: agent-maintenance-response-messages
2021-02-16 17:53:44.735 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> Host:192.0.2.77
2021-02-16 17:53:44.739 [main] WARN com.appnomic.healutil.CommandRequest:365 - Found unknown argument, skipping it. Arg: Host:192.0.2.77, Host: 192.0.2.77
2021-02-16 17:53:44.740 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> SupervisorId:7b83ddad-3720-43d6-9049-a2051c1cb1fa
2021-02-16 17:53:44.741 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> AgentId:c570de02-c585-4917-bbb7-5c97b35e-200
2021-02-16 17:53:44.741 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> UserDetailsId:7640123a-fbde-4fe5-9812-581cd1e3a9c1
2021-02-16 17:53:44.742 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> AgentType:ComponentAgent
2021-02-16 17:53:44.742 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> Command:renameFile
2021-02-16 17:53:44.742 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> CommandType:MaintenanceCmds
2021-02-16 17:53:44.743 [main] INFO com.appnomic.healutil.CommandRequest:296 - arg ====> Metadata:rename_file1=config/basic123.properties=config/basic.properties
2021-02-16 17:53:44.745 [main] INFO com.appnomic.healutil.CommandHandler:67 - Sending
Command: renameFile SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa AgentType:
ComponentAgent AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 CommandJobId: cbe03977-712d-4b6c-ba3e-a531a62e42b9 to Queue: command-messages queue
2021-02-16 17:53:44.877 [main] INFO com.appnomic.healutil.CommandHandler:69 - Command is sent to queue, response wait time 300s
2021-02-16 17:53:44.878 [main] INFO com.appnomic.healutil.CommandHandler:70 - Waiting for response for 7b83ddad-3720-43d6-9049-a2051c1cb1fa agentName:ComponentAgent
command:renameFile
2021-02-16 17:53:45.749 [main] INFO com.appnomic.healutil.CommandHandler:171 - Response
Command: renameFile SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa AgentType:
ComponentAgent AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 CommandJobId: cbe03977-712d-4b6c-ba3e-a531a62e42b9 ExitCode: 0[Success] CommandStartTime: 1613478229713
CommandCompleteTime: 1613478229714 received for Command: renameFile SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa AgentType: ComponentAgent AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 CommandJobId: cbe03977-712d-4b6c-ba3e-a531a62e42b9
2021-02-16 17:53:45.751 [main] INFO com.appnomic.healutil.CommandHandler:244 - Command:
renameFile of Agent: ComponentAgent with AgentId: c570de02-c585-4917-bbb7-5c97b35e-200 on target with SupervisorId: 7b83ddad-3720-43d6-9049-a2051c1cb1fa Status: Success Info:Received empty response data
2021-02-16 17:53:45.752 [main] INFO com.appnomic.healutil.CommandHandler:107 - processing of all commands completed