Command in yml file has unsupported data type in flex integration

I have the below shell script and i’m planning to execute it using NR Flex integration. Changed the echo statements in if loop because NRQL will accept integers to create alert condition. So the script executes and it checks if the file is available , if file is available it print 0 value and if file is not available it print 1.

#!/bin/bash
hour=`date +\%H`
if [ $hour -gt 3 ]; the
timestamp=`date +\%Y\%m\%d --date="yesterday"`
else
timestamp=`date +\%Y\%m\%d --date="2 days ago"`
fi
directory_path=/backup/test/data/daily
file=$directory_path/$timestamp.tar.gz
#echo "file = $file"
if [ -f $file ]
then
#echo "OK - $file exists"
echo "0"
else
#echo "CRITICAL -$file doesnot exist"
echo "1"
fi

Script execution:

sh /tmp/test-backup-daily-check.sh
0

I have written a flex file for it

integrations:
  - name: nri-flex
    config:
      name: linuxopenFD
      apis:
        - name: GitBackup
          commands:
            - run: "sh /tmp/test-backup-daily-check.sh"

When I try to complie the flex file in command I’m getting “processor-data: unsupported data type float64 name=linuxopenFD” in the log.

I’m testing the configurations by invoking Flex from the command line; using this command and adding the response here

**/var/db/newrelic-infra/newrelic-integrations/bin/nri-flex --verbose --pretty --config_file ./backup-check.yml**
INFO[0000] com.newrelic.nri-flex                         GOARCH=amd64 GOOS=linux version=1.3.2
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=linuxopenFD
DEBU[0000] config: processing apis                       apis=1 name=linuxopenFD
DEBU[0000] fetch: collect data                           name=linuxopenFD
DEBU[0000] commands: executing                           count=1 name=linuxopenFD
DEBU[0000] processor-data: running data handler          name=linuxopenFD
*DEBU[0000] processor-data: unsupported data type float64  name=linuxopenFD*
DEBU[0000] config: finished variable processing apis     apis=1 name=linuxopenFD
INFO[0000] flex: completed processing configs            configs=1
{
        "name": "com.newrelic.nri-flex",
        "protocol_version": "3",
        "integration_version": "1.3.2",
        "data": [
                {
                        "metrics": [
                                {
                                        "event_type": "flexStatusSample",
                                        "flex.Hostname": "HOST",
                                        "flex.IntegrationVersion": "1.3.2",
                                        "flex.counter.ConfigsProcessed": 1,
                                        "flex.counter.EventCount": 0,
                                        "flex.counter.EventDropCount": 0,
                                      
                                        "flex.time.elaspedMs": 95,
                                        "flex.time.endMs": 1596039156748,
                                        "flex.time.startMs": 1596039156653
                                }
                        ],
                        "inventory": {},
                        "events": []
                }
        ]
}

Let me know if you need more information.

Hi @srikanth.sharikar,

We recently uncovered a defect with the Flex integration that causes it to fail to parse raw results like 0; while our product engineers are working on a patch, you should be able to workaround the issue be changing your output so that it looks something like this:

metric_name=0

The integration needs a key to map the value of your script. You will also need to add a split_by: '=' option to your Flex configuration.