Re: OpenNMS monitoring and data collection from the Azure REST API

David Hustace <[email protected]>
Newsgroups gmane.network.opennms.general
Message-ID <[email protected]>
John,

Would you mind spending some time with us writing up your requirements and and putting some user stories together for an Azure monitoring project?  Sounds like it would be a fun project.


David Hustace
The OpenNMS Group, Inc.


> On May 3, 2018, at 23:09, JohnD Blackburn <[email protected]> wrote:
> 
> Hi All,
> 
> We are currently using OpenNMS 21.1.0 to monitor all our Azure VM’s, and it has been brought up that there is a whole bunch of metrics and statuses that are only available through Azure.  I have been looking at options for getting some of this info into OpenNMS, and have found several potential methods for achieving this.
> 
> It is possible to set up webhooks in Azure that get called when events, statuses, and thresholds are triggered, which could possibly work, but would require me to set up an internet facing webserver to receive the webhook calls, and to then process the received JSON data to the correct node in OpenNMS.  This would also require configuration added to Azure to “send” these details.
> 
> A second option I have come across is to use the Azure REST API which is documented here: https://docs.microsoft.com/en-us/rest/api/azure/
> 
> Using this should allow me to drive the collection from the OpenNMS server, however I would need to get the mapping between OpenNMS nodes and Azure resources working.
> 
> To be able to get details out of Azure for a specific node, I would need to know the “SubscriptionID”, “ResourceGroupName” and “ResourceID” from Azure, and to complicate matters, requests to the Azure API require an access token which I can get with the following curl commandline which returns the access token in a JSON formatted file
> 
>     curl -X POST -d 'grant_type=client_credentials&client_id='$CLIENTID'&client_secret='$CLIENTSECRET'&resource=https%3A%2F%2Fmanagement.azure.com%2F' https://login.microsoftonline.com/$TENANTID/oauth2/token > $TOKEN_FILE
> 
> This Access token that is returned expires after an hour, so a new access token would need to be requested every hour.   The access token is passed into the HTTP request as a header.  The following curl command shows the format required for the http request:
> 
>    curl -X GET -H "Authorization: Bearer $TOKEN_ID" -H "Content-Type: application/json"https://management.azure.com/$URI
> 
> 
> That access token is 1335 characters long.
> 
> What is the best way to capture data from the Azure REST API?  Do I need a script that runs hourly to update the access token in the asset comment field and store all those variables in Asset Fields?  Would a 1335 character string be storable in an asset field?
> 
> Has anyone implemented any OpenNMS monitoring/data collection from the Azure REST API?
> 
> 
> 
> Also, Trying to create a collector for the JSON, given the following JSON as returned by Azure:
> {
>   "id": "/subscriptions/SubscriptionID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/virtualMachines/VMName/providers/Microsoft.ResourceHealth/availabilityStatuses/current",
>   "name": "current",
>   "type": "Microsoft.ResourceHealth/AvailabilityStatuses",
>   "location": "australiaeast",
>   "properties": {
>     "availabilityState": "Available",
>     "summary": "There aren't any known Azure platform problems affecting this virtual machine",
>     "detailedStatus": "",
>     "reasonType": "",
>     "occuredTime": "2018-04-26T09:15:52Z",
>     "reasonChronicity": "Persistent",
>     "reportedTime": "2018-05-04T02:02:47.222185Z"
>   }
> }
> 
> How would I format the XML Group definition in xml-datacollection?  It is not clear to me from the documentation.
> I’m guessing something like this:
> <xml-groups>
>     <xml-group name="azure-test" resource-type="node"
>                 resource-xpath="/"
>                 key-xpath="@id">
>       <xml-object name="name" type=”string" xpath="@name" />
>       <xml-object name="type" type="string" xpath="@type" />
>       <xml-object name="location" type="string" xpath="@location" />
>       <xml-object name="availabilityState" type="string" xpath="properties[@availabilityState]" />
>       <xml-object name="summary" type="string" xpath="properties[@summary]" />
>       <xml-object name="detailedStatus" type="string" xpath="properties[@detailedStatus]" />
>       <xml-object name="reasonType" type="string" xpath="properties[@reasonType]" />
>       <xml-object name="occuredTime" type="string" xpath="properties[@occuredTime]" />
>       <xml-object name="reasonChronicity" type="string" xpath="properties[@reasonChronicity]" />
>       <xml-object name="reportedTime" type="string" xpath="properties[@reportedTime]" />
>     </xml-group>
> </xml-groups>
> 
> 
> Regards,
> John Blackburn
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> 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-discuss mailing list
> 
> To *unsubscribe* or change your subscription options, see the bottom of this page:
> https://lists.sourceforge.net/lists/listinfo/opennms-discuss

------------------------------------------------------------------------------
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-discuss mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
signature.asc (application/pgp-signature, 873 B)
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIzBAEBCAAdFiEEM8HVsB3Payb01u1DmyrG1LpC+MIFAlrsbIQACgkQmyrG1LpC
+MK0fRAAhZJiJ4QTU+/i3Cr3nf1naUA6OuZBhSo3HbnvC+NW2vAr3NwQhuyQRVK/
G7zOJ1j3FOqFBMLcwqEnrBbj9bYz8OuAE4XBdnv0/ukT7EcCGVe2HEwwbw+o/Qjt
e4XgfuEqh0jLEWK4qnjt+7Wtk2naLPUKJTJ1C34T4Q5fgGIjrk6+m2XqmzvkIKKL
uY4KiH+d/Pew9VyYjprkrHOD/+RZC7A4l0RMGTV6Yp229ncWJVQcCu/YlWMVGU2X
fHkavlZWHjCcnXHaIg9JyyMd99Nkv6UsnqEkd5I0UqryM40QP/IxPptyyrts3sHM
lAyBgEbOAhuh+CnwqK+0jetqx9TuTEumW6fcg3n31sYZNlwB6k4Reis2Xx+iqdP0
2XdpKBs2cpJNvcXIC58wh1DerLpx8kr2ZOGYUiIc52dpE/f7WfBaj109Dnfr4184
x9LsrcoPJ96oSFDXV2yLLQ0p0S2/sjEkmO+uEVuhzYt59mmls6Y2u+HJaxflvKdD
TlRzjY6gazxWTB6ofkAvYU4i9PkJf//5pGQfsE+Fbio2BbIC8TAu2td9YROaRQoV
OKrIbzAW8fyfB+D2+Gmtcpso2BCXrBHYQfULl6pCz5neW8jRTvEGkmuh+n6nRhxH
tO1l5abpBDottAPqmAdC55FcW3YfyiHF3Bg7GzD89ogxU9NP4To=
=rO5O
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.