I need monitor a folder size. I know that is perfect posible using scripts in the agent machine but i would like to know if zabbix has a function predefined.
Ad Widget
Collapse
Monitoring a folder size
Collapse
X
-
Tags: None
-
Currently agent does not natively support monitoring of folder size. -
you can add userParameter in you /etc/zabbix/agentd.conf
here's how you do it:
1: Open your /etc/zabbix/agentd.conf with your favourite text editor
(exp. nano /etc/zabbix/agentd.conf ) but don't forget the user rights
than check this in your terminal:
and see what it outputs.Code:du /your/path/to/folder/ -cb
ex.:
and check if you have written total or some other (if you have translated linux)Code:. . . 124502 /home/zabbix/zabbix-1.4.1/upgrades 19071805 /home/zabbix/zabbix-1.4.1 22328245 /home/zabbix/ 22328245 [B]total[/B]
and then you add this line at the bottom of the file:
(and replace the total with other word in case of translation)Code:UserParameter=folder_size1,du /your/path/to/folder/ -cb | grep [B]total[/B] | cut -f1
2: go to terminal and check if it works
you should get your filesize written like this:Code:zabbix_agentd -p
3:Code:folder_size1 [t|583417//your filesize]
if it does then you can go to your zabbix web interface and go to:
Configuration => Items, select your host and click create item..
give it a name and in the key field write this:
select type number(float) and write in the unit field "B" as byts.Code:folder_size1
at application field select filesystem. Set it as active and that's it.
you should now see it at monitoring..
Volia you get your monitoring of an folder!!Comment
-
Just as a small hint:
If that doesn't help, you might have less user rights.
Check if Zabbix user has at least read access to that directory and its content.
(i had that Problems some time ago...)Big ZABBIX is watching you!
(... and my 48 hosts, 4513 items, 1280 triggers via zabbix v1.6 on CentOS 5.0)
Comment
-
HowTo Windows FolderSize
I made a HowTo for Monitoring a FolderSize on a Windows Host.
You have to write an bat File that gives as result the size of a given folder.
This file has to be placed in an directory on the host that is in the path variable of the system (like c:\windows)
Example GetFolderSize.bat
After that you have to edit the zabbix_agentd.conf an add an userparameter that uses the created bat file.Code:@echo off @rem -- Batchfile to get the size of an folder setLocal EnableDelayedExpansion set /a value=0 FOR /R %1 %%I IN (*) DO set /a value=!value!+%%~zI @echo !value!
Example zabbix_agentd.conf:
Now you can add an Item to Zabbix. As Key you have to enter the <folder_size1> from the example.Code:### Option: UserParameter # User-defined parameter to monitor. There can be several user-defined parameters. # Format: UserParameter=<key>,<shell command> UserParameter=folder_size1,GetFolderSize.bat C:\temp
I hope this helps someone a little bit.Comment
-
Great
I made a HowTo for Monitoring a FolderSize on a Windows Host.
You have to write an bat File that gives as result the size of a given folder.
This file has to be placed in an directory on the host that is in the path variable of the system (like c:\windows)
Example GetFolderSize.bat
After that you have to edit the zabbix_agentd.conf an add an userparameter that uses the created bat file.Code:@echo off @rem -- Batchfile to get the size of an folder setLocal EnableDelayedExpansion set /a value=0 FOR /R %1 %%I IN (*) DO set /a value=!value!+%%~zI @echo !value!
Example zabbix_agentd.conf:
Now you can add an Item to Zabbix. As Key you have to enter the <folder_size1> from the example.Code:### Option: UserParameter # User-defined parameter to monitor. There can be several user-defined parameters. # Format: UserParameter=<key>,<shell command> UserParameter=folder_size1,GetFolderSize.bat C:\temp
I hope this helps someone a little bit.
I was looking for this solutions. I will test your script today.
Thanks.Comment
-
Remember, this script is a little slow.
So if you want to check very large folders it could take some time.
If you want to check you could replace the script by an executable that does the same.
Just Google foldersize. There are some programs availible.
I used this script because my folders are not larger than 100MB an i dont want to place binarys on our servers.Comment
-
A new solution to monitor Windows Folder Sizes
Hi guys,
I did some modifications on how to monitor windows files (with large foldes, like 20GB)
I've followed this steps:
1 - Configue zabbix agent to be actives
2 - At zabbix_agentd.conf, create your own scritp:
UserParameter=rede.size2[*],cscript //nologo <path_to_script> "$1"
3 - Use this script to return foldes size (this is a .vbs script):
4 - configure your Zabbix frontend to call your own script. You should do this usind the key value like:Dim objFSO , objFolder, sLoc
Set objFSO = CreateObject("Scripting.FileSystemObject")
sLoc = WScript.Arguments(0)
If objFSO.FolderExists(sLoc) Then
Set objFolder = objFSO.GetFolder(sLoc)
wscript.echo objFolder.Size
Else
wscript.Echo "Fodler does not exist."
End If
Set objFolder = Nothing
Set objFSO = Nothing
rede.size2[<path_to_folder_monitored>]
5 - Create an item to each monitored folder you wants.
Best regards,
Leandro AlvaresComment
-
this script is good only for monitoring large file or folder too??Hi guys,
I did some modifications on how to monitor windows files (with large foldes, like 20GB)
I've followed this steps:
1 - Configue zabbix agent to be actives
2 - At zabbix_agentd.conf, create your own scritp:
UserParameter=rede.size2[*],cscript //nologo <path_to_script> "$1"
3 - Use this script to return foldes size (this is a .vbs script):
4 - configure your Zabbix frontend to call your own script. You should do this usind the key value like:
rede.size2[<path_to_folder_monitored>]
5 - Create an item to each monitored folder you wants.
Best regards,
Leandro AlvaresComment
-
You can monitor all folder sizes.
I have created this script because it is faster than
I'm monitoring folder like 40 GB and it runs in 3 seg. To not decrease my zabbix server performance, I've set the agents like active.UserParameter=folder_size1,du /your/path/to/folder/ -cb | grep total | cut -f1
regards,
Leandro AlvaresComment
-
It it really?
I wonder if there can be something really faster than a du to check directory sizes. The major part of the work is reading file sizes from the disk. And this has to be done no matter which method you use.I have created this script because it is faster
Be aware that it can be hard to compare speed of different implementations. The problem is that the necessary info is cached by the kernel (in Linux for sure, can't say about other OSs) so the first try you make will be slow because it actually read the info from the disk. Any further try will be orders of magnitude faster as the info will be cached.
Having said all that here is a slight modification of the first suggestion with a little (cosmetic?) improvement:
It just reduces the amount of info outputed by du. I don't expect it to be faster than the previous option. It also reads info about one single filesystem: (the -x flag).Code:du /your/path/to/folder/ -cbxs | grep total | cut -f1
Comment
-
Reviving Thread
Hi Zabbix Masters!!
I was looking for the best way to monitor a folder with Zabbix and i found this thread, it's a little old one and i want to know....
Today is this still the best way to monitor folder size??
(i dont want to install external programs or addons to zabbix).
I have Zabbix 3.0 in server and clients.
With Ubuntu 14.0.4. both of them.
Thanks for your time.
Best regards.Last edited by Tec_Technician; 14-07-2016, 14:45. Reason: Forgot to add important information about the SO.Comment
-
I have the same question.
I installed Zabbix 3 on Debian and would like check the size of some folders in a windows server.
Is this possible now?Comment
Comment