Updating the Unified Agent configuration

You can update the Unified Agent configuration by using the configmap.

About this task

Use the configmap to update the Unified Agent settings.

The following configmaps are created when you deploy the Unified Agent.
# kubectl get configmap -n <namespace> | grep ua
cloud-ua-cloud-monitoring-config             1      16h
cloud-ua-cloud-monitoring-pluginconfig       2      16h
cloud-ua-cloud-monitoring-seelog             1      16h
ualk-ibmace                                  0      15d
ualk-ibmapic                                 0      15d
ualk-ibmmq                                   0      15d
ualk-icam-leader                             0      13d
ualk-nginx                                   0      23d
ualk-redis                                   0      23d 
  • ua-cloud-monitoring-config is a general config file for Unified Agent, and there is no need to modify it for most scenarios.
  • cloud-ya-cloud-monitoring-pluginconfig is the file for plug-in config where you can change plug-in setting.
  • cloud-ua-cloud-monitoring-seelog is for Unified Agent logging setting where you can change the log level or log path.
    Example of see log configuration:
    <?xml version="1.0" encoding="UTF-8"?>cloud-ua-cloud-monitoring-pluginconfig
    <seelog minlevel="debug">
       <outputs formatid="main">
          <rollingfile type="size" filename="/var/log/ua.log" maxsize="20000000" maxrolls="20" />
       </outputs>
       <formats>
          <format id="main" format="%Date/%Time [%LEV] %Msg%n" />
       </formats>
    </seelog>

    The log level identifiers for config files are as follows: "trace", "debug", "info", "warn", "error", and "critical".

  • The other configmaps are used for debugging when you meet any issues with the plug-ins.

General steps to change a configmap are as follows:

Procedure

  1. Find the correct configmap.
    kubectl get configmap -n <namespace> |grep ua
  2. Edit the configmap on demand.
    kubectl edit configmap <confimap> -n <namespace>

    To reconfigure each plug-in in Unified Agent, open the configmap cloud-ua-cloud-monitoring-pluginconfig to edit.

    • For NGINX plug-in, edit the [[inputs.nginx]] section. You can change the values to reconfigure the NGINX plug-in.
      Example:
      [[inputs.nginx]]
        ## An array of Nginx stub_status URI to gather stats.
        ### multiple servers can be set as comma-separated list
        ##  e.g: 
        ##  	urls =  ['http://10.0.0.0:80/nginx_status','http://10.1.2.3:80/nginx_status']  
        urls = ['http://10.0.0.0:80/nginx_status']
        ## Use TLS but skip chain & host verification
        #insecure_skip_verify = false
        ## HTTP response timeout (default: 5s)
        response_timeout = "5s" 
      Where:
      • urls is a comma-separated list of the NGINX server status URLs that you want to monitor.
      • reponse_timeout is the HTTP response timeout that you want. The default is 5s.
    • For Redis plug-in, edit the [[inputs.redis]] section. You can change the values to reconfigure the Redis plug-in.
      Example:
      [[inputs.redis]]
        ## specify servers via a url matching:
        ##  [protocol://][:password]@address[:port]
        ##  e.g.
        ##    tcp://localhost:6379
        ##    tcp://:password@192.168.99.100
        ### multiple servers can be set as comma-separated list
        ##  e.g: 
        ##  	servers =  ['tcp://:redisPassw0rd@10.0.0.0:6379','tcp://:redisPassw0rd@10.1.2.3:6379']
        servers =  ['tcp://:redisPassw0rd@10.0.0.0:6379']
        ## Use TLS but skip chain & host verification
        # insecure_skip_verify = true
      Where servers is a comma-separated list of the Redis server URLs that you want to monitor. Your Redis password can often be found by describing your Redis pod to find the name of your Redis password secret, inspecting the yaml of that secret, and decoding the password inside.
    • For IBM API Connect plug-in, edit the [[inputs.ibmapic]] section. You can change the values to reconfigure the IBM API Connect plug-in.
      Example:
      [[inputs.ibmapic]]
        server = "cm.wlavt.com"
        username = "admin"
        password = "Wmh1ODhqaWUhCg=="
        namespace = "apiconnect"
        toolkit_path = "/root/AVT/testcvt/apic-slim" 
      
      Where:
      • server is the IBM API Connect server hostname of IBM API Connect Cloud Manager.
      • username and password is the user name and password of the IBM API Connect server.
        Note: The password in configmap is encoded in base64. If you have changed the password, you need to run echo passw0rd | base64 to generate the base64 password again.
      • namespace is the namespace where IBM API Connect cluster is deployed, the default value is apiconnect.
      • toolkit_path is the absolute path of the IBM API Connect toolkit to register this plug-in.
    • For IBM App Connect Enterprise plug-in, edit the [[inputs.ibmace]] section. You can reset the username and password values.
      Example:
      [[inputs.ibmace]]
        username = "admin"
        password = "YWRtaW4K" 
      Note: The password in configmap is encoded in base64. If you have changed the password, you need to run echo passw0rd | base64 to generate the base64 password again.
    • For IBM MQ plug-in, edit the [[inputs.ibmmq]] section.
      Example:
      [[inputs.ibmmq]]
        username = "admin"
        password = "YWRtaW4K"
        mqservices = ["admin:YWRtaW4K@*.*"]
      Where:
      • username and password is the IBM MQ administrative REST Username and password. Generally speaking, these values will stay unchanged.
        Note: The password in configmap is encoded in base64. If you have changed the password, you need to run echo passw0rd | base64 to generate the base64 password again.
      • mqservices contains the service user name, password, service name, and the namespace where the service is deployed. It can include asterisk(*) for fuzzy matching, for example, * to match all, abc* to match the name that begins with abc. The default is *. You can add, remove, or modify a service or a namespace by changing the mqservices value, for example, ["admin:YWRtaW4K@test1-ibm-mq.default, "admin:YWRtaW4K@test2-ibm-mq.default"] . It means to monitor default namespaces for service test1-ibm-mq and test2-ibm-mq.
        Note: The password in configmap is encoded in base64. If you have changed the password, you need to run echo passw0rd | base64 to generate the base64 password again.
    • For DEM plug-in, edit the [[inputs.dem]] section.
      Example:
      [[inputs.dem]]
       tenant_id = "$APM_TENANT_ID"
       jaeger_sampler_type = "probabilistic"
       jaeger_sampler_param = 0.01
       processor_count = 8
      Where:
      • tenant_id is the tenant id of the cluster. Keep the default value.
      • jaeger_sampler_type is the type of the sampler. The values can be const, probabilistic, and rateLimiting.
      • jaeger_sampler_param is a value that is passed to the sampler. Valid values for Param field are as follows:
        • For const sampler, it is 0 for always false and 1 for always true.
        • For probabilistic sampler, the probability value is between 0 and 1.
        • For rateLimiting sampler, it is the number of spans per second.
      • processor_count is the work thread count of the DEM plugin.
    • For OpenShift plug-in, you can run the deployment script openshiftua_conf.sh that you can get from the image package.
      1. Go to the folder where you extract the unifiedAgent_2019.4.0.tar.gz package, and find the openshiftua_conf.sh file in the subfolder of ./deployment.
      2. Execute the script openshiftua_conf.sh in the OpenShift environment to generate configuration file.
      3. During the execution, enter y to the router that you want to monitor.
      4. After the execution is completed, a subfolder pluginconfig including the openshiftua.conf file is created in the .deployment directory, for example, ./deployment/pluginconfig/openshiftua.conf. You can find the following section in the pluginconfig/openshiftua.conf file:
        [[inputs.openshiftua]]
          ## Arrays of Openshift Router metrics URI and other properties to gather route and performance data.
          
          urls = ["http://admin:*******@172.16.174.96:1936/metrics","http://admin:*******@9.30.100.180:1938/metrics"]
          routernames = ["router01","router02"]
          routercpulimits=["100m","100m"]
          routermemlimits = ["256Mi","256Mi"]
          routerpods = ["router-3-n4m7a","routertest-1-9rv6r"]
          routernamespaces = ["default","default"]
          # providerID from k8monitor configmap
          providerID= ""
          response_timeout = "5s"
      5. Open the configmap file cloud-ua-cloud-monitoring-pluginconfig, and replace the whole[[inputs.openshiftua]] section with the new content that is generated in step d.
        $ kubectl edit cm ua-cloud-monitoring-pluginconfig -n namespace
  3. Find the running Unified Agent pod.
    kubectl get po -n <namespace> |grep ua
  4. Delete all Unified Agent running pods to restart:
    kubectl delete po <ua-pod> -n <namespace>
  5. Optional: Check that the restarted pod is running.
    kubectl get po -n <namespace> |grep ua