【问题标题】:Solarwinds API Poll NowSolarwinds API 立即投票
【发布时间】:2017-07-10 19:18:06
【问题描述】:
在 SolarWinds 用户界面中,您可以在开关或界面视图中单击一个按钮来“立即投票”,而无需等待定期安排的投票。我一直在尝试找出一种使用 SolarWinds API 重新创建此功能的方法。我浏览了this 页面,似乎我需要使用“调用”或“更新”操作,但几乎没有关于实际用法的信息。我还尝试检查用户界面中的 Javascript,但无法确定它的正面或反面。
我想知道是否有人可以向我指出一些有用的文档,说明 API 中实际可用的操作(“调用”操作要求您提供“动词”作为参数,但我找不到任何关于可用动词的列表或文档)。有人知道任何资源吗?
【问题讨论】:
标签:
network-monitoring
solarwinds-orion
【解决方案1】:
如果您查看Orion.Nodes SWIS Entity,您可以在底部的“PollNow”SWIS 动词中看到。不幸的是,它没有很好地记录它实际具有的参数(尽管可以在SWQL Studio 中看到)。但是你应该可以使用 Powershell 做到这一点:
$orionHost = "<hostname where orion is installed>"
$orionUsername = "Admin" # fill login username to orion
$orionPassword = "Pass" # fill login password to orion, this example counts that this is not empty string
$nodeIdToPoll = 1; # put id of the node
$Entity = "Orion.Nodes"
$Verb = "PollNow"
$Data = @($nodeIdToPoll)
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$credentials = new-object PSCredential ($orionUsername , (ConvertTo-SecureString $orionPassword -AsPlainText -Force))
Invoke-RestMethod "https://$($orionHost):17778/SolarWinds/InformationService/v3/Json/Invoke/$Entity/$Verb" `
-Method POST `
-Body (ConvertTo-Json -InputObject $Data) `
-Credential $credentials `
-ContentType "application/json"