I am trying to create a NRI-FLEX integration that essentially reports back weather or not a specific service is up or not by curling the service's availability page (https://example.com/meta/availability). The regular curl command brings up to much unneeded information so I've been using the following command:
curl -s -i example.com/meta/availability | grep -E 'HTTP|Availability Check'
Which results in the following output: Output
Here is what I have so far:
integrations:
- name: nri-flex
interval: 60s
timeout: 10s
config:
name: Example_Availability
apis:
- name: Example_Availability
commands:
- name: ExampleServices-Availability
run: curl -s -i https://example.com/meta/availability | grep -E 'HTTP|Availability Check'
return_headers: true
regex_matches:
- expression: HTTP/1.1 (\d+)
keys:
[HTTP/1.1]
- expression: Availability Check (\w+)
keys:
[Availability Check]
custom_attributes:
Url: https://example.com/meta/availability
This results in the following output when I query it in New Relic: Bad Output For some reason it takes the first character of the header as the title and displays everything else as the result. I would like the results to look more like this:
| Status Code | Availability Check |
|---|---|
| 200 | Passed |
| 200 | Passed |
I've tried playing around with the regex expressions and using a few of different functions in I found in the various examples found here: https://github.com/newrelic/nri-flex/tree/master/examples but nothing has worked so far. I either get the output from the screenshot or the flex integration stops working.
Agent Version: 1.50.0 Integration Version: 1.10.0
Any help would be appreciated!
creator of Flex here.
The difference in your config vs. the examples is you are missing
split_output, this is to help Flex know when to start parsing as well as if there is continuous blocks of similar data.With your availability check expression you are missing a colon as well so this would never work.
I updated your command to output some more data to use as an example, and my curl output is slightly different from yours also.
curl -s -i https://example.com/meta/availability | grep -E 'HTTP|Availability Check|accept'my example curl output
Updated Config
example output w/ new config
Adjust below for your needs/format