Moon19
Contributor
Contributor

PowerCLI errors updating SNMP on ESXi6.5

     So I've got an interesting problem that I can't pin down the cause to.

     The goal is to have a bit of PowerCLI script import a CSV file, select the SNMP values of the correct row (determined by the user) and apply them to the targeted ESXi host.  While I'm beefing up the script beyond that now with logging and error checking and the like, I get a random error that doesn't prevent the server from having its values updated...

"Message: UpdateDaemon() call failed, reason: Agent not responding, connect uds socket(/var/run/snmp.ctl) failed 4, err= Interrupted system call;

InnerText: UpdateDaemon() call failed, reason: Agent not responding, connect uds socket(/var/run/snmp.ctl) failed 4, err= Interrupted system callEsxCLI.CLIFault.summary

At C:\Powershell\update-esxsnmp.ps1:63 char:1

+ $esxcli.system.snmp.set.Invoke(@{loglevel = $snmp.loglevel})

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : OperationStopped: (:) [], ViError

    + FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.ViError"

So, the server I'm working on is in-LAN, response times under 4ms.  Making the call from my desktop.  I can reset the test server and re-run the code and different elements will pop this error.  As far as I can tell, this is essentially a nuisance variable as the values in the CSV do make it to the ESXi host otherwise.  Error doesn't come up based on the previous value of the field in SNMP - this'll come up regardless when it pops.

That said, I want to eliminate the error for peace of mind if nothing else.

SO!  Here's the meat of the code, detailing how it spins up and the calls it makes to SNMP changes:

$SNMP = import-csv $file | where {$_.host -eq $template}

write-host $snmp

connect-viserver $VCServer

$vmhost = get-vmhost $esxhost

$esxcli = get-esxcli -vmhost $vmhost -v2

if ($template -ne 'clear')

{

write-host "Updating Auth value: " $snmp.authentication

$esxcli.system.snmp.set.Invoke(@{authentication = $snmp.authentication})

write-host "Updating Enable value: " $snmp.enable

$esxcli.system.snmp.set.Invoke(@{enable = $snmp.enable})

write-host "Updating Engine value: " $snmp.'engine id'

$esxcli.system.snmp.set.Invoke(@{engineid = $snmp.'engine id'})

write-host "Updating hwsrc value: " $snmp.hwsrc

$esxcli.system.snmp.set.Invoke(@{hwsrc = $snmp.hwsrc})

write-host "Updating Storage value: " $snmp.largestorage

$esxcli.system.snmp.set.Invoke(@{largestorage = $snmp.largestorage})

write-host "Updating loglevel value: " $snmp.loglevel

$esxcli.system.snmp.set.Invoke(@{loglevel = $snmp.loglevel})

write-host "Updating Port value: " $snmp.port

$esxcli.system.snmp.set.Invoke(@{port = $snmp.port})

write-host "Updating privacy value: " $snmp.privacy

$esxcli.system.snmp.set.Invoke(@{privacy = $snmp.privacy})

write-host "Updating Users value: " $snmp.users

$esxcli.system.snmp.set.Invoke(@{users = $snmp.users})

write-host "Updating v3targets value: " $snmp.v3targets

$esxcli.system.snmp.set.Invoke(@{v3targets = $snmp.v3targets})

write-host "Updating Contact value: " $snmp.syscontact

$esxcli.system.snmp.set.Invoke(@{syscontact = $snmp.syscontact})

Thoughts?

0 Kudos
3 Replies
LucD
Leadership
Leadership

That looks a lot like the issue reported in KB2042772, but that KB is for ESXi 5.1, not 6.5

I would suggest to open a SR for this, looks like a "feature".


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Moon19
Contributor
Contributor

I agree I may need to set up a ticket, but I don't know that the cause is a lack of a scratch file...

0 Kudos
LucD
Leadership
Leadership

When you try to do the same with the esxcli command (in a SSH session to the ESXi node), do you get similar errors?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos