Solved

DISK MACRO WARNING VALUE


Badge +2

(fr)

Bonjour,

J’aimerai savoir, si il est possible de mettre comme valeur pour la macro “WARNING”, une valeur en Go, et non un pourcentage pour un service qui est “OS-Windows-Disk-Generic-Id-SNMP” . Par exemple, remplacer la valeur de base qui est de 80(%),par 10Go par exemple.

L’idée est donc de remplacer la limite du WARNING par un nombre de Go a la place d’un pourcentage.

Malheureusement, je ne sais pas si c’est possible ou non, je m’en remet donc a vous.

Cordialement.

 

(en)

I would like to know if it is possible to set a value in Go, not a percentage, for the “WARNING” macro for a service which is “OS-Windows-Disk-Generic-Id-SNMP”. For example, replace the base value which is 80(%),by 10GB for example.

The idea is to replace the WARNING limit with a GB number instead of a percentage.

Unfortunately, I don’t know if that’s possible or not, so I’m in your hands.

Sincerely.

icon

Best answer by christophe.niel-ACT 13 June 2023, 15:23

View original

13 replies

Userlevel 5
Badge +14

if you do a --help of your command you can see that on the poller :

 --units Units of thresholds (Default: '%') ('%', 'B').

 

add that to your service extra option : --units=’B’

but you can’t set GB, you need to multiply by 1024*1024*1024 as B=Bytes

(I never tried it, I don’t know if it will change the performance data value to B instead)

Badge +2

So if i want to set 10GB, i have to set 1024^10 ?

Userlevel 5
Badge +14

no, you don’t want to make 1024^10!! 

10 * 1024 * 1024 * 1024 = 10 737 418 240 Bytes (10 Billions and a bit more)

B*1024=KB

KB*1024=MB

MB*1024=GB

Badge +2

okay, thank’s you 

but it is a problem if i didn’t create commands ?

Userlevel 5
Badge +14

as I said in my first reply, simply add a extra option in your command

 

your template should look like that : 

if you edit the extraoptions and add “ --units=’B’  ” it will be added to the existing command (do not remove what’s already there, just add, beware the space between the options, and the single quote (apostrophe) around the ‘B’,

 

the command have the option to run everything you put in the extraoptions (limited to what the --help allows you use)

 

 

Badge +2

okay, so if i understand well, the only things i have to do is to add in the command line “ --units=’B’ ”, and change the value in the warning macro ?

the command line look like this “ --filter-perfdata='storage.space|used|free --units=’B'' “

 

Badge +2

as I said in my first reply, simply add a extra option in your command

 

your template should look like that : 

if you edit the extraoptions and add “ --units=’B’  ” it will be added to the existing command (do not remove what’s already there, just add, beware the space between the options, and the single quote (apostrophe) around the ‘B’,

 

the command have the option to run everything you put in the extraoptions (limited to what the --help allows you use)

 

 

i just managed and it work, but i had to change the value you gave me ( 10 737 418 240 ), because when i set this value, the service is UNKNOWN and i have a message 

“ UNKNOWN: Wrong warning-usage threshold '10 737 418 240'. “

when i changed the warning value to “ 10 “ i worked.

 

Badge +2

it was the spaces between the numbers..xD

so,it works !!

thanks you very much for your help and for the time your took for me.

 

cordially

Userlevel 5
Badge +14

lol, I added the space in my multiplication for readability… sorry

please mark your question as answered to change the “?” tag on your post :)

Badge +2

how to do it ? 😅

Userlevel 5
Badge +14

I think that as the original poster, you have a “best answer” link on each reply (near like and quote) 

 

If you click on the post that is the solution, it should mark your post as “answered” or something 

Badge +2

yes, it was that, 

thank’s you very much for your help.

cordially

 

Badge +1

Hello,

i try this but it’s not working for me.

I change units to B and also try to change values to free. but the warning and critical treshold is still calculated wrong.

e.g. i have disk Total: 250GB usage: 160GB free: 90GB

so i want to put warning when is on this disk left 15GB and critical when there left 10GB free on disk.

 

The output is still calculatet like for usage not for free.

It’s there any change to make it work?

 

Reply