[ZBX-15965] vfs.fs.discovery does not include volumes mounted to folder paths Created: 2019 Apr 10 Updated: 2019 Apr 10 Resolved: 2019 Apr 10 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G) |
Affects Version/s: | 3.0.26 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Major |
Reporter: | Mark Braker | Assignee: | Edgar Akhmetshin |
Resolution: | Duplicate | Votes: | 0 |
Labels: | agent, items, usability | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() |
||||||||
Issue Links: |
|
Description |
Steps to reproduce:
Result: { { "data": [ |
Comments |
Comment by Mark Braker [ 2019 Apr 10 ] |
The following UserParameter located in the zabbix_agentd.conf or associated .\include\vfs.fs.discoverall.conf can be used as a workaround:
UserParameter=vfs.fs.discoverall, powershell.exe -NoProfile -File "C:\ProgramData\Zabbix\UserParameters\Get-VolumesForZabbix.ps1"
# Created By: RamblingPSTech # Created on 28FEB2017 # # Created for Zabbix UserParameter to return a discovery of volumes including mount points # # --- How-to-use --- # Save the contents of this file to a new file on the OS (i.e. C:\ProgramData\Zabbix\UserParameters\Get-VolumesForZabbix.ps1) # # Ensure the OS can run the .ps1 file by changing the system execution policy to "RemoteSigned" (Get-ExecutionPolicy, Set-ExecutionPolicy) # Or Ensure the ExecutionPolicy is set to AllSigned and digitally sign the file with a certificate and the publisher is trusted by the OS. # ref: https://docs.microsoft.com/en-us/previous-versions/technet-magazine/cc434702(v=msdn.10) # Or (not recommended) set the execution policy for the system to bypass # # Usage: Add the following string to the zabbix_agentd.conf file # UserParameter=vfs.fs.discoverall, powershell.exe -noprofile C:\ProgramData\Zabbix\UserParameters\Get-VolumesForZabbix.ps1 # # Restart the zabbix service # Add a new discovery rule on a new or existing Zabbix template with a key of vfs.fs.discoverall # Create new "Item Prototypes" using {#FSNAME} as a macro for the volume name # for example: Item Prototype # Name = Free disk space on {#FSNAME} # Key = vfs.fs.size[{#FSNAME},free] # Create new "Trigger Prototypes" using {#FSNAME} as a macro for the volume name # for example: Trigger Prototype # Name = Free disk space is less than 10% on volume {#FSNAME} # Expression = {Template_Windows_Discover_FS:vfs.fs.size[{#FSNAME},pfree].max(5m)}<10 # Link the template to the appropriate host # It will take some time (30-90 minutes) for the new items to populate on that host and even more time (1-3 hours) for data to be acquired # # The new script can be tested by running the zabbix_get -s localhost -k vfs.fs.discoverall # note: 127.0.0.1,::1 will need to be included in "Servers=" list in the zabbix_agentd.conf to test locally # Define the ComputerName parameter param( [string] $ComputerName = 'localhost' ) # get all local volumes on fixed disks with established volume names via wmi $volumes = get-wmiobject -ComputerName $ComputerName -class win32_volume $objpkg = @() foreach ($volume in $volumes) { switch ($volume.DriveType) { "1" {$driveType = 'No root directory.' } "2" {$driveType = 'removabledisk' } "3" {$driveType = 'fixed' } "4" {$driveType = 'networkdisk' } "5" {$driveType = 'cdrom' } "6" {$driveType = 'ramdisk' } Default {$driveType = 'Drive type could not be determined.' } } $voldata = @{ # additional values can be included to support volume macro filters such as blocksize,freespace,capacity,bootvolume,systemvolume,DirtyBitSet,IndexingEnabled,QuotasEnabled, etc. # trim trailing "\" from volume names returned by wmi to support perf_counter zabbix keys '{#FSNAME}' = ($volume.name).substring(0,($volume.name).length -1) '{#FSTYPE}' = $volume.FileSystem '{#FSDRIVETYPE}' = $driveType } $obj = new-object psobject -property $voldata $objpkg += $obj } $data = new-object psobject -property @{'data' = $objpkg} $data|convertto-json
Note: Zabbix agent "Timeout" parameter can be used in the zabbix_agentd.conf file to allow time for PowerShell based UserParameter keys to execute. The default timeout is set to 3 seconds with this parameter undefined and can be increased to 30 seconds. Ref: https://www.zabbix.com/documentation/4.2/manual/appendix/config/zabbix_agentd_win |
Comment by Edgar Akhmetshin [ 2019 Apr 10 ] |
Hello Mark, Thank you for reporting the issue with a workaround solution. I found a similar case registered under Regards, |