blob: a0793e92b4c1d49882e0fb72fd2136dc1ef7c9a3 [file] [log] [blame]
Saryu Shah15aad8c2017-11-09 19:05:29 +00001
2.. This work is licensed under a Creative Commons Attribution 4.0 International License.
3.. http://creativecommons.org/licenses/by/4.0
4
5*************************
6Feature: Healthcheck
7*************************
8
9.. contents::
10 :depth: 3
11
12Summary
13^^^^^^^
14The Healthcheck feature provides reports used to verify the health of *PolicyEngine.manager* in addition to the construction, operation, and deconstruction of HTTP server/client objects.
15
16Usage
17^^^^^
18
19When enabled, the feature takes as input a properties file named "*feature-healtcheck.properties*" (example below). This file should contain configuration properties necessary for the construction of HTTP client and server objects.
20
21Upon initialization, the feature first constructs HTTP server and client objects using the properties from its properties file. A healthCheck operation is then triggered. The logic of the healthCheck verifies that *PolicyEngine.manager* is alive, and iteratively tests each HTTP server object by sending HTTP GET requests using its respective client object. If a server returns a "200 OK" message, it is marked as "healthy" in its individual report. Any other return code results in an "unhealthy" report.
22
23After the testing of the server objects has completed, the feature returns a single consolidated report.
24
25
26 .. code-block:: bash
27 :caption: feature-healthcheck.properties
28 :linenos:
29
30 ###
31 # ============LICENSE_START=======================================================
32 # feature-healthcheck
33 # ================================================================================
34 # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
35 # ================================================================================
36 # Licensed under the Apache License, Version 2.0 (the "License");
37 # you may not use this file except in compliance with the License.
38 # You may obtain a copy of the License at
39 #
40 # http://www.apache.org/licenses/LICENSE-2.0
41 #
42 # Unless required by applicable law or agreed to in writing, software
43 # distributed under the License is distributed on an "AS IS" BASIS,
44 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45 # See the License for the specific language governing permissions and
46 # limitations under the License.
47 # ============LICENSE_END=========================================================
48 ###
49
50 http.server.services=HEALTHCHECK
51 http.server.services.HEALTHCHECK.host=0.0.0.0
52 http.server.services.HEALTHCHECK.port=6969
53 http.server.services.HEALTHCHECK.restClasses=org.onap.policy.drools.healthcheck.RestHealthCheck
54 http.server.services.HEALTHCHECK.managed=false
55 http.server.services.HEALTHCHECK.swagger=true
56 http.server.services.HEALTHCHECK.userName=healthcheck
57 http.server.services.HEALTHCHECK.password=zb!XztG34
58
59 http.client.services=PAP,PDP
60
61 http.client.services.PAP.host=pap
62 http.client.services.PAP.port=9091
63 http.client.services.PAP.contextUriPath=pap/test
64 http.client.services.PAP.https=false
65 http.client.services.PAP.userName=testpap
66 http.client.services.PAP.password=alpha123
67 http.client.services.PAP.managed=true
68
69 http.client.services.PDP.host=pdp
70 http.client.services.PDP.port=8081
71 http.client.services.PDP.contextUriPath=pdp/test
72 http.client.services.PDP.https=false
73 http.client.services.PDP.userName=testpdp
74 http.client.services.PDP.password=alpha123
75 http.client.services.PDP.managed=false
76
77
78To utilize the healthcheck functionality, first stop policy engine and then enable the feature using the "*features*" command.
79
80 .. code-block:: bash
81 :caption: Enabling Healthcheck feature
82
83 policy@hyperion-4:/opt/app/policy$ policy stop
84 [drools-pdp-controllers]
85 L []: Stopping Policy Management... Policy Management (pid=354) is stopping... Policy Management has stopped.
86 policy@hyperion-4:/opt/app/policy$ features enable healthcheck
87 name version status
88 ---- ------- ------
89 controlloop-utils 1.1.0-SNAPSHOT disabled
90 healthcheck 1.1.0-SNAPSHOT enabled
91 test-transaction 1.1.0-SNAPSHOT disabled
92 eelf 1.1.0-SNAPSHOT disabled
93 state-management 1.1.0-SNAPSHOT disabled
94 active-standby-management 1.1.0-SNAPSHOT disabled
95 session-persistence 1.1.0-SNAPSHOT disabled
96
97
98The output of the enable command will indicate whether or not the feature was enabled successfully.
99
100Policy engine can then be started as usual.
101
102The Healthcheck can also be invoked manually as follows:
103
104 .. code-block:: bash
105 :caption: Manual Healthcheck invokation
106
107
108 # Assuming the healthcheck service credentials have not been changed
109 # post-installation within the drools container
110
Michael Mokry9146f552018-11-07 16:28:44 -0600111 source /opt/app/policy/config/feature-healthcheck.conf.environment
112 curl -k --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}" -X GET https://localhost:6969/healthcheck | python -m json.tool
Saryu Shah15aad8c2017-11-09 19:05:29 +0000113
114
115End of Document
116
117.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Feature+Healthcheck