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

Manually executing check - no matching entities #5002

Open
jhenderson-pro opened this issue May 2, 2023 · 3 comments
Open

Manually executing check - no matching entities #5002

jhenderson-pro opened this issue May 2, 2023 · 3 comments
Assignees
Milestone

Comments

@jhenderson-pro
Copy link
Member

jhenderson-pro commented May 2, 2023

Expected Behavior

As a Sensu operator, I'd expect to be able to manually execute a check via the web UI or sensuctl if that check executes normally when scheduled.

Current Behavior

Currently, I have a check with an agent entity and proxy entity that does execute when scheduled but cannot manually execute via sensuctl or the web UI. This is the error:

2023-05-02 09:36:52 {"check":"scrape-snmp","component":"schedulerd","level":"warning","msg":"no matching entities, check will not be published","namespace":"default","time":"2023-05-02T15:36:52Z"}

Possible Solution

Steps to Reproduce (for bugs)

  1. Sensu Docker image
  2. Add check and proxy entity
  3. Let the check execute normally to show its functions as desired
  4. Manually execute check via sensuctl command or in the web UI
  5. See the error above in the logs

Context

Your Environment

  • Sensu version used (sensuctl, sensu-backend, and/or sensu-agent): 6.9.2
  • Installation method (packages, binaries, docker, etc.): Sensu Docker image
  • Operating System and version (e.g. Ubuntu 14.04): Alpine from the Docker image
@jhenderson-pro
Copy link
Member Author

Resources:

resources.zip

@c-kruse
Copy link
Contributor

c-kruse commented May 5, 2023

Verified that an edge condition where requesting an adhoc execution of a check with proxy_requests configured results in incorrect behavior scheduling. This should be a relatively simple patch to fix.

diff --git a/backend/schedulerd/executor.go b/backend/schedulerd/executor.go
index a6b30570e..0675b4b9c 100644
--- a/backend/schedulerd/executor.go
+++ b/backend/schedulerd/executor.go
@@ -198,7 +198,8 @@ func (a *AdhocRequestExecutor) listenQueue(ctx context.Context) {
                        continue
                }

-               if err = a.processCheck(ctx, &check); err != nil {
+               checkCtx := corev2.SetContextFromResource(ctx, &check)
+               if err = a.processCheck(checkCtx, &check); err != nil {
                        select {
                        case a.listenQueueErr <- err:
                        case <-ctx.Done():

As pointed out in the sensu-engineering slack thread, this use case isn't very obviously useful, and isn't something users are very likely to run into.

@ManishaKumari295
Copy link

ManishaKumari295 commented Feb 1, 2024

Steps of execution of issue:

  1. Run sensuctl entity list and note the name of your agent entity (typically your hostname).
  2. Edit the provided check.yaml at line 34 to add the entity name. The line should be something like - entity:agentname.
  3. sensuctl create -f ./check.yaml
  4. sensuctl create -f ./proxy.yaml
  5. Wait a little bit and run
    sensuctl event info backend-entity prom-metrics
    and make sure an event is present.
  6. Once the event is present run
    sensuctl check execute prom-metrics
    It should print Issued.
  7. Verify the logs in backend logs , the "no matching entity " error must not be seen inspite the matched entity should be reflected.

@fguimond fguimond added this to the 6.12.0 milestone Sep 12, 2024
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

4 participants