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

"proxy_requests" attribute not supported when importing v1.2 check with sensuctl #1205

Closed
bukiadeniji opened this issue Mar 22, 2018 · 3 comments

Comments

@bukiadeniji
Copy link

"proxy_requests" attribute not supported in creating Proxy checks when importing a v1.2 legacy json check

Expected Behavior

ability to create and import a v1.2 json check with the following attributes

...
...
 "proxy_requests": {
        "entity_attributes": {
              "subscriptions": "eval: value.include?('linux')"
      }
 ...
 ...

Current Behavior

The import fails with error "checks with 'proxy_requests' attribute are not supported at this time"

Possible Solution

  1. "proxy_requests" attribute should be supported so v1.2 checks can be imported
  2. sensuctl should contain a flag for "proxy_requests" so proxy checks can be configured by CLI

Steps to Reproduce (for bugs)

Create check to with the "proxy_requests" attribute

{
  "checks": {
    "check_ping_proxy": {
      "command": "check_ping -H :::address::: -w 5,2% -c 10,5%",
      "subscribers": [
        "round-robin:MON"
      ],
      "interval": 60,
      "proxy_requests": {
        "entity_attributes": {
          "subscriptions": "eval: value.include?('linux')"
        }
      }
    }
  }
}

Import with sensuctl

$ cat check_ping_proxy.json | sensuctl import --legacy
ERROR   checks with 'proxy_requests' attribute are not supported at this time

==============================
ERROR unable to continue due to errors

Context

Use case: I want an external central agent to do a ping check (or ssh check) to all 500+ (and growing) servers in my network.
Currently unable to create a proxy requests with attributes that match multiple entities. Alternative is to create 500+ checks for just one parameter - which is not feasible

Your Environment

sensu-backend version
sensu-backend version 2.0.0-nightly#150c23b, build 150c23b, built 2018-03-09T01:43:45+0000

* Installation method (packages, binaries, docker etc.): **Packages**
* Operating System and version (e.g. Ubuntu 14.04): **CentOS Linux release 7.4.1708**
* Entities: **500+**
@majormoses
Copy link

Filters are very much one of the more difficult to figure out how to migrate as go will not have a ruby eval.

@bukiadeniji
Copy link
Author

Thanks @majormoses - I also get ERROR checks with 'proxy_requests' attribute are not supported at this time with using the following. It seems its failing on the "proxy_request" attribute.

      "proxy_requests": {
          "entity_attributes": ["entity.Class == 'proxy'"]
      }

@palourde
Copy link
Contributor

palourde commented Mar 22, 2018

Hi @bukiadeniji,

As @majormoses stated, the ruby eval functionality is no longer supported in Sensu 2 and unfortunately, we had to change the syntax to what we now call Sensu Query Expressions (SQE), which is essentially based on govaluate.

We are actively working on documentation around this new feature and we will try to provide as much examples as possible to help users convert their eval statements to SQE, but I don't think it will be possible to automatically convert them. This is why the import command throws an error if your check has the proxy_requests attribute configured; it will need to be manually imported.

For reference, it's not possible yet to do something similar to eval: value.include?('linux') in SQE, because of this issue: #922. Hopefully we can fix that soon!

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

3 participants