Ad Widget

Collapse

Dashboard List Disks Multiple Servers

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ludditetech
    Junior Member
    • Aug 2023
    • 3

    #1

    Dashboard List Disks Multiple Servers

    (Zabbix 6.4.5)

    Wanting dashboard widget to list all disks on multiple windows servers, to iterate through all the drives attached to server and display them in a widget.
    C Drive works fine, extra drives have different letters on different servers, some are F some M some U etc.

    I tried vfs.fs.size[{#FSNAME},free] but get no data.

    Is there a way to iterate through attached disks - drives?​
  • Answer selected by vijayk at 19-09-2023, 11:18.
    vijayk
    Senior Member
    • May 2023
    • 305

    You can use Top hosts in widget type and select host group and add Host as 1st column and other disks are as 2nd, 3rd and so on.

    Comment


    • ludditetech
      ludditetech commented
      Editing a comment
      Thanks vijayk, tried but i might not have understood your instruction, will try again.
  • vijayk
    Senior Member
    • May 2023
    • 305

    #2
    You can use Top hosts in widget type and select host group and add Host as 1st column and other disks are as 2nd, 3rd and so on.

    Comment


    • ludditetech
      ludditetech commented
      Editing a comment
      Thanks vijayk, tried but i might not have understood your instruction, will try again.
  • ludditetech
    Junior Member
    • Aug 2023
    • 3

    #3
    Something like this vijayk?
    Attached Files

    Comment

    • vijayk
      Senior Member
      • May 2023
      • 305

      #4
      Originally posted by ludditetech
      Something like this vijayk?
      Yes, perfect.

      Comment


      • ludditetech
        ludditetech commented
        Editing a comment
        Thanks, wondering if there is a way to use disk number variable if that exists in vfs.fs.dependent.size{disk1} or similar macro?
        (bit of a newb at this more advanced stuff)
    • DrunkSkeeterPilot
      Junior Member
      • Jan 2024
      • 2

      #5
      I also need to know if there's a way to have monitoring dashboard show a calculated item that shows the most full disk of all found disks on the server in question.

      I.e. if a server has disks with utilizations C at 40%, D at 24%, E at 76%, F at 1% and G at 100%, how to get the dashboard column for disk space utilization to reflect the maximum utilized disk, which in this example would be G, so it should show a 100% value on the column data. Because most servers may only have C, or C and D disks.

      Edit:

      Nvm I figured it out

      Formula for the Calculated Item under my custom windows template:

      max(last_foreach(//vfs.fs.dependent.size[*,pused]))
      Last edited by DrunkSkeeterPilot; 05-09-2024, 18:32.

      Comment

      • tcweb
        Member
        • Jun 2024
        • 35

        #6
        I'm a few rungs below you when it comes to understanding the advanced stuff. Can you explain how you set up your calculated item?
        Some questions: what is the key value? Does your item require preprocessing?

        *disregard*, I was trying to build a template from scratch. I think I'll learn faster by building on top of an existing template.

        -tcweb
        Last edited by tcweb; 05-09-2024, 19:46.

        Comment

        • tcweb
          Member
          • Jun 2024
          • 35

          #7
          OK, I was able to make your query work. But my question has changed to: How can I also identify the drive label (drive letter, etc) that is associated with the fullest drive?
          It would be nice to show the end user which drive is causing the issue/alert.

          -tcweb

          Comment

          • TobiasB
            Junior Member
            • Nov 2024
            • 1

            #8
            Originally posted by tcweb
            OK, I was able to make your query work. But my question has changed to: How can I also identify the drive label (drive letter, etc) that is associated with the fullest drive?
            It would be nice to show the end user which drive is causing the issue/alert.

            -tcweb
            Hello forum,
            This would be interesting if someone had a solution to also pass the drive letter of the fullest drive to the Top 10 list in any way?

            regards Tobias

            Comment

            • tko
              Junior Member
              • Aug 2024
              • 9

              #9
              Originally posted by DrunkSkeeterPilot
              I also need to know if there's a way to have monitoring dashboard show a calculated item that shows the most full disk of all found disks on the server in question.

              I.e. if a server has disks with utilizations C at 40%, D at 24%, E at 76%, F at 1% and G at 100%, how to get the dashboard column for disk space utilization to reflect the maximum utilized disk, which in this example would be G, so it should show a 100% value on the column data. Because most servers may only have C, or C and D disks.

              Edit:

              Nvm I figured it out

              Formula for the Calculated Item under my custom windows template:

              max(last_foreach(//vfs.fs.dependent.size[*,pused]))
              Sorry i do not check this out.

              Where i have to put this line?
              in My Top Hosts list?

              "max(last_foreach(//vfs.fs.dependent.size[*,pused]))"

              Comment

              • tcweb
                Member
                • Jun 2024
                • 35

                #10
                tko, you need to create a new calculated item. (ideally in a template that you could apply to a group of hosts).

                but to test, you can create a new item on one specific host.

                Click image for larger version

Name:	zabbix.png
Views:	1458
Size:	48.3 KB
ID:	499016
                Attached Files

                Comment

                • paulb007
                  Junior Member
                  • May 2025
                  • 4

                  #11
                  HI

                  Thanks, i have this working, it shows the drive with the most used space - However Is there a way to include the volume name and drive letter (windows) / linux device (e.g. sda1)?

                  Thanks

                  Comment

                  • paulb007
                    Junior Member
                    • May 2025
                    • 4

                    #12
                    OK - I have a work around for now.

                    Linux
                    Create a script (e.g., /etc/zabbix/fullest_drive.sh)

                    #!/bin/bash
                    # Use the df command to list disk usage, then find the fullest disk.
                    # Adjust the command as necessary if your environment or output format is different.
                    df -P | awk 'NR>1 {print $5 " " $6}' | sed 's/%//g' | sort -nr | head -1 | awk '{print $2}'

                    Making the script executable
                    chmod +x /etc/zabbix/fullest_drive.sh

                    Add a custom user parameter in your Zabbix agent configuration, mine is here /etc/zabbix/zabbix_agentd.conf and I put the parameter at the end

                    UserParameter=fullest.drive.name,/etx/zabbix/fullest_drive.sh

                    Restart the agent

                    Zabbix frontend, create a new item - I added mine to the template Linux by Zabbix agent
                    Click image for larger version

Name:	image.png
Views:	931
Size:	26.1 KB
ID:	503073

                    Windows
                    ​Create a PowerShell script (e.g., C:\Scripts\fullest_drive.sh) - I put mine on a share so if i needed to edit it only has to be done once

                    # fullest_drive.ps1
                    # This script identifies the fixed drive with the highest usage
                    # (i.e., the lowest free space percentage)

                    # Retrieve all fixed drives (DriveType=3 indicates local disks)
                    $drives = Get-WmiObject Win32_LogicalDisk -Filter "DriveType=3"

                    if (!$drives) {
                    Write-Output "No fixed disks found"
                    exit 1
                    }

                    $maxDrive = $null
                    $maxUsage = 0

                    foreach ($drive in $drives) {
                    # Ensure the drive size is greater than zero
                    if ($drive.Size -gt 0) {
                    # Calculate usage percentage as: 100 - (% free)
                    $usage = 100 - ( ($drive.FreeSpace / $drive.Size) * 100 )
                    if ($usage -gt $maxUsage) {
                    $maxUsage = $usage
                    $maxDrive = $drive.DeviceID
                    }
                    }
                    }

                    # Output the drive identifier (e.g., 'C:')
                    Write-Output $maxDrive​

                    Add a custom user parameter in your Zabbix agent configuration, mine is here c:\program files\zabbix agent 2\zabbix_agentd.conf and I put the parameter at the end

                    UserParameter=fullest.drive,powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Admin\Zabbix_scripts\fullest_drive.ps1"

                    Restart the agent

                    ​Zabbix frontend, create a new item - I added mine to the template Windowsby Zabbix agent
                    Click image for larger version

Name:	image.png
Views:	876
Size:	26.4 KB
ID:	503074
                    Adding to the dashboard
                    Click image for larger version

Name:	image.png
Views:	872
Size:	15.6 KB
ID:	503075 Click image for larger version

Name:	image.png
Views:	870
Size:	13.1 KB
ID:	503077​​​
                    ​​
                    Attached Files

                    Comment

                    Working...