Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

How to report yes / no /boolean values via a custom plugin



I’m working on a small plugin to monitor the availability of a resource. So if the resource is available a yes / true / 1 will be posted and if the resource is not available a no / false / 0 will be posted. However I’ve not found a way to report boolean values properly and to display them in the dashboard. Can anyone advise please how that can be achieved?

I’ve tried to post them in the json as “true” / “false” but got an error 400 back. Posting them as 0 / 1 work but caused troubles in the dashboards.

Thanks a lot in advance for your help


We don’t really have boolean support in our metric structure. If you want alerting capability, you could report a larger value for the “true” resource availability condition, 0 for “false” and set alerting thresholds for the plugin. We may support true/false type metrics in the future but I’ll go ahead and submit a feature request on your behalf. Thanks for the idea.


Well - that’s what I currently do namely reporting 1 for true and 0 for false. However if there is a change in the state alerting might be difficult as this might be averaged … and if you have may 1s some 0s in between might be lost. Or - as I can see just now - there is an average of 1.09 reported although the values posted are only 1 or 0. Any suggestion how we could handle that?

Thanks a lot for pursuing this as a future enhancement.


Would you be willing to post an example of how the 1 or 0 metric is being reported in your plugin?

It would be very helpful to see a snippet of your code.


Sure thing … please find below the json snipplet I’m using to post results:

    "agent": {
      "host" : "xxxxxx032",
      "pid" : 12404,
       "version" : "0.0.1"
    "components": [
       "name": "xxxxxx032-yyyyyy URLs",
        "guid": "com.xxxxx.zzzzzz.aaaaaa-bbbbb-cccccccc01",
        "duration" : 60,
        "metrics" : {
         "Component/url/check/xxxxxx/base/HTTP-Code[Total]" : {"total" : -1, "count" : 1},
          "Component/url/check/xxxxxx/total/Response time[Second]" : {"total" : 0.1336, "count" : 1},
          "Component/url/check/xxxxxx/total/Text Errors[Total]" : {"total" : 1, "count" : 1}

In this snipplet the “Text Errors[Total]” shouls be basically a boolean value being true if a text was found or false if a text was not found. Similar with the attribute “HTTP-Code[Total]” which sound represent an HTTP return code.

Thanks for reviewing this … Hermann


Yup - unfortunately we have to get back to @QuietWyatt’s original answer here - our infrastructure is not well suited to booleans, and you’ll see bogons like this (averages that are not an integer, despite only integers being reported). A further catch on our infrastructure which is what lead to the 1.09 value - if your plugin reports a bit less than every 60 seconds, it might double-report for a period. A bit more, and there might be a “0” in there that does not correspond to a report (0 = no data, which could also happen during a network hiccup, or if your JSON data is malformed and thus not accepted).

Short answer is that for purposes of alerting, there’s no good way to alert on a boolean value within a plugin. However in our app agents, we do much better at alerting on error rate and in our availability monitor (with an externally available URL), we do great substring checking with smart alerting that can withstand temporary network hiccups and is more configurable.

Sorry to say “you can’t do that the way you’re trying to”, but at the moment, it’s the truth. We’d be happy to lodge a feature request for you (which doesn’t guarantee a fix, but which does mean that if we implement one, we’ll let you know) in case neither of the above workarounds are sufficient - just let us know.


Thanks for your reply here and I’d really appreciate if you could open a feature request here. Background is simply that we need to monitor a URL which is not available externally therefore I created a simply HTTP Client to monitor and would like to alert if a search string is not found (similar to the availability monitor). Would be great if the JSON interface and the infrastructure could be enhanced to allow some kind of boolean reporting (or simply support a new, non-statistical value type like for example “absolute value”). Thanks!


Hi @hhue13 - I will open a feature request for this. Thank you for sharing your story!


+1 for support of booleans and alerting on them.

In general, being able to publish and alert on yes/no answers would open up a large world of monitoring capability within NR. Developers would be free to write plugins that encapsulate yes/no probes of any degree of complexity/logic and then rely on NR to do the alerting.

For example, all Dropwizard apps have a built in self-diagnostic healthcheck that can be requested over http. It would be super useful to be able to publish the health of the application into NR and alert whenever the application becomes “unhealthy.” Part of the beauty of this system is that what constitutes a “healthy” or “unhealthy” application can be maintained within the application and the check provides a simple operational hook into the state of the application without needing to distribute deep understanding of the application into other systems.

The attractiveness of NR increases as the number of other systems it can replace increases. It’s a bummer that, as already discussed, checking and alerting on any sort of yes/no state from within a plugin is simply not possible right now. In the end, it means maintaining other monitoring/alerting systems in addition to NR.

I appreciate that there’s complexity in supporting a fundamentally new data type but I would love to see this constraint opened up and I think it would be a big win for your customers.


What a great, detailed request. Thank you @dbaggott! I have forwarded this on to our product managers.


+1 for boolean reporting/monitoring


I’ve logged your interest with our product managers as well @chris_dev, thanks!


+1 as well for me. I’m trying to create a plugin to report on Hyper-V health. Some of the items i want to report on is Running Status - True / False, Replication Healthy - True / False. a boolean value would make this type of task easy.


Thank you for the details, @eelkram - I have added your feature request. :slight_smile:


@eelkram, note that the work-around of representing booleans as 0’s and 1’s basically works as described for the newrelic-dropwizard-plugin. As discussed there, the limitations in NR’s alerting thresholds mean that you can really only alert on something going from false (0) to true (1) and not the other way around. So, you need to make sure you represent your data accordingly if you want to alert…

We’re using this plugin in production for a handful of applications and it’s working swimmingly…


Incredible help, @dbaggott - thank you! I’d like to also take a moment to offer you a custom title as a small thank you. If you’d like that please send me a private message with your desired title. :slight_smile:


Thanks @dbaggott!! After building a more traditional plugin to monitor Brocade traffic managers I decided to come back to the Hyper-V plugin. I had to make some changes from what I was originally imagining before I started using the plugin ecosystem. However, it does work well from an alerting standpoint.

Thanks for the feedback. Both plugins are NPI compatible and in plugin central if anyone is interested.