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

output_extract for external circonus_checks should support regular expressions #48

Open
mostfunkyduck opened this issue Mar 31, 2020 · 1 comment

Comments

@mostfunkyduck
Copy link

Terraform Version

Terraform v0.12.13

  • provider.circonus v0.8.0

Affected Resource(s)

  • circonus_check

Terraform Configuration Files

resource "circonus_check" "ieh_metrics" {
    active               = true
    metric_limit         = 0 
    name                 = "example"
    period               = "20s"
    tags                 = []
    target               = "blah"
    timeout              = "10s"
    type                 = "external"

    collector {
        id = "/broker/370"
    }   

    external {
        arg1           = "%[target]"
        command        = "/path/to/file.sh"
        output_extract = "(?<key>\\S+) (?<type>[a-zA-Z]) (?<value>\\S+)"
    }
  metrics...
}

Expected Behavior

This should create an external check.
The circonus documentation supports arbitrary regular expressions in output_extract https://docs.circonus.com/circonus/checks/check-types/external/#using-the-output-extract

Actual Behavior

What actually happened?
The code limits the output to the phrases "JSON" or "NAGIOS"
https://github.com/terraform-providers/terraform-provider-circonus/blob/57d100d890ac65522b947296bbfacdca05ef55d6/circonus/resource_circonus_check_external.go#L32

This results in the following error:
Error: Invalid output_extract specified ("(?<key>\\S+) (?<type>[a-zA-Z]) (?<value>\\S+)"): regexp failed to match string

Steps to Reproduce

Attempt to create an external check that uses a value besides 'JSON' or 'NAGIOS' for its output_extract

@maier
Copy link
Member

maier commented Apr 3, 2020

Fixed in PR #49, v0.9.0 has been released.

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

2 participants