Perfect working.
Ad Widget
Collapse
Automatic nmap scanning
Collapse
X
-
Small mistake in API, i though (for some reasons) active_available represents if host is disabled or not.
Changed to "status" instead.Attached Files
Hiring in the UK? Drop a messageComment
-
You can go to template trigger, and make sure you have selected multiple event generation selected. For each port - one alert.
or modify powershell to send all as one value instead one by oneLast edited by PeterZielony; 16-09-2023, 12:14.
Hiring in the UK? Drop a messageComment
-
Can you please share the powershell script to send all as one value? I'm not aware with Powershell so. I don't want multiple trigger.Comment
-
Comment
-
Thanks! would be nice to have one in the middle of the week!
in meantime, try this one.
had no vpn so couldn't test it but in theory, it should work.
changed this:
# Send unauthorized open ports to zabbix
if ($UnauthorizedPorts.Count -gt 0) {
Add-Content -Path $LogFilePath -Value ( $TimeStamp +" Unauthorized Ports found for host $HostName : $UnauthorizedPorts")
$UnauthorizedPorts | ForEach-Object {
Send-DataZabbixItem -HostName $HostName -ItemKeyZbx $HostItemKeyPort -UnauthorizedPort $_ -ZabbixReceiver $ZabbixReceiver -HostTLSOption $HostTLS
}
} else
{
Write-Host "No unauthorized open ports found."
}
to this:
# Send unauthorized open ports to zabbix
if ($UnauthorizedPorts.Count -gt 0) {
Add-Content -Path $LogFilePath -Value ( $TimeStamp +" Unauthorized Ports found for host $HostName : $UnauthorizedPorts")
#send array instead this time
Send-DataZabbixItem -HostName $HostName -ItemKeyZbx $HostItemKeyPort -UnauthorizedPort $UnauthorizedPorts -ZabbixReceiver $ZabbixReceiver -HostTLSOption $HostTLS
} else {
Write-Host "No unauthorized open ports found."
}Attached FilesLast edited by PeterZielony; 17-09-2023, 04:53.
Hiring in the UK? Drop a messageComment
-
Tried this but received the error message...
Send-DataZabbixItem : Cannot process argument transformation on parameter 'UnauthorizedPort'.
Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32".
At C:\Users\User\Downloads\network-scanner.ps1:327 char:91
+ ... mKeyZbx $HostItemKeyPort -UnauthorizedPort $UnauthorizedPorts -Zabbix ...
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: ( [Send-DataZabbixItem], ParameterBindingArgumentT
ransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Send-DataZabbixItem
: The term '' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At C:\Users\User\Downloads\network-scanner.ps1:332 char:5
+ }
+ ~~
+ CategoryInfo : ObjectNotFound: (:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundExceptionComment
-
oh forgot. this is an arrayTried this but received the error message...
Send-DataZabbixItem : Cannot process argument transformation on parameter 'UnauthorizedPort'.
Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32".
At C:\Users\User\Downloads\network-scanner.ps1:327 char:91
+ ... mKeyZbx $HostItemKeyPort -UnauthorizedPort $UnauthorizedPorts -Zabbix ...
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: ( [Send-DataZabbixItem], ParameterBindingArgumentT
ransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Send-DataZabbixItem
: The term '' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At C:\Users\User\Downloads\network-scanner.ps1:332 char:5
+ }
+ ~~
+ CategoryInfo : ObjectNotFound: (:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
try attachedAttached Files
Hiring in the UK? Drop a messageComment
Enjoy the Weekend.
Comment