Hi,
Is there a way I can change the output format of this check plugin?
I wanted to have a result in 'MB' instead of 'B'
[root@DEV-ITMON libexec]# ./check_disk_smb -H 172.24.142.228 -s e$ -u 'me_admin' -p 'password'
Disk ok - 1282.81G (68%) free on \\172.24.142.228\e$ | 'e$'=622971584512B;1700323865395.2;1900361967206.4;0;2000381018112
Appreciate your help on this.
Thanks,
Ian
Changing Check_disk_smb output format
Changing Check_disk_smb output format
You do not have the required permissions to view the files attached to this post.
Re: Changing Check_disk_smb output format
If you had "MB" in the perfdata output, the gauge would show it correctly. It seems like that the perfdata is hardcoded in "B" in the plugin:
I believe, you will need to modify the plugin to show perfdata in "M". Does the perfdata output change if you pass a different unit to the threshold value?
From the plugins's usage:
Code: Select all
$perfdata = "'" . $share . "'=" . $occupied_bytes . 'B;'
. $warn_bytes . ';'
. $crit_bytes . ';'
. '0;'
. $total_bytes;From the plugins's usage:
If thresholds are followed by either a k, M, or G then check to see if that much disk space is available (kilobytes, Megabytes, Gigabytes)
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Changing Check_disk_smb output format
Hi,
I tried changing the thresholds. Below is the results.
COMMAND:
./check_disk_smb -H 172.24.142.228 -s e$ -u 'me_admin' -p '1122' -w '1700G' -c '1680G'
RESULT:
CRITICAL: Only 1660.06G (89%) free on \\172.24.142.228\e$ | 'e$'=217902481408B;175019917312;196494753792;0;2000381018112
I attached the plugin I am using as well.
Regards,
Ian
I tried changing the thresholds. Below is the results.
COMMAND:
./check_disk_smb -H 172.24.142.228 -s e$ -u 'me_admin' -p '1122' -w '1700G' -c '1680G'
RESULT:
CRITICAL: Only 1660.06G (89%) free on \\172.24.142.228\e$ | 'e$'=217902481408B;175019917312;196494753792;0;2000381018112
I attached the plugin I am using as well.
Regards,
Ian
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Changing Check_disk_smb output format
I would imagine the reason that the plugin developer left the perfdata in bytes was so that there weren't unit problems when comparing 2 different metrics. For instance what if you have a smb share with 17 TiB of used space and only 50 MB of free space, and this was expected. Automatically manipulating the units might make it appear like there is a substantial deal more free space than used space.
That said - you can certainly modify the plugin to adjust the perfdata units as you see fit. The elegant way would be to add a command argument specifying the output units. The inelegant way would be to simply divde the perfdata values $occupied_bytes, $warn_bytes, $crit_bytes and $total_bytes by 1024 as many times as suits you:
That said - you can certainly modify the plugin to adjust the perfdata units as you see fit. The elegant way would be to add a command argument specifying the output units. The inelegant way would be to simply divde the perfdata values $occupied_bytes, $warn_bytes, $crit_bytes and $total_bytes by 1024 as many times as suits you:
Code: Select all
$perfdata = "'" . $share . "'=" . $occupied_bytes . 'B;'
. $warn_bytes . ';'
. $crit_bytes . ';'
. '0;'
. $total_bytes;