Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
float
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ai3
float
Commits
8b9c6cf1
Commit
8b9c6cf1
authored
6 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Embed hosts in service assignment Prometheus map
Use the 'target_host' label for host-level service assignments.
parent
428f099e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
roles/base/templates/vhostmap.prom.j2
+3
-1
3 additions, 1 deletion
roles/base/templates/vhostmap.prom.j2
roles/prometheus/files/rules/rules_services.conf.yml
+7
-2
7 additions, 2 deletions
roles/prometheus/files/rules/rules_services.conf.yml
with
10 additions
and
3 deletions
roles/base/templates/vhostmap.prom.j2
+
3
−
1
View file @
8b9c6cf1
...
...
@@ -21,6 +21,8 @@ Map tying together float services (float_service=) and systemd services
#}
{% for service_name, service in services.items() %}
{% for systemd_service in service.get('systemd_services', []) %}
svcmap{float_service="{{ service_name }}",service="{{ systemd_service }}"} 1
{% for h in groups[service_name] %}
svcmap{float_service="{{ service_name }}",service="{{ systemd_service }}",target_host="{{ h }}"} 1
{% endfor %}
{% endfor %}
{% endfor %}
This diff is collapsed.
Click to expand it.
roles/prometheus/files/rules/rules_services.conf.yml
+
7
−
2
View file @
8b9c6cf1
...
...
@@ -13,14 +13,19 @@ groups:
-
record
:
node_systemd_unit_ok
expr
:
sum(node_systemd_unit_state{state="active"}) by (host,name)
# The global svcmap is identical on all hosts, pick one.
# Rewrite the 'target_host' label to just 'host'.
-
record
:
global:svcmap
expr
:
label_replace(max(svcmap) without (host,instance),"host","$1","target_host","(.*)")
# By joining the node_systemd_unit_state with svcmap we can find
# float_services that have at least one failing systemd unit.
# The result metric has both float_service and service labels.
-
record
:
service:presence_by_host
expr
:
label_replace(node_systemd_unit_presence,"service","$1","name","(.*)") * on (service,host) group_right svcmap
expr
:
label_replace(node_systemd_unit_presence,"service","$1","name","(.*)") * on (service,host) group_right
global:
svcmap
-
record
:
service:ok_by_host
expr
:
label_replace(node_systemd_unit_ok,"service","$1","name","(.*)") * on(service,host) group_right svcmap
expr
:
label_replace(node_systemd_unit_ok,"service","$1","name","(.*)") * on(service,host) group_right
global:
svcmap
# Now we can group the above at the float_service level, and find
# hosts that have at least one service failing in the group.
...
...
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