Ad Widget

Collapse

Dashboard with items values from LLD discovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ignace_Frometon
    Junior Member
    • Dec 2021
    • 26

    #1

    Dashboard with items values from LLD discovery

    Hello there !

    Zabbix version : 6.0.9

    i would like to monitor active CIFS connections from several servers.

    so i wrote a few lines of powershell :

    Code:
    if (Get-SmbConnection | where-object { $_.Username -like 'DOMAIN\user_*' -and $_.NumOpens -ge 1})
    {
        $cifsconnections = Get-SmbConnection | where-object { $_.Username -like 'DOMAIN\user_*' -and $_.NumOpens -ge 1} | Select-Object -Property UserName, serverName, ShareName, NumOpens
        $OpenedConnectionsCount = $cifsconnections.Count
        foreach ($cifsconnection in $cifsconnections)
        {
            $user = $cifsconnection.UserName -replace ('DOMAIN\\',"")
            $serverName = $cifsconnection.serverName
            $ShareName = $cifsconnection.ShareName
            $TotalOpenedFilesCount += $cifsconnection.NumOpens
            $id = "$user" + "_" + "$serverName" + "_" + "$ShareName"
            $cifsconnection | Add-Member -NotePropertyName User -NotePropertyValue $user
            $cifsconnection | Add-Member -NotePropertyName id -NotePropertyValue $id
            $cifsconnection.PSObject.properties.remove('UserName')
        }
     
        convertto-json @($cifsconnections),$OpenedConnectionsCount,$TotalOpenedFilesCount
    }else{
        convertto-json @(),0,0
    }​
    i copied this script on each CIFS client and i execute it each minute with a userparameter line in agent config file :

    Code:
    UserParameter=cifs.connections,powershell.exe -NoProfile -ExecutionPolicy bypass -File "C:\Zabbix\get_cifs_connections.ps1" $1

    this sends a json to a zabbix raw item that looks like this :

    Code:
    [
    
        [
    
            {
    
                "serverName":  "server1.domain.com",
    
                "ShareName":  "share500",
    
                "NumOpens":  124,
    
                "User":  "user_001",
    
                "id":  "user_001_server1.domain.com_share500"
    
            },
    
            {
    
                "serverName":  "server2.domain.com",
    
                "ShareName":  "share500",
    
                "NumOpens":  71,
    
                "User":  "user_001",
    
                "id":  "user_001_server2.domain.com_share500"
    
            },
    
            {
    
                "serverName":  "server4.domain.com",
    
                "ShareName":  "share500",
    
                "NumOpens":  32,
    
                "User":  "user_001",
    
                "id":  "user_001_server4.domain.com_share500"
    
            },
    
            {
    
                "serverName":  "server1000",
    
                "ShareName":  "share500",
    
                "NumOpens":  3,
    
                "User":  "user_300",
    
                "id":  "user_300_server1000_share500"
    
            },
    
            {
    
                "serverName":  "server1000",
    
                "ShareName":  "share500",
    
                "NumOpens":  3,
    
                "User":  "user_500",
    
                "id":  "user_500_server1000_share500"
    
            }
    
        ],
    
        5,
    
        233
    
    ]​

    then i configured a LLD discovery to create dependent items from the raw json item.

    so far, everything works as expected.

    now, i do not manage to set up a clear dashboard that would look like the table in the attached screenshot. i would like to have a similar table on the same dashboard for each host in the hostgroup.

    with the "data overview" option, i managed to configure a table but it does not fit my needs, and it it is mentionned that it is deprecated.

    would anyone have any advice on how to achieve that ?

    thanks :-)​
    Attached Files
    Last edited by Ignace_Frometon; 14-02-2023, 12:46.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4806

    #2
    For now usage of "top N" widget has been suggested instead of Data overview....Does not always do exactly that, but you can get "almost there"... Sorting output in your case by NumOpens field would give you pretty much the same...

    Comment

    • Ignace_Frometon
      Junior Member
      • Dec 2021
      • 26

      #3
      Hi Cyber,

      thanks for answering.

      i gave a try to "top N" widget but i can't manage to get what i want. (maybe there i did not explain it clearly : the column "serverName" is not the name of the host, it is a prototype item (type text) that contains the alias of the file server used by the CIFS connection)
      so i assume i have to create one widget per host. (is there a way to make it dynamic and avoid doing this operation for each host ?)
      but It only displays one line in the widget : when i add a column, and i select an item to be displayed, i can't choose a prototype. am i missing something ?

      Comment

      • AMSH
        Junior Member
        • Mar 2021
        • 5

        #4
        Originally posted by Ignace_Frometon
        Hi Cyber,
        am i missing something ?
        You aren't missing anything. It seems that dashboards in templates do not support item prototypes. I currently have Zabbix 6.2 and similar task.

        Comment

        • gcmsmatos
          Junior Member
          • Sep 2025
          • 1

          #5
          I am having a similar problem. It seems like it should be possible to create a dashboard in the template that is able to use item prototypes

          Comment

          Working...