Skip to content

Commit

Permalink
Merge pull request #22 from ipHeaders/feature/PR-21
Browse files Browse the repository at this point in the history
Feature/pr 21
  • Loading branch information
ipHeaders committed Apr 28, 2023
2 parents df5a018 + 53a26e9 commit e197497
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
[![Downloads](https://static.pepy.tech/personalized-badge/silverpeak-exporter?period=total&units=none&left_color=grey&right_color=orange&left_text=PyPI%20Downloads)](https://pepy.tech/project/silverpeak-exporter)

# silverpeak-prometheus-exporter
Silverpeak/Aruba SD-WAN Prometheus Exporter, this tool is to query the Silverpeak/Aruba SD-WAN orchestrator export the metrics to a prometheus database.
Silverpeak/Aruba SD-WAN Prometheus Exporter, this tool is to query the Silverpeak/Aruba SD-WAN orchestrator export the metrics to a prometheus database.

```diff
! For better security practices make sure the API key is read only.
```

## Requierements

Expand Down
5 changes: 4 additions & 1 deletion docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
| orchPortalStatus| Enum | current connectivity status between Orchestrator and Cloud Portal |
| cloudPortalServices| Gauge | silverpeak cloud portal service and status |
| totalTunnelCount| Gauge | get total tunnel count across all appliances |

| totalCPUs| Gauge | the total amount of CPU on the orchestrator, works only when orch is not running in container |
| loadAverage| Gauge | orchestrator load average, works only when orch is not running in container |
| totalMemSize| Gauge | total memory of the server, works only when orch is not running in container |
| maintenaceModeAppliances| Gauge | appliances currently in maintenance mode |

## Appliances System

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "silverpeak_exporter"
version = "0.1.7"
version = "0.1.8"
description = "Prometheus exporter for Silverpeak SD-WAN Appliances."
authors = ["IP Headers <ipHeaders@users.noreply.github.com>"]
license = "MIT"
Expand Down
18 changes: 17 additions & 1 deletion silverpeak_exporter/collectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ def _getOrchServerBrief(self):
release.labels(orchName=self.hostname).info({'release' : orch_return['release']}) #Setting Metric
platform.labels(orchName=self.hostname).info({'platform' : orch_return['platform']}) #Setting Metric
numActiveUsers.labels(orchName=self.hostname).set(orch_return['numActiveUsers']) #Setting Metric

if orch_return['platform'] != "DOCKER":
totalCPUs.labels(orchName=self.hostname).set(orch_return['numCpus']) #Setting Metric
loadAverage.labels(orchName=self.hostname).set(orch_return['loadAverage']) #Setting Metric
totalMemSize.labels(orchName=self.hostname).set(orch_return['memSize']) #Setting Metric

return orch_return

@errorHandler
Expand Down Expand Up @@ -173,6 +179,16 @@ def _getTotalTunnelCount(self):
totalTunnelCount.labels(orchName=self.hostname).set(orch_return['totalTunnelCount'])
return orch_return

@errorHandler
def _getAppliancesInMaintenance(self):
orch_return = self.orch.get_maintenance_mode_appliances()
supressAlarm = orch_return['suppressAlarm']
supressOrch = orch_return['pauseOrchestration']

unique = supressAlarm + list(set(supressOrch) - set(supressAlarm))
maintenaceModeAppliances.labels(orchName=self.hostname).set(len(unique))
return orch_return

#--------------------------------------------------#
# Metrics Collections for the Appliances
#--------------------------------------------------#
Expand Down Expand Up @@ -445,7 +461,7 @@ def __init__(self,url,ne_pk,applianceName,key,verify_ssl,interval,debug, Break):

@errorHandler
def _getApplianceFlows(self):
orch_return = self.orch.get_appliance_flows(self.ne_pk,uptime="term5m")
orch_return = self.orch.get_appliance_flows(self.ne_pk, uptime="term5m")

activeTotalFlows.labels(applianceName=self.applianceName).set(orch_return['active']['total_flows']) #Setting Metric
activeStaleFlows.labels(applianceName=self.applianceName).set(orch_return['active']['stale_flows']) #Setting Metric
Expand Down
5 changes: 4 additions & 1 deletion silverpeak_exporter/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
orchPortalStatus = Enum('orchPortalStatus', 'current connectivity status between Orchestrator and Cloud Portal',['orchName'], states=['unable to connect', 'connected', 'connecting'])
cloudPortalServices = Gauge('cloudPortalServices', 'silverpeak cloud portal service and status',['orchName','portalService','status'])
totalTunnelCount = Gauge('totalTunnelCount', 'get total tunnel count across all appliances',['orchName'])

totalCPUs = Gauge('totalCPUs', 'the total amount of CPU on the orchestrator, works only when orch is not running in container',['orchName'])
loadAverage = Gauge('loadAverage', 'orchestrator load average, works only when orch is not running in container',['orchName'])
totalMemSize = Gauge('totalMemSize', 'total memory of the server, works only when orch is not running in container',['orchName'])
maintenaceModeAppliances = Gauge('maintenacModeAppliances', 'appliances currently in maintenance mode',['orchName'])
#---------#---------#---------#---------#---------#
# Appliance Metrics
#---------#---------#---------#---------#---------#
Expand Down

0 comments on commit e197497

Please sign in to comment.