I use the net-snmp extension functions to be able to run the powershell script when requesting a specific SNMP file.
snmpd is configured to run get-storageinfo.ps1 script with some parameters.
The script is called by the net-snmp agent as follows:
& c:\scripting\get-storageinfo.ps1 -name somedevicename -detaillevel 2 -oid oidstring
However, when I add parameter attributes or CmdletBinding (or both), my parameter definitions in my get-storageinfo.ps1 script change. I do not understand why. I have this at the very top of my script (after some comments actually).
[CmdletBinding()]
Param(
[string]$name,
[string]$detaillevel
[string]$oid
)
or same problem
Param(
[Parameter(Mandatory=$True)][string]$name,
[string]$detaillevel
[string]$oid
)
This somehow breaks my snmpd functions. When the configured OID is read, I get: "There is no such instance in this OID"
( ) , CmdletBinding :
Param(
[string]$name,
[string]$detaillevel
[string]$oid
)
net-snmp , .
Net-SNMP (snmpd) script , script /cmdletbinding. - , (snmpd). .
, net-snmp? .
UPDATE
"extend" snmpd.conf istead "pass" commando. . , .
, . , .