Office365-Generic: Monitor your Office 365 subscription via APIs

Prerequisites

implement the prerequisites described in the documentation: Azure and Office365 monitoring pre-requisites

What can you monitor?

The Office 365 web portal provides reports on the use of the various services available.

These reports are visible in the Office 365 Administration Center in the “Reports” > “Usage” tab

 

Here are the services that provide reports on their use.

    • Exchange
    • Microsoft Team
    • Office 365
    • OneDrive
    • SharePoint
    • Skype Entreprise
    • Yammer

Full API documentation: https://docs.microsoft.com/en-us/graph/api/resources/report?view=graph-rest-1.0.

How to obtain the metrics ?


We have identified two types of data.

Overall utilisation data for a service

In general, these are  metrics visible in graphs.

OneDrive example:
Number of files by type of activity.

 

Exchange example:
Number of shares by type.

 

These two examples can be found in the Microsoft Graph API documentation:

The response of the API contains the same information as on the graphs in the web interface:

For OneDrive, we find the fields: Display or Modification, Synchronized, Shared internally, Shared externally.

Data usage of a service per user

These are the metrics in the tables below the charts.
They provide service usage information for each user.

OneDrive example:
Number of files by activity type for each user.

 

There is one line per user.

At the API level, on the Microsoft site for this example: https://docs.microsoft.com/en-us/graph/api/reportroot-getonedriveactivityuserdetail?view=graph-rest-1.0&tabs=cs

The response from the API contains the field “User Principal Name”, sign that there will be one line per user.

We find the fields present in the table visible on the web interface.

Which plugin to use ?

Available since version 4.1, ServiceNav offers the Office365-Generic service template for collecting overall usage data for a service.

The monitoring of usage data of a service per user will be possible using a service template that will be available in a future version.

How to use the Office365-Generic template

As mentioned above, the Office365-Generic service model allows you to monitor only the global usage data of a service.
How to determine if a metric is available via this plugin or not?

To do so, two means available:

  1. If the information is visible from the web portal on a chart, then it can be collected by the Office365-Generic plugin.

Example for Office365 license activations:

 

2. Go to the API Microsoft Graph documentation. Select the service and metric you wish to monitor.

For example, the number of Office365 license activations:

If in the answer there is no “User Principal Name” field then supervision is possible with the Office365-Generic service model.

Once assured that the metric is compatible with the plugin, we can move to the setting of the checkpoint.

Checkpoint parameters

The checkpoint is intended as generic as possible to retrieve the maximum amount of information. It will therefore be necessary to set it as needed.

In the following example, we will monitor the global storage used in the OneDrive service.

Here are the parameters of the checkpoint:

 

  • Parameter “API request”: request that the plugin will use to collect the metric. This request fragment is present in title on the documentation of each Office 365 metric:

  • Parameter “Fields to process”: field of the CSV that returns the API to take into account. Each Office 365 service has its own CSV fields visible on the documentation.
    In our example, 5 fields are available:

It is possible to fill several fields separated by the pipe symbol “|” in case the plugin has to do a calculation. The values ​​will be stored in variables $ VAR1, $ VAR2, $ VAR3, etc … according to the order defined in the parameter.

  • “Calculation”: calculation to be performed on the value (s) recovered (s). Possible to do a calculation to change the unit.
    In our example the value is in bytes, it is transformed into Terabytes thanks to the computation “$ VAR1 / 1024 ** 4”.
    Note: the operator “Power” is written: **.
    It is possible to perform calculations between different values from the different fields of the parameter “Fields to be processed”. Example: $ VAR2 * 100 / $ VAR1
  • “Performance Data”: The name of the performance data for metric charts.
  • “Text output”: Text displayed in the ServiceNav web interface. The $ RESULT variable contains the value retrieved by the plugin or the result of the calculation performed in the “Calculation” parameter.

The result in ServiceNav:

Information displayed in Dataviz dashboards:

 

UK ServiceNav Product Development Manager; my priority is to be needful of the particular requirements of all ‘English-speaking’ markets where ServiceNav is sold. I have over 20 years experience of the IT monitoring field - covering a wide variety of products and technologies.