Stan's Corner

 View Only

Using IBM Instana to automatically instrument Apache HTTPd websites for monitoring on Red Hat OpenShift

By LU XIAO posted Tue December 19, 2023 11:45 PM

  

IBM Instana website automatic instrumentation quickly and easily enables website monitoring by automatically injecting the JavaScript agent into the website with minimum configuration steps and no code changes of the website. For more information, see JavaScript agent.

Assuming you have set up two Apache HTTPd servers on Red Hat OpenShift in different namespaces. Each HTTPd server has two defined websites. This automatic website instrumentation assists you to monitor the performance of the defined websites.

The following figure illustrates a scenario in which individual departments might have same business requirements, such as a query service. The web servers are created in different namespaces, isolating groups of resources within the departmental scope.

webservers under different namespaces

Enabling website automatic instrumentation

To enable website automatic instrumentation on the Red Hat OpenShift cluster, complete the following steps: 

Step 1: Create websites in Instana UI dashboard

 

1.1 In the Instana UI, go to the Websites dashboard and create four websites with following names.

      - shop.dept1.apps.subside.cp.fyre.ibm.com

      - query.dept1.apps.subside.cp.fyre.ibm.com

      - flight.dept2.apps.subside.cp.fyre.ibm.com

      - query.dept2.apps.subside.cp.fyre.ibm.com

 

Add Website Get started with website monitoring to better understand how your website performance impacts user experience. Configuration is simple! Website Name Add Website

  

1.2 Record the values for reportingUrl, key, and jsAgentUrl for each website.

 

 

Step 2: Deploy Instana agent on your Openshift cluster

 

You can install the Instana agent by using operator, helm chart, and yaml file. For more information, see Installing the host agent on Red Hat OpenShift.

Step 3: Configure Instana agent to enable website automatic instrumentation

 

By default, the website automatic instrumentation is disabled. You can change the agent configuration to enable this feature. For more information, see Website automatic instrumentation. 

You can define the matching rules for your websites as shown in the following:

  configuration.yaml: |

    com.instana.plugin.eum:

      instrumentation:

        jsAgentUrl: 'https://eum.instana.io/eum.min.js'

        reportingUrl: 'https://eum.instana.rocks'

        trackSessions: true

        websites:

          - name: 'shop.dept1.apps.subside.cp.fyre.ibm.com'

            key: 'AmrmgaCpTemMdOHIT8XXZw'

            selector:

              matchExpressions:

                - key: 'k8s/namespace'

                  operator: 'Equals'

                  values:

                    - 'dept1'

                - key: 'k8s/podname'

                  operator: 'StartWith'

                  values:

                    - 'httpd-2.4'

                - key: 'url/filename'

                  operator: 'StartWith'

                  values:

                    - '/var/www/shop'

 

          - name: 'query.dept1.apps.subside.cp.fyre.ibm.com'

            key: 'ALd2cAguTvyZPqSgRTs9oA'

            selector:

              matchExpressions:

                - key: 'k8s/namespace'

                  operator: 'Equals'

                  values:

                    - 'dept1'

                - key: 'k8s/podname'

                  operator: 'StartWith'

                  values:

                    - 'httpd-2.4'

                - key: 'url/filename'

                  operator: 'StartWith'

                  values:

                    - '/var/www/query'

 

          - name: 'flight.dept2.apps.subside.cp.fyre.ibm.com'

            key: 'hQkMV0ISTQemHsUOc-EJsg'

            selector:

              matchExpressions:

                - key: 'k8s/namespace'

                  operator: 'Equals'

                  values:

                    - 'dept2'

                - key: 'k8s/podname'

                  operator: 'StartWith'

                  values:

                    - 'httpd-2.4'

                - key: 'url/filename'

                  operator: 'StartWith'

                  values:

                    - '/var/www/flight'

 

          - name: 'query.dept2.apps.subside.cp.fyre.ibm.com'

            key: '98SNdmCtR-a1Bsia51pGtw'

            selector:

              matchExpressions:

                - key: 'k8s/namespace'

                  operator: 'Equals'

                  values:

                    - 'dept2'

                - key: 'k8s/podname'

                  operator: 'StartWith'

                  values:

                    - 'httpd-2.4'

                - key: 'url/filename'

                  operator: 'StartWith'

                  values:

                    - '/var/www/query'

 

 

When all the match expressions evaluate to true, the HTTP requests to the specified URL through browser are monitored in the format of beacons. Later, these beacons are transmitted to the related website on the reporting URL https://eum.instana.rocks.

 

To achieve end-to-end monitoring with backend trace correlation, you must enable Apache HTTPd Tracing in agent configuration simultaneously.

 

    com.instana.plugin.httpd:

      tracing:

        enabled: true

        autoRestart: true

 

Step 4: Access websites and check whether EUM JavaScript is injected

 

Open the browser developer tools to verify whether the EUM code snippet is added to the <head> section of an HTML document.

Inspector 
q Search HTML 
<meta 
<tit te>index 
<script> 
Console 
D Debugger 
Network 
01 
( function (s, t, a, [t] I (s [t] ) {n. q. push(arguments)}, 
n• Date)}) (window, "InstanaEumObject" , "ineum" ) ; 
ineum( ' reportingUrl' , 
'https://eum. instana. rocks'); ineum( 'key' , 
' hQkMVØISTQemHsUOc—EJsg i); ineum( 'trackSessions ) ; 
</script> 
<script defer="" crossorigin="anonymous" 
<hl>lt works 
ea href— 
href— 
imp le/doj oget. 
">RTTestware/  

Step 5: Verify the performance data in Instana website dashboard

 

You can view and verify the website performance data in the website dashboard.

flight.dept2.apps.subside.cp.fyre.ibm.com 
Window Width v 
Pages 
Smart Alerts 
Last 5 minutes 
onLoad Time (95th) 
1.86 
Live 
No Issues 
Analyze Page Loads 
Filters 
Summary 
Browser v 
Speed 
OS v 
Resources 
Country v 
Subdivision v 
Meta v 
HTTP Requests 
JS Errors 
Geography 
Custom Events 
Configuration 
onLoad Time (mean) 
976 ms 
All 
Page Loads 
Page Views 
Page Loads Page Transitions 
2 
Dec 06 
Releases 
Alerts 
Page Transitions 
JS Errors 
JS Errors 
1 
Releases 
Alerts 
onLoad Time (90th) 
1.86 
onLoad Time 
onLoad Time 
2,oooms 
Releases 
Alerts

 

You can also use Instana analytical capabilities to analyze website monitoring data in the analytics view.

Analytics 
Filter 
Group 
O Selected 
Website 
Page 
Browser 
os 
All 
Cou ntry 
Subdivision 
Window Width 
> 
Websites / Page Loads 
Dec 06 
Last 5 minutes 
Configuration 
Name 
= flight.dept2.apps.su 
Add filter 
sum 
x 
Live 
Clear 
Location 
path 
1.11 Chart 
Beacon count (sum) 
2 
6 
Beacon count 
2 Groups 
16:28:10 
Beacon count (sum) 
Select metrics 
API query 
Descending 
Location. Path 
/ajaxDog.html 
Location. Path 
Earliest Timestamp 
2023-12-06, 16:28:04 
Earliest Timestamp 
2023-12-06, 16:28:07 
Beacon count 
Beacon count 
onLoad time 
Is 
onLoad time 
585ms

 

Step 6: Verify the websites in the Instana infrastructure map dashboard

 

In the Infrastructure Map dashboard, locate your zone. You will observe the website that runs on the system and represented as a block in the pillar. To see the infrastructure hierarchy of the website, click Block.

Map 
Infrastructure 
Analyze Infrastructure 
Comparison Table 
o 
Smart Alerts 
Last 5 minutes 
Save 
Live 
Filters 
8 
entity. zone : eum 
(J 
6 
flight.dept2.apps.subside.cp.fyre.ibm.co 
m: httpd @215572 
Website 
Open Dashboard 
Website 
Name 
No Issues 
fli 
Server Type 
httpd 
Process ID 
215572 
website ID 
hQkMV01STQemHSUoc-Ejsg 
Auto-instrumented 
True 
Aggressive Instrumentation 
Content-Types 
text/html, application/xhtml+xml 
Track Sessions 
True 
JavaScript Agent 
https://eum.instana.io/eum.min.js 
e um 
Website: flight.dept2.apps.subside.cp.fyre.ibm.com: httpd @215572

Summary

Instana website automatic instrumentation reduces the manual efforts to inject JavaScript into the Apache HTTPd websites. This feature helps you to enable website monitoring more efficiently.

Co-Authors: 

Xiao Lu (xiaolu@cn.ibm.com) - Developer for Instana End User Monitoring
Li Shao Rong (lsrlibj@cn.ibm.com) - Dev lead for Instana End User Monitoring
Wang Zhi Hong (wangzhih@cn.ibm.com) - Developer for Instana End User Monitoring

Permalink