Skip to main content

Azure Kubernetes Service

Overview​

Azure Kubernetes Service (AKS) simplifies deploying a managed Kubernetes cluster in Azure by offloading the operational overhead to Azure. As a hosted Kubernetes service, Azure handles critical tasks, like health monitoring and maintenance.

The Centreon Plugin Azure Kubernetes Service can rely on Azure API or Azure CLI to collect the metrics related to the AKS service.

Pack Assets​

Templates​

The Centreon Plugin Pack Azure Kubernetes Service brings a host template:

  • Cloud-Azure-Compute-Aks-custom

It brings the following Service Templates:

Service AliasService TemplateDefault
Allocatable-resourcesCloud-Azure-Compute-Aks-Allocatable-Resources-ApiX
Cpu-UsageCloud-Azure-Compute-Aks-Cpu-Usage-ApiX
HealthCloud-Azure-Compute-Aks-Health-ApiX
StorageCloud-Azure-Compute-Aks-Storage-ApiX
TrafficCloud-Azure-Compute-Aks-Traffic-ApiX
Unneeded-nodesCloud-Azure-Compute-Aks-Unneeded-Nodes-ApiX

Discovery rules​

The Centreon Plugin-Pack Azure Kubernetes Service includes a Host Discovery provider to automatically discover the Azure Kubernetes Service Clusters of a given subscription and add them to the Centreon configuration. This provider is named Microsoft Azure Kubernetes Service:

image

This discovery feature is only compatible with the 'api' custom mode. 'azcli' is not supported.

More information about the Host Discovery module is available in the Centreon documentation: Host Discovery

Collected metrics & status​

Metric NameUnit
instance#aks.node.allocatable.cpu.coresCount
instance#aks.node.allocatable.memory.bytesB

Prerequisites​

To get data from Azure Services, the following methods are available:

  • Azure API ('api')
  • Azure CLI ('azcli')

Centreon recommends to use the API instead of the CLI for the following reasons:

  • the API is much more efficient because it avoids CLI binary execution.
  • the API supports application authentication and does not require a dedicated service account.

To use the 'api' custom mode, make sure to obtain the required information using the how-to below. Keep it safe until including it in a Host or Host Template definition.

  • Create an application in Azure Active Directory:

    • Log in to your Azure account.
    • Select Azure Active directory in the left sidebar.
    • Click on App registrations.
    • Click on + Add.
    • Enter Centreon as the application name (or any name of your choice), select application type (api) and sign-on-url.
    • Click on the Create button.
  • Get Subscription ID

    • Log in to your Azure account.
    • Select Subscriptions in the left sidebar.
    • Select whichever subscription is needed.
    • Click on Overview.
    • Copy the Subscription ID.
  • Get Tenant ID

    • Log in to your Azure account.
    • Select Azure Active directory in the left sidebar.
    • Click on Properties.
    • Copy the directory ID.
  • Get Client ID

    • Log in to your Azure account.
    • Select Azure Active directory in the left sidebar.
    • Click on Enterprise applications.
    • Click on All applications.
    • Select the application previously created.
    • Click on Properties.
    • Copy the Application ID.
  • Get Client secret

    • Log in to your Azure account.
    • Select Azure Active directory in the left sidebar.
    • Click on App registrations.
    • Select the application previously created.
    • Click on All settings.
    • Click on Keys.
    • Enter the key description and select the duration.
    • Click on Save.
    • Copy and store the key value. You won't be able to retrieve it after you leave this page.

Please make sure to assign the Monitoring Reader role to the application.

Setup​

  1. Install the Centreon Plugin package on every Centreon poller expected to monitor Azure Kubernetes Service resources:
yum install centreon-plugin-Cloud-Azure-Compute-Aks-Api
  1. On the Centreon Web interface, install the Azure Kubernetes Service Centreon Plugin Pack on the Configuration > Plugin Packs page.

Configuration​

Host​

  • Log into Centreon and add a new Host through Configuration > Hosts.
  • In the IP Address/FQDN field, set the following IP address: '127.0.0.1'.
  • Select the Cloud-Azure-Compute-Aks-custom template to apply to the Host.
  • Once the template is applied, some mandatory Macros as shown below have to be set according to the custom mode used.

Two methods can be used to set the Macros:

  • full ID of the Resource (/subscriptions/<subscription_id>/resourceGroups/<resourcegroup_id>/providers/Microsoft.ContainerService/ManagedClusters/<resource_name>) in AZURERESOURCE
  • Resource Name in AZURERESOURCE associated with Resource Group (in AZURERESOURCEGROUP).
MandatoryNameDescription
XAZURECUSTOMMODECustom mode 'api'
XAZURESUBSCRIPTIONSubscription ID
XAZURETENANTTenant ID
XAZURECLIENTIDClient ID
XAZURECLIENTSECRETClient secret
XAZURERESOURCEID or AKS cluster name
AZURERESOURCEGROUPAssociated Resource Group if resource name is used
MandatoryNameDescription
XAZURECUSTOMMODECustom mode 'azcli'
XAZURESUBSCRIPTIONSubscription ID
XAZURERESOURCEID or AKS cluster name
AZURERESOURCEGROUPAssociated Resource Group if resource name is used

How to check in the CLI that the configuration is OK and what are the main options for?​

Once the plugin is installed, log into your Centreon Poller CLI using the centreon-engine user account and test the Plugin by running the following command:

/usr/lib/centreon/plugins//centreon_azure_compute_aks_api.pl \
--plugin=cloud::azure::compute::aks::plugin \
--mode=storage \
--custommode='api' \
--resource='' \
--resource-group='' \
--subscription='' \
--tenant='' \
--client-id='' \
--client-secret='' \
--proxyurl='' \
--filter-metric='' \
--timeframe='900' \
--interval='PT5M' \
--warning-storage-used='' \
--critical-storage-used='' \
--warning-storage-percent='90' \
--critical-storage-percent='95' \
--use-new-perfdata

The expected command output is shown below:

OK:Instance 'CLUSTER90' Statistic 'average' Metrics Storage Percent: 38.54%, Storage Used: 11.17GB | 'CLUSTER90~average#aks.node.disk.usage.percentage'=38.54%;0:90;0:95;0; 'CLUSTER90~average#aks.node.disk.usage.bytes'=11989825262.93B;;;0;

This command would trigger a WARNING alarm if the storage usage is reported as over 90% (--warning-storage-percent='90') and a CRITICAL alarm over 95% (--critical-storage-percent='95').

All available options for a given mode can be displayed by adding the --help parameter to the command:

/usr/lib/centreon/plugins//centreon_azure_compute_aks_api.pl \
--plugin=cloud::azure::compute::aks::plugin \
--mode=storage \
--help

All available options for a given mode can be displayed by adding the--list-mode parameter to the command:

/usr/lib/centreon/plugins//centreon_azure_compute_aks_api.pl \
--plugin=cloud::azure::compute::aks::plugin \
--list-mode

Troubleshooting​

Please find all the troubleshooting documentation for the API-based Plugins in the dedicated chapter of the Centreon documentation.