Skip to content
Snippets Groups Projects
Commit 3819f1cc authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

fix units; add doc

parent 952b7a01
No related branches found
No related tags found
1 merge request!636303 update ceph checks
......@@ -33,6 +33,7 @@
# 2022-10-25 v1.5 <axel.hahn@iml.unibe.ch> handle empty value in ph.perfadd
# 2023-01-30 v1.6 <axel.hahn@unibe.ch> check performance params 5+6 and show a warning if missing
# 2023-02-16 v1.7 <axel.hahn@unibe.ch> adding a generic min and max value did not really help
# 2024-04-24 v1.8 <axel.hahn@unibe.ch> fix unit conversion
# ======================================================================
......@@ -268,7 +269,8 @@ function ph._getExp(){
test "$_unit" = "K" && echo 2^10
test "$_unit" = "M" && echo 2^20
test "$_unit" = "G" && echo 2^30
test "$_unit" = "P" && echo 2^40
test "$_unit" = "T" && echo 2^40
test "$_unit" = "P" && echo 2^50
# phyiscal
# test "$_unit" = "m" && echo 10^-3
......@@ -296,7 +298,7 @@ function ph.toUnit(){
local _divisor=`ph._getExp $_unit`
# echo "DEBUG ... $_divisor .. $_multiply"
echo "`echo $_value | tr -d "[:alpha:]" `*${_multiply}/$_divisor" | bc
echo "$(echo $_value | tr -d "[:alpha:]" )*${_multiply}/$_divisor" | bc
}
......@@ -318,6 +320,7 @@ function ph.getFileAge(){
# get file for storage of last value
# global string dir_data custom path; default is /tmp/icinga_counter/
# param string varName variable name of a value to store
function ph._getStorefile(){
local varName=$1
......@@ -332,6 +335,8 @@ function ph._getStorefile(){
}
# save a value - needed for gdAddDeltaData
# param string varName variable name of a value to store
# param * value value as float/ integer
function ph._savecounter() {
local varName=$1
local value=$2
......@@ -341,6 +346,9 @@ function ph._savecounter() {
echo ${value} > "${sStoreFile}"
}
# get age of last storage of a value
# used in perfdeltaspeed
# param string varName variable name of a value to store
function ph._getageoflastvalue() {
local varName=$1
local sStoreFile=$(ph._getStorefile "${varName}")
......@@ -349,6 +357,9 @@ function ph._getageoflastvalue() {
# local inow=`date +%s`
# echo $(( ${inow}-${ilast}+1 ))
}
# get the last value
# used in perfdeltaspeed
# param string varName variable name of a value to store
function ph._readlastvalue(){
local varName=$1
local sStoreFile=$(ph._getStorefile "${varName}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment