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
ffba9a96
Commit
ffba9a96
authored
1 year ago
by
Josef Němec
Browse files
Options
Downloads
Patches
Plain Diff
Update cephpingmon.sh
parent
8a4bb97b
No related branches found
No related tags found
1 merge request
!12
Finalize cephpingmon
Pipeline
#416532
passed
1 year ago
Stage: build-image
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metric-generators/cephpingmon.sh
+20
-11
20 additions, 11 deletions
src/metric-generators/cephpingmon.sh
with
20 additions
and
11 deletions
src/metric-generators/cephpingmon.sh
+
20
−
11
View file @
ffba9a96
...
@@ -8,16 +8,26 @@ if [[ -z "${MTU_SIZE}" ]]; then
...
@@ -8,16 +8,26 @@ if [[ -z "${MTU_SIZE}" ]]; then
MTU_SIZE
=
8972
MTU_SIZE
=
8972
fi
fi
function
publish_metrics
{
function
publish_metrics
_nofrag
{
local
i
p
local
p
ing_result
local
loss_percent
local
loss_percent
local
success_ratio
local
success_ratio
local
fragmentation
=
"no"
if
[[
$2
==
"fragmentation"
]]
;
then
for
ip
in
$CEPH_IPS
;
do
local
fragmentation
=
"yes"
ping_result
=
$(
ping
-q
-c4
-W
1
-s
$MTU_SIZE
-M
do
$ip
)
else
loss_percent
=
$(
echo
${
ping_result
}
|
sed
-n
-e
's/^.*, \(.*\)% packet.*/\1/p'
)
local
fragmentation
=
"no"
success_ratio
=
$(
echo
"scale=2 ; 1 -
${
loss_percent
}
/ 100"
| bc
)
fi
LC_NUMERIC
=
C
printf
'%s{ip="%s", fragmentation="%s"} %.2f\n'
\
"
${
METRIC_NAME
}
"
$ip
$fragmentation
"
${
success_ratio
}
"
done
}
function
publish_metrics_frag
{
local
ip
local
loss_percent
local
success_ratio
local
fragmentation
=
"yes"
while
IFS
=
read
-r
line
;
do
while
IFS
=
read
-r
line
;
do
ip
=
$(
echo
$line
|
cut
-d
' '
-f1
)
ip
=
$(
echo
$line
|
cut
-d
' '
-f1
)
...
@@ -29,7 +39,6 @@ function publish_metrics {
...
@@ -29,7 +39,6 @@ function publish_metrics {
}
}
printf
'# HELP %s: Ceph endpoint ping success ratio. (1 ~ no loss, 0 ~ complete loss)\n'
$METRIC_NAME
printf
'# HELP %s: Ceph endpoint ping success ratio. (1 ~ no loss, 0 ~ complete loss)\n'
$METRIC_NAME
ping_result
=
$(
fping
-q
-c4
--size
$MTU_SIZE
$CEPH_IPS
2>&1
)
ping_result
=
$(
fping
-q
-c4
-b
$MTU_SIZE
$CEPH_IPS
2>&1
)
publish_metrics
"
${
ping_result
}
"
fragmentation
publish_metrics_frag
"
${
ping_result
}
"
ping_result
=
$(
fping
-q
-c4
--size
$MTU_SIZE
--dontfrag
$CEPH_IPS
2>&1
)
publish_metrics_nofrag
publish_metrics
"
${
ping_result
}
"
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