M365 monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

M365 monitoring

Post by hbouma »

We are trying to monitor the total number of M365 licenses to alert our team if we have too many users in M365. I have made it though the monitoring wizard, but when I run the checks, I get a 403 Forbidden error.

We are running Nagios XI 5.8.1 on RHEL 7 VM's.


Service check is :
/usr/local/nagios/libexec/check_microsoft_365.php --tenant 'SUPER_SECRET_TENANT_ID' --appid 'SECRET_APP_ID' --secret 'SECRET_VALUD' --mode 'o365activationsbyproduct' --warning ':2180' --critical ':2189' --filter ''

Attached is our permissions (User.Read has been updated to User.Read.All) and the error message.
2021-04-09 13_22_33-Window.png
Is there anything I am missing?
You do not have the required permissions to view the files attached to this post.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: M365 monitoring

Post by dchurch »

Others with similar issues say this is because the permissions are marked as "Delegated" permissions.

Change them to "Application" permissions instead.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: M365 monitoring

Post by hbouma »

Thank you, that did fix our connection issue.

However, I don't think I have the correct monitoring option selected.

We have been asked to monitor the number of M365 licenses in use and alert when we are close the the critical threshold. When I select the O365 Activations, it only grabs the office instances, not the M365 info.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: M365 monitoring

Post by dchurch »

To monitor the number of active users for each product, use this command:

Code: Select all

/usr/local/nagios/libexec/check_microsoft_365.php --tenant 'SUPER_SECRET_TENANT_ID' --appid 'SECRET_APP_ID' --secret 'SECRET_VALUD' --mode 'o365productusage' --warning ':2180' --critical ':2189' --filter ''
You may want to open up /usr/local/nagios/libexec/check_microsoft_365.php in a text editor to around line 465 to get a better idea how to monitor licenses.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: M365 monitoring

Post by hbouma »

Thank you.

However, this really doesn't seem to fit what I need it to do.

What I have been asked to do is alert if the total number of M365 Exchangelicenses exceeds 2189. The closest I found was the User Service Usage, however that splits based on active or inactive.
2021-04-13 15_34_49-Greenshot image editor.png
You do not have the required permissions to view the files attached to this post.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: M365 monitoring

Post by dchurch »

The number of licenses "in use" in this case is the number of active licenses.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: M365 monitoring

Post by hbouma »

So, this is odd. According to our Exchange team, they have had issues where we are "out" of M365 licenses, but the checks show inactive licenses available.

Is there any check currently available using the M365 Nagios integration to pull in the total number of Exchange licenses (Active and Inactive) to alert when that passes a specific level?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: M365 monitoring

Post by ssax »

Does the active count match your license count or does the active+inactive match your license count?
hbouma
Posts: 483
Joined: Tue Feb 27, 2018 9:31 am

Re: M365 monitoring

Post by hbouma »

The active + inactive matches our exchange license count.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: M365 monitoring

Post by ssax »

I'll need to talk with development about this but they've already left for the day.

Run this command from the CLI and send the full output (including the performance data that is output after the | character so I can see how the warning/critical affect the output)

Code: Select all

/usr/local/nagios/libexec/check_microsoft_365.php --tenant 'SUPER_SECRET_TENANT_ID' --appid 'SECRET_APP_ID' --secret 'SECRET_VALUD' --mode 'o365productusage' --warning ':2180' --critical ':2189' --filter ''
Locked