Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple health check on simple service doesn't work #21982

Open
rzimmerdev opened this issue Dec 1, 2024 · 1 comment
Open

Simple health check on simple service doesn't work #21982

rzimmerdev opened this issue Dec 1, 2024 · 1 comment

Comments

@rzimmerdev
Copy link

Overview of the Issue

Can't seem to make a simple service health check work. I register it through Python's request lib, then make an endpoint available for health checks, but service checks show failing on UI.

Reproduction Steps

  1. Start and register the service
payload = {
'Address': '127.0.0.1', 
'Check': {
    'DeregisterCriticalServiceAfter': '30s', 
    'HTTP': 'http://127.0.0.1:5000', 
    'Interval': '5s', 
    'Timeout': '5s'}, 
'ID': 'my-service', 
'Name': 'MyService', 
'Port': 5000, 
'Tags': ['greeter']
}

response = requests.put('http://127.0.0.1:8500/v1/agent/service/register', json=payload)

Testing the service manually:

>>> curl -i http://127.0.0.1:5000/health
HTTP/1.1 200 OK
date: Sun, 01 Dec 2024 04:45:37 GMT
server: uvicorn
content-length: 20
content-type: application/json

"Service is healthy"%  

>>> curl -i http://127.0.0.1:5000/
HTTP/1.1 200 OK
date: Sun, 01 Dec 2024 04:45:55 GMT
server: uvicorn
content-length: 15
content-type: application/json

"Hello, world!"%      

And in the UI:

image

also, after 30 seconds the service gets removed.

Consul info for both Client and Server

Client info agent: check_monitors = 0 check_ttls = 0 checks = 0 services = 0 build: prerelease = revision = c3f767b version = 1.15.4 version_metadata = consul: acl = disabled bootstrap = false known_datacenters = 1 leader = true leader_addr = 127.0.0.1:8300 server = true raft: applied_index = 1145 commit_index = 1145 fsm_pending = 0 last_contact = 0 last_log_index = 1145 last_log_term = 2 last_snapshot_index = 0 last_snapshot_term = 0 latest_configuration = [{Suffrage:Voter ID:b28fa40e-ec1e-21d4-5cd7-dddbd20769b0 Address:127.0.0.1:8300}] latest_configuration_index = 0 num_peers = 0 protocol_version = 3 protocol_version_max = 3 protocol_version_min = 0 snapshot_version_max = 1 snapshot_version_min = 0 state = Leader term = 2 runtime: arch = amd64 cpu_count = 16 goroutines = 145 max_procs = 16 os = linux version = go1.20.4 serf_lan: coordinate_resets = 0 encrypted = false event_queue = 1 event_time = 2 failed = 0 health_score = 0 intent_queue = 0 left = 0 member_time = 1 members = 1 query_queue = 0 query_time = 1 serf_wan: coordinate_resets = 0 encrypted = false event_queue = 0 event_time = 1 failed = 0 health_score = 0 intent_queue = 0 left = 0 member_time = 1 members = 1 query_queue = 0 query_time = 1

Operating system and Environment details

Operating System:
Platform: linux - OpenSuse Tumbleweed
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Wed Sep 25 07:09:20 UTC 2024 (b87e886)
Available memory (MB): 31961
Available CPU cores: 16

Log Fragments

Don't know how

@rzimmerdev
Copy link
Author

Note: registering the payload check field to point to/health also doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant