Jack Lucas | 205fc2e | 2019-03-22 18:31:55 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # org.onap.dcae |
| 4 | # ================================================================================ |
Schmalzried, Terry (ts862m) | 15b4979 | 2020-08-21 15:59:22 -0400 | [diff] [blame^] | 5 | # Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved. |
Jack Lucas | 205fc2e | 2019-03-22 18:31:55 -0400 | [diff] [blame] | 6 | # ================================================================================ |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | # ============LICENSE_END========================================================= |
| 19 | # |
| 20 | # Checking Cloudify Manager readiness by looking |
| 21 | # for non-running services |
| 22 | # Relying on the output format of the "cfy status" command. |
| 23 | # A successful execution of the command outputs: |
| 24 | # |
| 25 | # cfy status |
| 26 | # Retrieving manager services status... [ip=localhost] |
| 27 | # |
| 28 | # Services: |
| 29 | # +--------------------------------+---------+ |
| 30 | # | service | status | |
| 31 | # +--------------------------------+---------+ |
| 32 | # | InfluxDB | running | |
| 33 | # | Logstash | running | |
| 34 | # | AMQP InfluxDB | running | |
| 35 | # | RabbitMQ | running | |
| 36 | # | Webserver | running | |
| 37 | # | Management Worker | running | |
| 38 | # | PostgreSQL | running | |
| 39 | # | Cloudify Console | running | |
| 40 | # | Manager Rest-Service | running | |
| 41 | # | Riemann | running | |
| 42 | # +--------------------------------+---------+ |
| 43 | # |
Schmalzried, Terry (ts862m) | 15b4979 | 2020-08-21 15:59:22 -0400 | [diff] [blame^] | 44 | # or: |
| 45 | # |
| 46 | # cfy status |
| 47 | # Retrieving manager services status... [ip=dcae-cloudify-manager] |
| 48 | # |
| 49 | # Services: |
| 50 | # +--------------------------------+--------+ |
| 51 | # | service | status | |
| 52 | # +--------------------------------+--------+ |
| 53 | # | Cloudify Console | Active | |
| 54 | # | PostgreSQL | Active | |
| 55 | # | AMQP-Postgres | Active | |
| 56 | # | Manager Rest-Service | Active | |
| 57 | # | RabbitMQ | Active | |
| 58 | # | Webserver | Active | |
| 59 | # | Management Worker | Active | |
| 60 | # +--------------------------------+--------+ |
| 61 | # |
| 62 | # When an individual service is not running, it will have a status other than "running" or "Active". |
Jack Lucas | 205fc2e | 2019-03-22 18:31:55 -0400 | [diff] [blame] | 63 | # If the Cloudify API cannot be reached, the "Services:" line will not appear. |
| 64 | |
| 65 | STAT=$(cfy status) |
| 66 | if (echo "${STAT}" | grep "^Services:$") |
| 67 | then |
| 68 | echo "Got a status response" |
Schmalzried, Terry (ts862m) | 15b4979 | 2020-08-21 15:59:22 -0400 | [diff] [blame^] | 69 | if !(echo "${STAT}" | egrep '^\| [[:alnum:]]+'| egrep -iv ' Active | running ') |
Jack Lucas | 205fc2e | 2019-03-22 18:31:55 -0400 | [diff] [blame] | 70 | then |
| 71 | echo "All services running" |
| 72 | exit 0 |
| 73 | else |
| 74 | echo "Some service(s) not running" |
| 75 | fi |
| 76 | else |
| 77 | echo "Did not get a status response" |
| 78 | fi |
| 79 | echo "${STAT}" |
| 80 | exit 1 |