New to KubeStash? Please start here.

Monitoring KubeStash

KubeStash has native support for monitoring via Prometheus. You can use builtin Prometheus scraper or prometheus-operator to monitor KubeStash. This tutorial will show you how Prometheus monitoring works with KubeStash, what metrics KubeStash exports, and how to enable monitoring.

How Prometheus monitoring works

KubeStash monitoring metrics comes from Panopticon which is a generic state metric exporter for Kubernetes developed by AppsCode. It watches KubeStash CRDs and export necessary metrics.

The following diagram shows the logical structure of the KubeStash monitoring flow.

Stash Monitoring Flow
Fig: Monitoring process in KubeStash

The Panopticon tool runs as a separate workload. It watches for KubeStash CRDs and exports relevant metrics.

Available Metrics

Panopticon watches the BackupConfiguration, BackupSession, BackupStorage, Repository, RestoreSession, Snapshot CRDs and export necessary metrics. This section will list the metrics exported by KubeStash for different CRDs.

BackupConfiguration Metrics:

Metric NameUsage
core_kubestash_com_backupconfiguration_createdUnix creation timestamp of this BackupConfiguration object
core_kubestash_com_backupconfiguration_infoGeneral information about this BackupConfiguration
core_kubestash_com_backupconfiguration_sessionsList of sessions of this BackupConfiguration
core_kubestash_com_backupconfiguration_phaseBackupConfiguration object current phase
core_kubestash_com_backupconfiguration_conditionsCurrent conditions of this BackupConfiguration

BackupSession Metrics:

Metric NameUsage
core_kubestash_com_backupsession_createdUnix creation timestamp of this BackupSession object
core_kubestash_com_backupsession_infoGeneral information about this BackupSession
core_kubestash_com_backupsession_snapshotsGeneral information about the snapshots of this BackupSession
core_kubestash_com_backupsession_phaseBackupSession object current phase
core_kubestash_com_backupsession_duration_secondsTime required to complete this backup process
core_kubestash_com_backupsession_conditionsCurrent conditions of this BackupSession

BackupStorage Metrics:

Metric NameUsage
storage_kubestash_com_backupstorage_createdUnix creation timestamp of this BackupStorage object
storage_kubestash_com_backupstorage_infoGeneral information about this BackupStorage
storage_kubestash_com_backupstorage_repository_size_bytesTotal backed up data in the repository of this BackupStorage
storage_kubestash_com_backupstorage_phaseBackupStorage object current phase
storage_kubestash_com_backupstorage_size_bytesTotal backed up data size in this BackupStorage
storage_kubestash_com_backupstorage_conditionsCurrent conditions of this BackupStorage

Repository Metrics:

Metric NameUsage
storage_kubestash_com_repository_createdUnix creation timestamp of this Repository object
storage_kubestash_com_repository_infoGeneral information about this Repository
storage_kubestash_com_repository_last_successful_backupLast successful backup stored in this Repository
storage_kubestash_com_repository_size_bytesTotal backed up data stored in this Repository
storage_kubestash_com_repository_snapshot_count_totalNumber of current snapshots stored in this Repository
storage_kubestash_com_repository_conditionsCurrent conditions of this Repository

RestoreSession Metrics:

Metric NameUsage
core_kubestash_com_createdUnix creation timestamp of this RestoreSession object
core_kubestash_com_infoGeneral information about this RestoreSession
core_kubestash_com_phaseRestoreSession object current phase
core_kubestash_com_duration_secondsThe total time taken to complete the restore process
core_kubestash_com_component_count_totalThe number of total components for this RestoreSession
core_kubestash_com_conditionsCurrent conditions of this RestoreSession

Snapshot Metrics:

Metric NameUsage
storage_kubestash_com_snapshot_createdUnix creation timestamp of this Snapshot object
storage_kubestash_com_snapshot_infoGeneral information about this Snapshot
storage_kubestash_com_snapshot_phaseSnapshot object current phase
storage_kubestash_com_snapshot_size_bytesSize of this Snapshot
storage_kubestash_com_snapshot_time_secondsThe time when this Snapshot was taken
storage_kubestash_com_snapshot_component_count_totalThe number of total components for this Snapshot
storage_kubestash_com_snapshot_conditionsCurrent conditions of this Snapshot

How to Enable Monitoring

During the installation of KubeStash, all the necessary MetricsConfigurations are created. You can find these MetricsConfigurations using the following command:

$ kubectl get metricsconfigurations
NAME                                         APIVERSION                       KIND                  AGE
kubestash-appscode-com-backupconfiguration   core.kubestash.com/v1alpha1      BackupConfiguration   113m
kubestash-appscode-com-backupsession         core.kubestash.com/v1alpha1      BackupSession         113m
kubestash-appscode-com-backupstorage         storage.kubestash.com/v1alpha1   BackupStorage         113m
kubestash-appscode-com-repository            storage.kubestash.com/v1alpha1   Repository            113m
kubestash-appscode-com-restoresession        core.kubestash.com/v1alpha1      RestoreSession        113m
kubestash-appscode-com-snapshot              storage.kubestash.com/v1alpha1   Snapshot              113m

Next, you need to install Panopticon. You can monitor KubeStash by using either the built-in Prometheus scraper or prometheus-operator.