Question

Bug - Centreon plugins - Microsoft Office 365 - App-Credentials

  • 14 February 2024
  • 2 replies
  • 29 views

Badge +1

Hi, 

I monitor the expiration of keys and secrets for my applications in Azure. 

I have encoutered an issue with the return of warning/critical thresholds for keys and passwords.

For instance : 

/usr/lib/centreon/plugins//centreon_plugins.pl --plugin=cloud::microsoft::office365::management::plugin --mode=app-credentials --tenant=$MY_TENANT_ID --client-id=$CENTREON_API_CLIENT_ID --client-secret=$CENTREON_API_CLIENT_SECRET --filter-app-name='3CX Serveur'  --unit='d' --warning-key-expires='''
OK: application '3CX Serveur' key credential 'XXX' status: valid, expires in 2y 7M 3w 1d 18h 53m 10s | '3CX Serveur~XXX#application.key.expires.days'=966d;;;0;

=> the key expires in 966 days. 

Now I want to receive an alert when key expires in 900 days

/usr/lib/centreon/plugins//centreon_plugins.pl --plugin=cloud::microsoft::office365::management::plugin --mode=app-credentials --tenant=$MY_TENANT_ID --client-id=$CENTREON_API_CLIENT_ID --client-secret=$CENTREON_API_CLIENT_SECRET --filter-app-name='3CX Serveur'  --unit='d' --warning-key-expires=''900” 

WARNING: application '3CX Serveur' key credential 'XXX' expires in 2y 7M 3w 1d 18h 48m 39s | '3CX Serveur~XXX#application.key.expires.days'=966d;0:900;;0;

I suspect there might be an issue in the source code, as the return is supposed to be OK.

Any help will be appreciated, ty !

 

 


2 replies

Userlevel 4
Badge +13

Hello @long 

 

From your first command (OK)

#application.key.expires.days'=966d;;;0;

 

There are no thresholds, then for the second one we have a “ --warning-key-expires=''900” “ which translates to “0:900”

#application.key.expires.days'=966d;0:900;;0;

 

The “0:900” means less than 0 or greater than 900 which is the case for your warning. since you are at 966. Maybe you are looking for:

 

“900:” note the “:” colon

 

which results in less than 900. Let me know your results.

 

😁

Badge +1

/usr/lib/centreon/plugins//centreon_plugins.pl --plugin=cloud::microsoft::office365::management::plugin --mode=app-credentials --tenant=$SITES_TENANT_ID --client-id=$CENTREON_API_CLIENT_ID --client-secret=$CENTREON_API_CLIENT_SECRET --filter-app-name='3CX Serveur' --unit='d' --warning-key-expires='900:'
OK: application '3CX Serveur' key credential 'XXX' status: valid, expires in 2y 7M 3w 1d 1h 21m 20s | '3CX Serveur~XXX#application.key.expires.days'=965d;900:;;0;

My bad.. Thank you a lot ! 

Reply