Instana

Instana

The community for performance and observability professionals to learn, to share ideas, and to connect with others.

 View Only
  • 1.  Can the agent mode be changed via the REST API?

    Posted 02/03/26 07:18 AM

    A good day to everyone,

    We are stuck with an issue that I need a clear answer to: Can the "mode" (OFF, INFRASTRUCTURE, APM) be changed via REST API call?

    According to the API documentation the endpoint is: https://{domain}/api/host-agent/{hostId}/configuration and I put values in the JSON body

    --header 'accept: application/json' --header 'content-type: application/json' --data '{"mode": 1}' -k

    But I have found no successful way to make it happen? The requests are accepted but there is no change.

    When I then check the permissions of the API token there is this help / info popup that states "Configuration of agent mode -> allows change via UI"

    If that is true then why is this a permission for the API token, which by definition is not a UI access but API?

    Many thanks for enlightenment and regards,

    Rainer


    #Agent
    #RESTAPI

    ------------------------------
    Rainer Schuppe Rainer Schuppe
    Instana veteran (since 2016), APM oldtimer (since 2003 Wily, Dynatrace, AppDynamics, Instana, OpenTelemetry)
    https://observability-heroes.com
    ------------------------------


  • 2.  RE: Can the agent mode be changed via the REST API?

    Posted 02/13/26 07:10 AM

    Hi Rainer,

    That is not possible, if you go to the REST API and try to generate a sample body, you get something like this:

    {
      "remoteBranch": "ejzofarsomicab",
      "remoteName": "Joel Abbott",
      "remoteUri": "ezri"
    }

    Which will not help you at all :( 

    My suggestion is to create an idea if this is something that you really need to happen from the REST API.

    Regards,



    ------------------------------
    Israel Ochoa
    CSM Architect - NCEE Market
    IBM
    Stockholm
    Visit "IBM Instana - The Lost Docs" -> https://isreal8a.github.io/instana-docs
    ------------------------------



  • 3.  RE: Can the agent mode be changed via the REST API?

    Posted 02/13/26 07:25 AM

    Hi Israel,

    Thanks for confimring. 

    Actually you can get quite a bit more from the API - including the agent mode - together with the permission in the API token dialog it suggests that there is a way to change the mode. Though a POST call with a new "mode" value is accepted (status: 202) but doesn't do anything. 

    I filed an AHA request already for this, as we need some way to turn off a group of agents with a click or a command in case of emergencies (there'll a couple of 1000 agents here in play).

    {
    "data": {
    "agentVersion": "2026.02.12.1058",
    "boot": "1.2.31",
    "capabilities": [
    "gitops",
    "logdownload",
    "agentSupportInfo",
    "agentprofiler",
    "log4j-safe-lib"
    ],
    "git": {
    "commitHash": "66c77adceed68f7167817f0a5be89ef60b9669c1",
    "commitMessage": "Let's go",
    "initialized": true,
    "present": true,
    "remoteBranch": "master",
    "remoteName": "configuration",
    "remoteUri": "myurl"
    },
    "hasCpuLoad": true,
    "hostname": "MyHostname",
    "java": {
    "version": "11.0.11",
    "vmname": "OpenJDK 64-Bit Server VM",
    "vmvendor": "AdoptOpenJDK",
    "vmversion": "11.0.11+9"
    },
    "log.counts.byMessage": {
    "ERROR": "ERROR",
    "WARN": "WARN"
    },
    "logAsRate": true,
    "loglevel": "INFO",
    "memory.nativeTotal": 134217728,
    "memory.total": 164429824,
    "metrics": true,
    "mode": 2,
    "origin": "ump",
    "pid": "42603",
    "startedAt": 1770975484774,
    "updateMode": "Auto",
    "user": "user"
    },
    "entityId": {
    "host": "96:5a:fd:ff:fe:54:2f:51",
    "pluginId": "com.instana.forge.infrastructure.application.instana.agent.InstanaAgent",
    "steadyId": "self"
    },
    "from": 1770978270000,
    "label": "Instana Agent @ hostname",
    "plugin": "instanaAgent",
    "snapshotId": "pXDWyYT998G1QqcV5yhJ4RJgVV0",
    "tags": []
    }


    ------------------------------
    Rainer Schuppe Rainer Schuppe
    Instana veteran (since 2016), APM oldtimer (since 2003 Wily, Dynatrace, AppDynamics, Instana, OpenTelemetry)
    https://observability-heroes.com
    ------------------------------



  • 4.  RE: Can the agent mode be changed via the REST API?

    Posted 02/16/26 02:39 AM

    Hi Rainer,

    Just one thought: the mode is being written locally to the file /opt/instana/agent/etc/instana/com.instana.agent.main.config.Agent.cfg. Perhaps it could be an idea to do a mass update of this file using automation (ansible, script, or similar), or by managing the agents through a github repository?



    ------------------------------
    Bart Bogaerts
    Client Engineering - Technology Engineer
    IBM Belgium
    Brussels
    ------------------------------



  • 5.  RE: Can the agent mode be changed via the REST API?

    Posted 02/16/26 05:00 AM

    Hi Bart,

    there is a compliance rule here (banking) that prohibits access to the internal GitHub (that runs in development) from production systems. Hence this doesn't work for us.

    Also a mass update of files in production here goes through a deployment workflow which takes weeks and we need an emergency shutdown button ;-)

    API whould be really nice, or a agent fleet management capability in the UI (which we know is pn the roadmap).

    Regards,

    Rainer



    ------------------------------
    Rainer Schuppe Rainer Schuppe
    Instana veteran (since 2016), APM oldtimer (since 2003 Wily, Dynatrace, AppDynamics, Instana, OpenTelemetry)
    https://observability-heroes.com
    ------------------------------



  • 6.  RE: Can the agent mode be changed via the REST API?

    Posted 02/16/26 07:41 AM

    I thought that will be the case for you Rainer, with all the compliance and regulations your systems need to have a safe mechanism... the way to go is to create an idea and include all these details so it can be assessed by Instana's PMs and provide an estimated timeline to make it happen.

    You can even share the idea here so more users are aware and vote for it.

    Regards,



    ------------------------------
    Israel Ochoa
    CSM Architect - NCEE Market
    IBM
    Stockholm
    Visit "IBM Instana - The Lost Docs" -> https://isreal8a.github.io/instana-docs
    ------------------------------