Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
custom-metrics-generator
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-metrics-generator
Commits
f92f3a9f
Commit
f92f3a9f
authored
1 year ago
by
Josef Němec
Browse files
Options
Downloads
Plain Diff
Merge branch 'feat/cephpingmon' into 'master'
Add cephpingmon See merge request
!11
parents
bae6d5df
6d433f93
No related branches found
No related tags found
1 merge request
!11
Add cephpingmon
Pipeline
#413090
passed
1 year ago
Stage: build-image
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
src/metric-generators/cephpingmon.sh
+32
-0
32 additions, 0 deletions
src/metric-generators/cephpingmon.sh
with
36 additions
and
0 deletions
CHANGELOG.md
+
4
−
0
View file @
f92f3a9f
...
@@ -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.3.4] - 2024-03-19
### Added
-
cephpingmon added as optional module (default behavior unchanged)
## [1.3.3] - 2023-10-25
## [1.3.3] - 2023-10-25
### Fixed
### Fixed
-
Env (vars) are made accessible to cronjobs
-
Env (vars) are made accessible to cronjobs
...
...
This diff is collapsed.
Click to expand it.
src/metric-generators/cephpingmon.sh
0 → 100755
+
32
−
0
View file @
f92f3a9f
#!/bin/bash
set
-eo
pipefail
METRIC_NAME
=
"cephpingmon_endpoint_accessible"
if
[[
-z
"
${
CEPH_IPS
}
"
]]
;
then
CEPH_IPS
=
"147.251.62.133 147.251.62.134 147.251.62.135 10.16.80.1"
fi
if
[[
-z
"
${
MTU_SIZE
}
"
]]
;
then
MTU_SIZE
=
8972
fi
printf
'# HELP %s: Ceph endpoint ping success ratio. (1 ~ no loss, 0 ~ complete loss)\n'
$METRIC_NAME
# $1 == ip address, $2 == yes/no fragmentation allowed
function
publish_metric
{
if
[[
$2
==
"yes"
]]
;
then
local
ping_result
=
$(
ping
-c4
-s
$MTU_SIZE
$ip
||
echo
"0 received, 100% packet loss"
)
else
local
ping_result
=
$(
ping
-c4
-s
$MTU_SIZE
-M
do
-q
$ip
||
echo
"0 received, 100% packet loss"
)
fi
local
packet_loss_percent
=
$(
echo
${
ping_result
}
|
sed
-n
-e
's/^.*, \(.*\)% packet.*/\1/p'
)
local
ping_success_ratio
=
$(
echo
"scale=2 ; 1 -
${
packet_loss_percent
}
/ 100"
| bc
)
LC_NUMERIC
=
C
printf
'%s{ip="%s", fragmentation="%s"} %.2f\n'
\
"
${
METRIC_NAME
}
"
"
$1
"
"
$2
"
"
${
ping_success_ratio
}
"
}
for
ip
in
$CEPH_IPS
;
do
publish_metric
$ip
yes
publish_metric
$ip
no
done
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