NRI Flex Integration Not Work

This is my first attempt at getting my own nri flex to work. I did copy the tutorial flex-uptime.yml and it is working, so, I know Flex is working. And, to make sure I had things indented properly, I used a copy of the same working file and just replaced the values. The ‘script’ I am running provides a single numerical value output with no head. I am modifying the real paths in the below pasting, but, just the paths and file names, to protect the innocent. This is running on Linux:

/etc/dir1/dir2/dir3/cert_exp_days.sh /etc/dir4/dir5/thisisntworking_com.pem
715

Below is my current code. I have tried with split values and without. I have tried with set_header and without. I have also tried with the single ‘header’ being in [] and not.

integrations:

  • name: nri-flex
    config:
    name: certificateMonitor
    apis:
    - name: ExpireSsl
    commands:
    - run: ‘/etc/dir1/dir2/dir3/cert_exp_days.sh /etc/dir4/dir5/thisisntworking_com.pem’
    set_header: [daysToExpiration]

Hi, @tim.davis: What happens when you run it? What behavior do you see that is different from what you expect? Have you been through the troubleshooting steps?

Other flex integrations are all working. So, flex in general is working, including the ‘new’ uptime flex I added today from the tutorial GitHub. I don’t see any troubleshooting steps that would apply. As the example shows, the scipt simply spits out a number. Nothing more. I am expecting to see an ExpireSslSample to select against with a numerical value for the data daysToExpiration. I am not seeing the sample at all.

I suspect that it is a permissions issue. On my system, I must be root in order to access my certificates. The Flex integration is probably not running your command as root.

Hi, @tim.davis: I checked with the developers, and they said that since the Infrastructure agent runs as root by default, the Flex integration should as well. You might try adding sudo before your command to see if that helps.

If not, you can run Flex in development mode, adding the -verbose and -pretty flags to see what is happening.

1 Like

Thanks. I will try this. I couldn’t figure out how to troubleshoot/get loggin.

INFO[0000] com.newrelic.nri-flex GOARCH=amd64 GOOS=linux version=1.3.1
DEBU[0000] config: git sync configuration not set
WARN[0000] config: testing agent config, agent features will not be available
DEBU[0000] config: running async name=certificateMonitor
DEBU[0000] config: processing apis apis=1 name=certificateMonitor
DEBU[0000] fetch: collect data name=certificateMonitor
DEBU[0000] commands: executing count=1 name=certificateMonitor
DEBU[0000] processor-data: running data handler name=certificateMonitor
DEBU[0000] processor-data: unsupported data type float64 name=certificateMonitor
DEBU[0000] config: finished variable processing apis apis=1 name=certificateMonitor
INFO[0000] flex: completed processing configs configs=1

Is there a way to have it view the ‘number’ returned by the script as a number format it supports?

I opened a support ticket and didn’t get an answer back there. But, our CSE had also followed a separate path and the resources he reached out to recreated our script directly into NRI Flex. This is working. So, it appears the issue comes down to the fact that, even if I am not seeing it in the display, our scripts math does not ‘round’ off to a whole number. Also, our error control would allow a potential text vs numeric return. Either way, I am going to try to fix our script, as we like the concept of common code being used by all monitoring platforms. By creating a functional script, any monitoring platform can call the same script and get the necessary monitoring. In this way, the challenge is about getting the monitoring platform to read the out put correctly vs having to code for each different monitoring platform.

1 Like

A suggestion I could make from this. For large enterprises, multiple monitoring platforms are more likely. It would be helpful to have a specific process and documentation about how to run a specific script and read it in and what the requirements are for the ‘output’ of said script. This type of logic and ‘code’ reading capability could help adoption in general.

1 Like

Thanks for these follow ups Tim!

I’ll get your suggestion sent in to the right folks internally!

Sounds like your CSE has helped you get this working, is that right? If you do need further help, let us know.

1 Like

Still didn’t get the answer for the output being a single value. However, we had our script output to json and it works fine. Not sure why that would make a difference and going to report it to our support case.

Hi @tim.davis,

I believe we’ve recently stumbled on a bug with how Flex handles raw output of a single value; the workaround we’ve heard from our product engineers has been to use a split_by option in your config, and change your output so the value is mapped to something, e.g.,

daysToExpiration=366

Where you would have split_by set to =.

Thank you. I had decided to try create the output of our scripts as very simply json, which didn’t require the split_by. The support ticket opened shortly after identified this as the problem and said they would update me when the underlying issue is corrected. For now, we will have our scripts spit out a basic json or similar. Thank you.

1 Like

Hi @tim.davis

No problem! In the meantime, keep an eye out for the next release of Flex which we hope will include a fix for this issue.