2 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
5 *************************
7 *************************
14 The 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.
19 When 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.
21 Upon 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.
23 After the testing of the server objects has completed, the feature returns a single consolidated report.
27 :caption: feature-healthcheck.properties
31 # ============LICENSE_START=======================================================
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
40 # http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
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
59 http.client.services=PAP,PDP
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
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
78 To utilize the healthcheck functionality, first stop policy engine and then enable the feature using the "*features*" command.
81 :caption: Enabling Healthcheck feature
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
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
98 The output of the enable command will indicate whether or not the feature was enabled successfully.
100 Policy engine can then be started as usual.
102 The Healthcheck can also be invoked manually as follows:
105 :caption: Manual Healthcheck invokation
108 # Assuming the healthcheck service credentials have not been changed
109 # post-installation within the drools container
111 source /opt/policy/config/drools/feature-healthcheck.conf
112 curl --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}" -X GET http://localhost:6969/healthcheck | python -m json.tool
117 .. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Feature+Healthcheck