Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
custom-openstack-exporter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cloud
custom-openstack-exporter
Commits
ae535401
Commit
ae535401
authored
1 year ago
by
Josef Němec
Browse files
Options
Downloads
Patches
Plain Diff
Add custom_openstack_server_info and flavor_info metrics
parent
21262461
No related branches found
No related tags found
1 merge request
!14
Add custom_openstack_server_info and flavor_info metrics
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
custom-openstack-exporter.py
+46
-0
46 additions, 0 deletions
custom-openstack-exporter.py
with
50 additions
and
0 deletions
CHANGELOG.md
+
4
−
0
View file @
ae535401
...
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [Unreleased]
## [1.4.0] - 2023-08-28
### Added
-
New metrics custom_openstack_server_info and custom_openstack_flavor_info
## [1.3.0] - 2023-04-11
## [1.3.0] - 2023-04-11
### Fix
### Fix
-
Adding HTTP + HTTPS port checking
-
Adding HTTP + HTTPS port checking
...
...
This diff is collapsed.
Click to expand it.
custom-openstack-exporter.py
+
46
−
0
View file @
ae535401
...
@@ -78,6 +78,12 @@ class AppMetrics:
...
@@ -78,6 +78,12 @@ class AppMetrics:
self
.
openstack_project_info
=
Gauge
(
"
custom_openstack_project_info
"
,
self
.
openstack_project_info
=
Gauge
(
"
custom_openstack_project_info
"
,
"
Custom info for a project
"
,
"
Custom info for a project
"
,
[
"
project_id
"
,
"
project_name
"
,
"
domain_id
"
,
"
project_tag
"
])
[
"
project_id
"
,
"
project_name
"
,
"
domain_id
"
,
"
project_tag
"
])
self
.
openstack_server_info
=
Gauge
(
"
custom_openstack_server_info
"
,
"
Custom info for a server
"
,
[
"
server_id
"
,
"
server_name
"
,
"
image_id
"
,
"
flavor_name
"
])
self
.
openstack_flavor_info
=
Gauge
(
"
custom_openstack_flavor_info
"
,
"
Openstack flavor parameters
"
,
[
"
flavor_id
"
,
"
flavor_name
"
,
"
ram
"
,
"
disk
"
,
"
vcpus
"
,
"
public
"
,
"
ephemeral
"
,
"
disabled
"
])
self
.
openstack_loadbalancer_status
=
Gauge
(
"
custom_openstack_loadbalancer_accessibility_status
"
,
self
.
openstack_loadbalancer_status
=
Gauge
(
"
custom_openstack_loadbalancer_accessibility_status
"
,
"
LoadBalancer accessibility status
"
,
[
"
id
"
,
"
status
"
])
"
LoadBalancer accessibility status
"
,
[
"
id
"
,
"
status
"
])
self
.
openstack_ip_status
=
Gauge
(
"
custom_openstack_ip_accessibility_status
"
,
self
.
openstack_ip_status
=
Gauge
(
"
custom_openstack_ip_accessibility_status
"
,
...
@@ -89,6 +95,8 @@ class AppMetrics:
...
@@ -89,6 +95,8 @@ class AppMetrics:
while
True
:
while
True
:
self
.
fetch_fip_quota
()
self
.
fetch_fip_quota
()
self
.
fetch_project_info
()
self
.
fetch_project_info
()
self
.
fetch_server_info
()
self
.
fetch_flavor_info
()
self
.
fetch_ip_status
()
self
.
fetch_ip_status
()
self
.
fetch_loadbalancer_status
()
self
.
fetch_loadbalancer_status
()
time
.
sleep
(
self
.
polling_interval_seconds
)
time
.
sleep
(
self
.
polling_interval_seconds
)
...
@@ -131,6 +139,44 @@ class AppMetrics:
...
@@ -131,6 +139,44 @@ class AppMetrics:
project_tag
=
""
project_tag
=
""
).
set
(
project
[
'
is_enabled
'
])
).
set
(
project
[
'
is_enabled
'
])
def
fetch_server_info
(
self
):
"""
Get metrics from application and refresh Prometheus metrics with
new values.
"""
# remove all statuses
self
.
openstack_server_info
.
clear
()
for
server
in
self
.
os_connection
.
compute
.
servers
(
True
,
True
):
self
.
openstack_server_info
.
labels
(
server_id
=
server
[
'
id
'
],
server_name
=
server
[
'
name
'
],
image_id
=
server
[
'
image
'
][
'
id
'
],
flavor_name
=
server
[
'
flavor
'
][
'
original_name
'
]
).
set
(
1
)
def
fetch_flavor_info
(
self
):
"""
Get metrics from application and refresh Prometheus metrics with
new values.
"""
# remove all statuses
self
.
openstack_flavor_info
.
clear
()
for
flavor
in
self
.
os_connection
.
compute
.
flavors
():
self
.
openstack_flavor_info
.
labels
(
flavor_id
=
flavor
[
'
id
'
],
flavor_name
=
flavor
[
'
name
'
],
ram
=
flavor
[
'
ram
'
],
disk
=
flavor
[
'
disk
'
],
vcpus
=
flavor
[
'
vcpus
'
],
public
=
flavor
[
'
os-flavor-access:is_public
'
],
ephemeral
=
flavor
[
'
OS-FLV-EXT-DATA:ephemeral
'
],
disabled
=
flavor
[
'
OS-FLV-DISABLED:disabled
'
]
).
set
(
1
)
# support function for ip status evaluation
# support function for ip status evaluation
@staticmethod
@staticmethod
def
get_ip_accessibility_status_ping
(
ip_address
):
def
get_ip_accessibility_status_ping
(
ip_address
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment