For telegraf agent to collect metrics for some of the application services, you must make modifications in the endpoint VMs. After you make these modifications, the agent will start collecting metrics. You must SSH to the virtual machine where you have deployed the agent and modify the configuration files.

Apache HTTPD

Modify the conf file available in /etc/httpd/conf.modules.d/status.conf and enable the mod_status for the HTTPD plugin for the agent to collect metrics.
<IfModule mod_status.c>

<Location /server-status>

    SetHandler server-status

</Location>

ExtendedStatus On

</IfModule>
If the conf file is not available, you must create one. Restart the HTTPD service after modifying the conf file with the following command:
systemctl restart httpd

Java Plugins

To monitor Java applications, you can deploy the Jolokia plugin as a .WAR file or .JAR file. If you are deploying a .WAR file, you do not have to restart the services.

For a .JAR file deployment, you have to restart the application service after including the full file path of the JAR in the JMX argument of the JAVA process which you are monitoring.

Nginx

Add the following lines to the conf file available in /etc/nginx/nginx.conf:
http {
    server {
        location /status {
            stub_status on;
   access_log off;
   allow all;
  }
    }
}
Restart the Nginx service with the following command:
systemctl restart nginx

Postgres

In the configuration file available in the /var/lib/pgsql/data/pg_hba.conf, change the value of local all postgres peer to local all postgres md5 and restart the service with the following command:
sudo service postgresql restart

Cassandra Database

To monitor the Cassandra database application, the Jolokia jar must be included as a JVM input to the Cassandra database application. Complete the following steps:
  1. Modify /etc/default/cassandra.
    echo "export JVM_EXTRA_OPTS=\"-javaagent:/usr/share/java/jolokia-jvm-1.6.0-agent.jar=port=8778,host=localhost\"" | sudo tee -a /etc/default/cassandra
  2. Alternatively, you can enable the agent by modifying cassandra-env.sh. Include the following line at the end of the cassandra-env.sh:
    JVM_OPTS="$JVM_OPTS -javaagent:/usr/share/java/jolokia-jvm-1.6.0-agent.jar=port=8778,host=localhost"

    After you see the JVM inputs, restart the Cassandra service.

Oracle Database

To monitor the Oracle database, complete these steps:
  1. Download the instant client library from: https://www.oracle.com/database/technologies/instant-client/downloads.html.

    You must download the Oracle instant library and included it in the PATH.

  2. Create a User.
    CREATE USER <UserName> IDENTIFIED BY <yourpassword>;
     GRANT select_catalog_role TO <UserName>;
     GRANT CREATE SESSION TO <UserName>;
  3. Install Python 3.6 or later.
    python3 -m pip install cx_Oracle --upgrade
  4. Set the PATH of TNS_ADMIN.

    For example, the path for TNS_ADMIN will be similar to c:\app\product\<version>\dbhome_1\NETWORK\ADMIN”.

Note: Oracle database cannot be activated on Linux platforms.

Active MQ 5.16 and Later Versions

To activate Active MQ 5.16 and later versions, complete the following steps:

  • Navigate to /opt/activemq/apache-activemq-5.16.0/webapps/api/WEB-INF/classes/jolokia-access.xml
  • Remove or comment out the following lines:
    <cors>
      <strict-checking/>
    </cors>
  • Restart the Active MQ service.