New Grafana World Map Plugin for OpenNMS

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

New Grafana World Map Plugin for OpenNMS

Craig Gallen (opennms)
Hi,

The stock grafana worldmap-panel allows data points to be displayed as
circles of different sizes and colours on a world map. Unfortunately the
original panel needs the data coordinates to be supplied as a geohash
string which the OpenNMS data source cannot provide.

Without modifying the OpenNMS data source, I have forked the Grafana
world map plugin and added the ability for it to work with latitude and
longitude values from the OpenNMS Data source.

Applications for this feature are for instance showing wifi access point
power levels in a map of the wifi points or plotting pollution
measurements collected from geographically dispersed IoT sensors.

This version of the worldmap-panel requires each data value which is to
be rendered as a circle to also have latitude and longitude values in
the time series.  This can be easily achieved by adding a simple XML
data collection service into the OpenNMS configuration which reads the
latitude and longitude for a node from the asset table.

See
https://github.com/gallenc/worldmap-panel

See also documentation at
https://github.com/gallenc/worldmap-panel/blob/master/OpenNMS_Datasource.md

Please give it a try. Feedback welcome.

Craig


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: New Grafana World Map Plugin for OpenNMS

Markus von Rüden
Hey Craig,

why not simply expose the geohash via the opennms rest api.
This would allow you to use the build in plugins.

The change should be applied to the OnmsGeolocation object:

I’d use this 3rd party API to generate the geohash: 
http://davidmoten.github.io/geo/apidocs/index.html -> Geocode.encodeHash(double, double)

The change is probably something like this:

@XmlTransient
@Transient
public String asGeoHash() {
    if (m_longitude != null && m_latitude != null) {
        return Geocode.encodeHash(m_latitude, m_longitude);
    }
    return null;
}

Kind regards
- Markus

On 19. Jun 2017, at 15:29, Craig Gallen (opennms) <[hidden email]> wrote:

Hi,

The stock grafana worldmap-panel allows data points to be displayed as
circles of different sizes and colours on a world map. Unfortunately the
original panel needs the data coordinates to be supplied as a geohash
string which the OpenNMS data source cannot provide.

Without modifying the OpenNMS data source, I have forked the Grafana
world map plugin and added the ability for it to work with latitude and
longitude values from the OpenNMS Data source.

Applications for this feature are for instance showing wifi access point
power levels in a map of the wifi points or plotting pollution
measurements collected from geographically dispersed IoT sensors.

This version of the worldmap-panel requires each data value which is to
be rendered as a circle to also have latitude and longitude values in
the time series.  This can be easily achieved by adding a simple XML
data collection service into the OpenNMS configuration which reads the
latitude and longitude for a node from the asset table.

See
https://github.com/gallenc/worldmap-panel

See also documentation at
https://github.com/gallenc/worldmap-panel/blob/master/OpenNMS_Datasource.md

Please give it a try. Feedback welcome.

Craig

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: New Grafana World Map Plugin for OpenNMS

Markus von Rüden
Of course, the @XmlTransient should not be there - sorry (-:


On 20. Jun 2017, at 16:09, Markus von Rüden <[hidden email]> wrote:

Hey Craig,

why not simply expose the geohash via the opennms rest api.
This would allow you to use the build in plugins.

The change should be applied to the OnmsGeolocation object:

I’d use this 3rd party API to generate the geohash: 
http://davidmoten.github.io/geo/apidocs/index.html -> Geocode.encodeHash(double, double)

The change is probably something like this:

@XmlTransient
@Transient
public String asGeoHash() {
    if (m_longitude != null && m_latitude != null) {
        return Geocode.encodeHash(m_latitude, m_longitude);
    }
    return null;
}

Kind regards
- Markus

On 19. Jun 2017, at 15:29, Craig Gallen (opennms) <[hidden email]> wrote:

Hi,

The stock grafana worldmap-panel allows data points to be displayed as
circles of different sizes and colours on a world map. Unfortunately the
original panel needs the data coordinates to be supplied as a geohash
string which the OpenNMS data source cannot provide.

Without modifying the OpenNMS data source, I have forked the Grafana
world map plugin and added the ability for it to work with latitude and
longitude values from the OpenNMS Data source.

Applications for this feature are for instance showing wifi access point
power levels in a map of the wifi points or plotting pollution
measurements collected from geographically dispersed IoT sensors.

This version of the worldmap-panel requires each data value which is to
be rendered as a circle to also have latitude and longitude values in
the time series.  This can be easily achieved by adding a simple XML
data collection service into the OpenNMS configuration which reads the
latitude and longitude for a node from the asset table.

See
https://github.com/gallenc/worldmap-panel

See also documentation at
https://github.com/gallenc/worldmap-panel/blob/master/OpenNMS_Datasource.md

Please give it a try. Feedback welcome.

Craig

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: New Grafana World Map Plugin for OpenNMS

Craig Gallen (opennms)
In reply to this post by Markus von Rüden
Yes

I looked at generating a geohash but it isn't just the asset table, its
is also collected latitude and longitude values which need converted and
this would need to be done in the measurements api.

I wanted to provide a simple initial solution which would make as few
changes as possible. The grafana world map and track map plug-ins expect
a sequence of values each with a geohash. I enhanced them to support a
sequence of values with latitude and longitude numbers as an alternative
to geohashes so that the existing grafana opennms data source could be
used without changes. This solution will work with existing OpenNMS
implementations.

An alternative would be to enhance the OpenNMS data source but this
would also require changes to the measurements api which the Grafana
OpenNMS data source uses. I looked initially at calculating a geohash in
a jexl expression - using the library you referenced. However although
jexl can deal with any object, the current measurements api can only
return sequences of numbers and not strings and the asset table cannot
be referenced easily from the measurement api code to import asset table
values into jexl calculations.

In short this seems to be  the simplest solution to get something usable
out there. Other people have been asking for latitude and longitude
instead of just geohash data in the Grafana plugins so it is a
generically useful feature. With feedback, we may want to revisit the
opennms data source but that would be quite a lot of work.

Cheers




On 20-06-17 3:09 PM, Markus von Rüden wrote:

> Hey Craig,
>
> why not simply expose the geohash via the opennms rest api.
> This would allow you to use the build in plugins.
>
> The change should be applied to the OnmsGeolocation object:
> https://github.com/OpenNMS/opennms/blob/9753e6af616828c62fefae0cbc5c3dc58c09b02f/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsGeolocation.java <https://github.com/OpenNMS/opennms/blob/9753e6af616828c62fefae0cbc5c3dc58c09b02f/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsGeolocation.java>
>
> I’d use this 3rd party API to generate the geohash:
> https://github.com/davidmoten/geo <https://github.com/davidmoten/geo>
> http://davidmoten.github.io/geo/apidocs/index.html <http://davidmoten.github.io/geo/apidocs/index.html> -> Geocode.encodeHash(double, double)
>
> The change is probably something like this:
>
> @XmlTransient
> @Transient
> public String asGeoHash() {
>     if (m_longitude != null && m_latitude != null) {
>         return Geocode.encodeHash(m_latitude, m_longitude);
>     }
>     return null;
> }
>
> Kind regards
> - Markus
>
>> On 19. Jun 2017, at 15:29, Craig Gallen (opennms) <[hidden email]> wrote:
>>
>> Hi,
>>
>> The stock grafana worldmap-panel allows data points to be displayed as
>> circles of different sizes and colours on a world map. Unfortunately the
>> original panel needs the data coordinates to be supplied as a geohash
>> string which the OpenNMS data source cannot provide.
>>
>> Without modifying the OpenNMS data source, I have forked the Grafana
>> world map plugin and added the ability for it to work with latitude and
>> longitude values from the OpenNMS Data source.
>>
>> Applications for this feature are for instance showing wifi access point
>> power levels in a map of the wifi points or plotting pollution
>> measurements collected from geographically dispersed IoT sensors.
>>
>> This version of the worldmap-panel requires each data value which is to
>> be rendered as a circle to also have latitude and longitude values in
>> the time series.  This can be easily achieved by adding a simple XML
>> data collection service into the OpenNMS configuration which reads the
>> latitude and longitude for a node from the asset table.
>>
>> See
>> https://github.com/gallenc/worldmap-panel
>>
>> See also documentation at
>> https://github.com/gallenc/worldmap-panel/blob/master/OpenNMS_Datasource.md
>>
>> Please give it a try. Feedback welcome.
>>
>> Craig
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
>> Please read the OpenNMS Mailing List FAQ:
>> http://www.opennms.org/index.php/Mailing_List_FAQ
>>
>> opennms-devel mailing list
>>
>> To *unsubscribe* or change your subscription options, see the bottom of this page:
>> https://lists.sourceforge.net/lists/listinfo/opennms-devel
>
>
>
> Hey Craig,
>
> why not simply expose the geohash via the opennms rest api.
> This would allow you to use the build in plugins.
>
> The change should be applied to the OnmsGeolocation object:
> https://github.com/OpenNMS/opennms/blob/9753e6af616828c62fefae0cbc5c3dc58c09b02f/opennms-model/src/main/java/org/opennms/netmgt/model/OnmsGeolocation.java
>
> I’d use this 3rd party API to generate the geohash:
> https://github.com/davidmoten/geo
> http://davidmoten.github.io/geo/apidocs/index.html ->
> Geocode.encodeHash(double, double)
>
> The change is probably something like this:
>
> @XmlTransient
> @Transient
> public String asGeoHash() {
>     if (m_longitude != null && m_latitude != null) {
>         return Geocode.encodeHash(m_latitude, m_longitude);
>     }
>     return null;
> }
>
> Kind regards
> - Markus
>
>> On 19. Jun 2017, at 15:29, Craig Gallen (opennms) <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> Hi,
>>
>> The stock grafana worldmap-panel allows data points to be displayed as
>> circles of different sizes and colours on a world map. Unfortunately the
>> original panel needs the data coordinates to be supplied as a geohash
>> string which the OpenNMS data source cannot provide.
>>
>> Without modifying the OpenNMS data source, I have forked the Grafana
>> world map plugin and added the ability for it to work with latitude and
>> longitude values from the OpenNMS Data source.
>>
>> Applications for this feature are for instance showing wifi access point
>> power levels in a map of the wifi points or plotting pollution
>> measurements collected from geographically dispersed IoT sensors.
>>
>> This version of the worldmap-panel requires each data value which is to
>> be rendered as a circle to also have latitude and longitude values in
>> the time series.  This can be easily achieved by adding a simple XML
>> data collection service into the OpenNMS configuration which reads the
>> latitude and longitude for a node from the asset table.
>>
>> See
>> https://github.com/gallenc/worldmap-panel
>>
>> See also documentation at
>> https://github.com/gallenc/worldmap-panel/blob/master/OpenNMS_Datasource.md
>>
>> Please give it a try. Feedback welcome.
>>
>> Craig
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org!
>> http://sdm.link/slashdot_______________________________________________
>> Please read the OpenNMS Mailing List FAQ:
>> http://www.opennms.org/index.php/Mailing_List_FAQ
>>
>> opennms-devel mailing list
>>
>> To *unsubscribe* or change your subscription options, see the bottom
>> of this page:
>> https://lists.sourceforge.net/lists/listinfo/opennms-devel
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Please read the OpenNMS Mailing List FAQ:
> http://www.opennms.org/index.php/Mailing_List_FAQ
>
> opennms-devel mailing list
>
> To *unsubscribe* or change your subscription options, see the bottom of this page:
> https://lists.sourceforge.net/lists/listinfo/opennms-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel
Reply | Threaded
Open this post in threaded view
|

Re: New Grafana World Map Plugin for OpenNMS

David Hustace

> On Jun 20, 2017, at 10:54 AM, Craig Gallen (opennms) <[hidden email]> wrote:
>
> I looked at generating a geohash but it isn't just the asset table, its
> is also collected latitude and longitude values which need converted and
> this would need to be done in the measurements api.

If it can be collected, I would use the SNMP Asset Provisioning Adapter to store the coordinates, there.

If you need geoLocation for each resource being measured, we need a richer resource model but until that is done I'm sure we could store in the strings.properties until then we could offer that also from the server side.

Just a thought.  I really don't have a dog in this fight.  It would be interesting that if once the client side has the geoHash, that it could push it back to the server so that it could be used everywhere and not have to be recomputed every hit.

:David



David Hustace
The OpenNMS Group, Inc.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

signature.asc (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: New Grafana World Map Plugin for OpenNMS

David Hustace
In reply to this post by Craig Gallen (opennms)

> On Jun 20, 2017, at 10:54 AM, Craig Gallen (opennms) <[hidden email]> wrote:
>
> This solution will work with existing OpenNMS implementations.

That's nice.  It seems another good use case for RangerRick's JS library that has service side version awareness.

:David



David Hustace
The OpenNMS Group, Inc.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

signature.asc (210 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: New Grafana World Map Plugin for OpenNMS

David Hustace
In reply to this post by Craig Gallen (opennms)

> On Jun 20, 2017, at 10:54 AM, Craig Gallen (opennms) <[hidden email]> wrote:
>
>  With feedback, we may want to revisit the opennms data source but that would be quite a lot of work.

I think you have a good point.  We should start with simple and then shoot for best architecture, later.  I think the JS library would be very helpful in this case and would allow for the version awareness that we want from the client side.

:D


David Hustace
The OpenNMS Group, Inc.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

signature.asc (210 bytes) Download Attachment