adding username and password in the webserverconfig.xml for apache webserver monitoring

book

Article ID: 222917

calendar_today

Updated On:

Products

CA Application Performance Management (APM / Wily / Introscope) DX APM SaaS CA Application Performance Management Agent (APM / Wily / Introscope) DX Application Performance Management

Issue/Introduction

We are using webserver monitoring extension to monitor an Apache webserver 

How can we enable user authentication in the extension - this does not appear to be documented.

Environment

Release : 20.x, 21.x

Component :

Resolution

Assuming authentication is defined similar to this in the httpd.conf

<Location /server-status>
SetHandler server-status
Order deny,allow
Allow from all
AuthType Basic
AuthName "Please login to access server status part"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
</Location>

then the user credentials can be passed in using the http header section in the WebServerConfig.xml entry e.g.

<WebServer Type="Apache" Enabled="true" ServerURL="http://myhost" DisplayName="LVN5671" RefreshFrequencyInSeconds="30" MetricsURL="server-status/">
<HttpHeaders>
      <HttpHeader name="Authorization" value = "Basic YXBtOmFwbQ=="/>
   </HttpHeaders>
</WebServer>

the encrypted password string can be obtained using base64 e.g.

# echo -n user:password |base64
YXBtOmFwbQ==

and the connection tested outside the agent using curl

# curl -H "Authorization: Basic YXBtOmFwbQ==" http://myhost/server-status