Ir_agent install/migration test

Hi

We’re updating the agent from the .sh installer per docs and looking for a way to test that its complete. The docs also say there is a “-diagnose” switch on the agent, but this is a lie [1]. There is a -test which also wants a -testClientID which doesnt seem to be documented anywhere.

We’d normally just check with the package manager that its installed, but this is not enough for the migration, we’ve seen it fail after installing the package but then failing because the script cant find “config.json”. Has anyone managed to automate the migration of the agent?

Is there a way to test that the agent is installed and configured? We’re not manually installing on hundreds of boxes, we need an automatic way to check if it needs to run the migration script sucessfully. Happy to check for the existence of a file, a return code, a process etc - just need to know how to determine success!

[1]

/opt/rapid7/ir_agent/ir_agent -diagnose
flag provided but not defined: -diagnose
Usage of /opt/rapid7/ir_agent/ir_agent:
  -common string
        The bootstrap common directory (where ssl directory is located)
        This value will also be used to derive components directory for self-test
  -heartbeatURL string
        User-defined heartbeat URL
  -region string
        Override default us region (default "us")
  -service
        Legacy invocation handler for agent service
  -shortTest
        Returns upon the first success
  -test
        Does self test checks and exits with return code set. Common flag should be passed if ssl dir is not next to binary
  -testClientID string
        Required clientId for test mode
  -version
        Prints the semantic version of this binary

[2]

/opt/rapid7/ir_agent/ir_agent -test
Failed to build new bootstrap: clientID is required to be specified for test mode

Hi,

you are running the ir_agent executable from the wrong directory, you need to navigate to

/opt/rapid7/ir_agent/components/insight_agent/<latest_version>

and run the diagnose from there

Screenshot 2024-11-13 at 10.11.14 AM

see this here in our docs

https://docs.rapid7.com/insight-agent/agent-connection-diagnostics/#test-requirements

Thanks, this helps!