Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Service status driven by configuration #231

Open
jpwhitemn opened this issue Jul 11, 2020 · 7 comments
Open

Service status driven by configuration #231

jpwhitemn opened this issue Jul 11, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@jpwhitemn
Copy link
Member

🚀 Feature Request
Somewhat related to #119 and #103

Description

The CLI tool currently has a command for service status: ./edgex-cli status
Could that status command provide me the status of all the services listed in a configuration file if not from Consul/Registry?

Describe the solution you'd like

Since I may be adding / removing all sorts of services when developing (device services, app services, etc.), the status command could be particularly useful to provide me a quick status check. It would be enriched even more if it included an ability to check on various infrastructure elements
In other words, drive the list of service / infrastructure status returned by something like the following toml
[Services]
[Service]
Name = Core-data
Host = 'localhost'
Port = '48080'
Path ="/v1/api/ping"
[Service]
Name = Core-metadata
Host = 'localhost'
Port = '48081'
Path ="/v1/api/ping"
[Service]
Name = Core-data
Host = 'localhost'
Port = '48080'
Path ="/v1/api/ping"
[Infrastructure]
Name = RedisDB Server
Command ="redis-cli ping"

Describe alternatives you've considered

If you have integrated to SMA, the SMA could be called to provide the status of EdgeX services.
May not be as helpful in development environments where SMA is not always running and you want a quick check of what is working/up.

@jpwhitemn jpwhitemn added the enhancement New feature or request label Jul 11, 2020
@difince
Copy link
Contributor

difince commented Jul 14, 2020

Current implementation of ./edgex-cli status command does nothing more than calling GET http://<service>/api/v1/ping endpoint for all Clients specified in the /$HOME/./edgex-cli/configuration.toml file. If the response is with status code 200 and contains "pong" string - it prints "Ok" .
This means that if you update the file to contain other additional microservices (development mode) that has such endpoint /api/v1/ping - it will work for them as well

Currently, edgex-cli do not integrate with Registry service nor with SMA. We should work in that direction

@jpwhitemn
Copy link
Member Author

Diana - thanks. I tried this and it does not appear to work. As an example, here is my configuration.toml

jim@jim-ubuntu:~/forks/edgex-cli/res$ more configuration.toml
[Clients]
[Clients.Metadata]
Host = 'localhost'
Protocol = 'http'
Port = 48081
[Clients.CoreData]
Host = 'localhost'
Protocol = 'http'
Port = 48080
[Clients.Command]
Protocol = 'http'
Host = 'localhost'
Port = 48082
[Clients.Scheduler]
Host = 'localhost'
Protocol = 'http'
Port = 48085
[Clients.Notification]
Host = 'localhost'
Protocol = 'http'
Port = 48060
[Clients.Logging]
Host = 'localhost'
Protocol = 'http'
Port = 48061
[Clients.Virtual]
Hosts = 'localhost'
Protocol = 'http'
Port = 49990

yet here are the results
jim@jim-ubuntu:~/forks/edgex-cli$ ./edgex-cli status
Service Name URL Status
Metadata http://localhost:48081 Ok
CoreData http://localhost:48080 Ok
Command http://localhost:48082 Ok
Scheduler http://localhost:48085 Ok
Notification http://localhost:48060 Ok
Logging http://localhost:48061 Not Connected

Notice, for example the device virtual is not listed.

And just for your info, here are the containers that are running
jim@jim-ubuntu:~/forks/edgex-cli$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
93f676a708ad emqx/kuiper:0.4.2-alpine "/usr/bin/docker-ent…" 3 minutes ago Up 3 minutes 127.0.0.1:20498->20498/tcp, 9081/tcp, 127.0.0.1:48075->48075/tcp edgex-kuiper
a18243bd3e75 edgexfoundry/docker-sys-mgmt-agent-go:1.2.1 "/sys-mgmt-agent -cp…" 3 minutes ago Up 3 minutes 127.0.0.1:48090->48090/tcp edgex-sys-mgmt-agent
77bbda09bab2 edgexfoundry/docker-device-rest-go:1.1.1 "/device-rest-go --c…" 3 minutes ago Up 3 minutes 127.0.0.1:49986->49986/tcp edgex-device-rest
6d85341b66e0 edgexfoundry/docker-device-virtual-go:1.2.1 "/device-virtual --c…" 3 minutes ago Up 3 minutes 127.0.0.1:49990->49990/tcp edgex-device-virtual
b199756656bc edgexfoundry/docker-app-service-configurable:1.2.0 "/app-service-config…" 3 minutes ago Up 3 minutes 48095/tcp, 127.0.0.1:48100->48100/tcp edgex-app-service-configurable-rules
33ffc80b9898 edgexfoundry/docker-core-command-go:1.2.1 "/core-command -cp=c…" 3 minutes ago Up 3 minutes 127.0.0.1:48082->48082/tcp edgex-core-command
a324e9bf5ea3 edgexfoundry/docker-core-data-go:1.2.1 "/core-data -cp=cons…" 3 minutes ago Up 3 minutes 127.0.0.1:5563->5563/tcp, 127.0.0.1:48080->48080/tcp edgex-core-data
dd980c8eb9b9 edgexfoundry/docker-core-metadata-go:1.2.1 "/core-metadata -cp=…" 3 minutes ago Up 3 minutes 127.0.0.1:48081->48081/tcp edgex-core-metadata
1ad48f1025a6 edgexfoundry/docker-support-scheduler-go:1.2.1 "/support-scheduler …" 3 minutes ago Up 3 minutes 127.0.0.1:48085->48085/tcp edgex-support-scheduler
fde0a5a7750a edgexfoundry/docker-support-notifications-go:1.2.1 "/support-notificati…" 3 minutes ago Up 3 minutes 127.0.0.1:48060->48060/tcp edgex-support-notifications
3fec69ed10e9 redis:5.0.8-alpine "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 127.0.0.1:6379->6379/tcp edgex-redis
d8d477f33550 edgexfoundry/docker-edgex-consul:1.2.0 "edgex-consul-entryp…" 3 minutes ago Up 3 minutes 127.0.0.1:8400->8400/tcp, 8300-8302/tcp, 8301-8302/udp, 8600/tcp, 8600/udp, 127.0.0.1:8500->8500/tcp edgex-core-consul

@difince
Copy link
Contributor

difince commented Jul 15, 2020

Hi Jim @jpwhitemn , you updated ~/forks/edgex-cli/res$ more configuration.toml
but it read /$HOME/.edgex-cli/configuration.toml instead

@difince
Copy link
Contributor

difince commented Jul 15, 2020

During the installation it copies the "configuration.toml" from/fork/edgex-cli/res directory and pastes it in /$HOME/.edgex-cli/ file.
If you make build the file stays unchanged.
So in your case, you should do make install , to update the file in the hidden directory of your HOME
Or just update the file manually

@jpwhitemn
Copy link
Member Author

@difince - Diana ok, that's great! We should document that in the READMe because it does not indicate this feature and doesn't even come with a configuration file at the root. What if there is no configuration.toml? It seems to be operating on some default?

@difince
Copy link
Contributor

difince commented Jul 15, 2020

@jpwhitemn , all this make me think that the make build should be updated to copy the confguration.toml file from./resdirectory to $HOME/.edgex-cli/configuration.toml as the installation already does.
But this will mean that all changes done in $HOME/.edgex-cli/configuration.toml will be overwritten on each install/build

We won't have this problem if we consider removing the installation as you suggested in an email:

There are a few things I did note that I think we might want to chat about in doing this:
1) I think the make install is a bit problematic.  It took me some time to get all the permissions and such working right.  For the novice user, I am wondering if we should either:
a) just remove make install from the documentation and the CLI.
b) have a /bin directory in cli tool with some already existing compiled versions of the tool to use for common environments
c) install locally in the current directory
Thoughts??

@difince
Copy link
Contributor

difince commented Jul 15, 2020

I missed to answer :
What if there is no configuration.toml? It seems to be operating on some default?
There is an error in this case: Error occurred while parsing /home/difince/.edgex-cli/configuration.toml: open /home/difince/.edgex-cli/configuration.toml: no such file or directory

Yes, we should update the README file about this feature :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants