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 :
i copied this script on each CIFS client and i execute it each minute with a userparameter line in agent config file :
this sends a json to a zabbix raw item that looks like this :
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 :-)
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
}
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 :-)
Comment