3ddc409cbe525c713560529231b35bfe7f4d08cc
[doctor.git] / docs / release / configguide / feature.configuration.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3
4 Doctor Configuration
5 ====================
6
7 OPNFV installers install most components of Doctor framework including
8 OpenStack Nova, Neutron and Cinder (Doctor Controller) and OpenStack
9 Ceilometer and Aodh (Doctor Notifier) except Doctor Monitor.
10
11 After major components of OPNFV are deployed, you can setup Doctor functions
12 by following instructions in this section. You can also learn detailed
13 steps in setup_installer() under `doctor/tests`_.
14
15 .. _doctor/tests: https://gerrit.opnfv.org/gerrit/gitweb?p=doctor.git;a=tree;f=tests;
16
17 Doctor Inspector
18 ----------------
19
20 You need to configure one of Doctor Inspector below.
21
22 **Doctor Sample Inspector**
23
24 Sample Inspector is intended to show minimum functions of Doctor Inspector.
25
26 Doctor Sample Inspector suggested to be placed in one of the controller nodes,
27 but it can be put on any host where Doctor Monitor can reach and access
28 the OpenStack Controller (Nova).
29
30 Make sure OpenStack env parameters are set properly, so that Doctor Inspector
31 can issue admin actions such as compute host force-down and state update of VM.
32
33 Then, you can configure Doctor Inspector as follows:
34
35 .. code-block:: bash
36
37     git clone https://gerrit.opnfv.org/gerrit/doctor -b stable/danube
38     cd doctor/tests
39     INSPECTOR_PORT=12345
40     python inspector.py $INSPECTOR_PORT > inspector.log 2>&1 &
41
42 **Congress**
43
44 OpenStack `Congress`_ is a Governance as a Service (previously Policy as a
45 Service). Congress implements Doctor Inspector as it can inspect a fault
46 situation and propagate errors onto other entities.
47
48 .. _Congress: https://wiki.openstack.org/wiki/Congress
49
50 Congress is deployed by OPNFV installers. You need to enable doctor
51 datasource driver and set policy rules. By the example configuration below,
52 Congress will force down nova compute service when it received a fault event
53 of that compute host. Also, Congress will set the state of all VMs running on
54 that host from ACTIVE to ERROR state.
55
56 .. code-block:: bash
57
58     openstack congress datasource create doctor doctor
59
60     openstack congress policy rule create \
61         --name host_down classification \
62         'host_down(host) :-
63             doctor:events(hostname=host, type="compute.host.down", status="down")'
64
65     openstack congress policy rule create \
66         --name active_instance_in_host classification \
67         'active_instance_in_host(vmid, host) :-
68             nova:servers(id=vmid, host_name=host, status="ACTIVE")'
69
70     openstack congress policy rule create \
71         --name host_force_down classification \
72         'execute[nova:services.force_down(host, "nova-compute", "True")] :-
73             host_down(host)'
74
75     openstack congress policy rule create \
76         --name error_vm_states classification \
77         'execute[nova:servers.reset_state(vmid, "error")] :-
78             host_down(host),
79             active_instance_in_host(vmid, host)'
80
81 Doctor Monitor
82 --------------
83
84 **Doctor Sample Monitor**
85
86 Doctor Monitors are suggested to be placed in one of the controller nodes,
87 but those can be put on any host which is reachable to target compute host and
88 accessible by the Doctor Inspector.
89 You need to configure Monitors for all compute hosts one by one.
90
91 Make sure OpenStack env parameters are set properly, so that Doctor Inspector
92 can issue admin actions such as compute host force-down and state update of VM.
93
94 Then, you can configure the Doctor Monitor as follows (Example for Apex deployment):
95
96 .. code-block:: bash
97
98     git clone https://gerrit.opnfv.org/gerrit/doctor -b stable/danube
99     cd doctor/tests
100     INSPECTOR_PORT=12345
101     COMPUTE_HOST='overcloud-novacompute-1.localdomain.com'
102     COMPUTE_IP=192.30.9.5
103     sudo python monitor.py "$COMPUTE_HOST" "$COMPUTE_IP" \
104         "http://127.0.0.1:$INSPECTOR_PORT/events" > monitor.log 2>&1 &