Friday, 24 April 2020

Error evaluating omc_PerformanceOverview:non_windows_generic_apache_perf

Okay so fighting with Oracle Management Cloud to try and get it to monitor a generic Apache server on Oracle Linux.

Other than Apache actually being up and serving content the next thing that you're interested in is performance.

This is the error that you might see.


Warning Error evaluating omc_PerformanceOverview:non_windows_generic_apache_perf - java.lang.Throwable: Please check the 'server-status' configuration in the httpd.conf file at /home/omcagent/plugins/oracle.em.sgfm.zip/1.43.0/scripts/generic_apache/ahs_get_serverStatusVal.pl line 22.

The script referenced in the alert does bugger all, it has a single line of code;

die "Please check the 'server-status' configuration in the httpd.conf file";

However the metric is still collected by the agent.

omcli status agent scheduler | grep -i non_windows_generic_apache_perf
2020-04-24 11:44:01.368 : omc_generic_apache:MyApacheServer:non_windows_generic_apache_perf

And you can still generate the error on the agent.

omcli getmetric agent MyApacheServer,omc_generic_apache,omc_PerformanceOverview
Oracle Management Cloud Agent
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
EMD getmetric error: Please check the 'server-status' configuration in the httpd.conf file at /home/omcagent/200307.0800/plugins/oracle.em.sgfm.zip/1.48.0/scripts/generic_apache/ahs_get_serverStatusVal.pl line 22.

All this is despite the fact that the documentation says that performance metrics are supported.  https://docs.oracle.com/en/cloud/paas/management-cloud/monmr/apache-http-server.html

Generic Apache is such a fundamental entityType that I couldn't leave it there, after a bit of hacking in the scripts I worked out that the entity didn't have omc_version.  You can get your version from the server-status page.

Mine came back as;

<dl><dt>Server Version: Apache/2.4.6 ()</dt>

So the next problem was how to set it.  I tried editing the targets.xml file and adding

<Property NAME="omc_version" VALUE="Apache/2.4"/>

This didn't work although I expected it to.  So next I used the updateEntity REST API to add the value.

curl --location --request PATCH 'https://MyOMCInstance-MyOCITenant.omc.ocp.oraclecloud.com/serviceapi/entityModel/data/entities/AA3F54A39F7B852A73272AE687D1B638' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic c3RldmVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXTokMG55YUYwMHQkMG55YUYwMHQx' \
--header 'Content-Type: text/plain' \
--data-raw '{
    "entityType": "omc_generic_apache",
    "entityName": "Myapache",
    "properties": {
        "capability": {
            "displayName": "Capability",
            "value": "monitoring"
        },
        "omc_server_status_connect_host": {
            "displayName": "Server status connection hostname",
            "value": "localhost"
        },
        "omc_server_root": {
            "displayName": "Server Root",
            "value": "/etc/httpd"
        },
        "omc_version": {
            "displayName": "Version",
            "value": "Apache/2.4"
        },
        "omc_httpd_conf_path": {
            "displayName": "Absolute directory path of httpd configuration file",
            "value": "/etc/httpd/conf/httpd.conf"
        },
        "omc_binary_home": {
            "displayName": "Binary Home",
            "value": "/usr/sbin"
        },
        "omc_is_remote": {
            "displayName": "Is Remote",
            "value": "no"
        },
        "omc_listen_port": {
            "displayName": "Listen Port",
            "value": "80"
        },
        "host_name": {
            "displayName": "Host Name",
            "value": "MyApache.xxxxxxx.oraclevcn.com"
        },
        "omc_protocol": {
            "displayName": "Protocol",
            "value": "http"
        }
    },
    "tags": {
        "tag_a": "blah"
    },
    "entityDisplayName": "MyApache",
    "namespace":"EMAAS"
}'

you could equally have used omcli update_entity.

After adding the omc_version this is what happens.

omcli getmetric agent MyApache,omc_generic_apache,omc_PerformanceOverview
Oracle Management Cloud Agent
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
dataServedRate,idleWorkers,busyWorkers,busyWorkersUtilization
0.108,9,1,0

So now I have the metric collecting, all I need to do now is wait for them to appear in OMC.