Made a powershell script for filling some asset fields.
# Installdate of Windows
$wmi = Get-WmiObject -Class Win32_OperatingSystem
$dateInstalled = $wmi.ConvertToDateTime($wmi.InstallDate)
# Serialnumber and manufacturer of server
Get-WmiObject win32_bios | select SerialNumber
$wmi = Get-WmiObject -Class win32_bios
$manufacturer = $wmi.Manufacturer
# Text file with a description of the server for the comments field
$comment = Get-Content "C:\Program Files\BGInfo\Info_Description.txt" |
Out-String
$uri="http://opennms.domain.nl:8980/opennms/rest/nodes/646/assetRecord"
$user ="admin"
$pass= "admin"
$secpasswd = ConvertTo-SecureString $user -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($pass,
$secpasswd)
Invoke-RestMethod -Uri
"http://opennms.massxess.nl:8980/opennms/rest/nodes/646/assetRecord/?bui
lding=133" -Credential $cred -Method PUT
Invoke-RestMethod -Uri "$uri/?manufacturer=$manufacturer" -Credential
$cred -Method PUT
Invoke-RestMethod -Uri "$uri/?dateInstalled=$dateInstalled" -Credential
$cred -Method PUT
Invoke-RestMethod -Uri "$uri/?comment=$comment" -Credential $cred
-Method PUT
Fred
Van: Fred Ebben [mailto:***@massxess.nl]
Verzonden: vrijdag 5 juli 2013 11:20
Aan: General OpenNMS Discussion
Onderwerp: Re: [opennms-discuss] snmp asset adapter
http://demo.ocsinventory-ng.org/# <http://demo.ocsinventory-ng.org/> a
demo of a SNMP inventory software.
There's als a field 'Notes'. Is this somewhere to set on Windows/Linux
machines for de SNMP Asset field Comments?
I use BGinfo on Windows servers. The 'server description' is a textfile.
Maybe I can put this information in notes 'SNMP field' so it will be
visible in Comments snmp-asset field .
Van: Fred Ebben [mailto:***@massxess.nl]
Verzonden: vrijdag 5 juli 2013 09:23
Aan: opennms-***@lists.sourceforge.net
Onderwerp: Re: [opennms-discuss] snmp asset adapter
For HP Proliant Servers Not all field are working, this will be updated.
Working fields in this config: Model Number, Serial Number, Asset
Numer=Hostname. The asset fields are filled for servers within
'Provisioning Requisitions'. Works not with auto discovered devices.
<http://opennms.530661.n2.nabble.com/attachment/7583825/0/image001.jpg>
In the log /var/log/opennms/daemon/provisiond
Provisiond (I'm still testing with more fields)
2013-07-05 08:50:05,186 DEBUG [pool-6-thread-1] Snmp4JStrategy: get:
OID: [.1.3.6.1.4.1.232.2.2.4.2.0] for Agent:AgentConfig[Address:
192.168.51.41, ProxyForAddress: null, Port: 161, Community: snmpstring,$
2013-07-05 08:50:05,189 DEBUG [pool-6-thread-1] Snmp4JStrategy:
processResponse: SNMP operation successful, value: [ProLiant DL360 G5]
2013-07-05 08:50:05,189 DEBUG [pool-6-thread-1]
SnmpAssetProvisioningAdapter: fetchSnmpAssetString: Fetched asset
properties from SNMP agent:
Model => ProLiant DL360 G5
2013-07-05 08:50:05,189 DEBUG [pool-6-thread-1]
SnmpAssetProvisioningAdapter: doUpdate: Setting asset field
"modelNumber" to value: ProLiant DL360 G5
2013-07-05 08:50:05,191 DEBUG [pool-6-thread-1] Snmp4JStrategy: get:
OID: [.1.3.6.1.4.1.232.2.2.2.5.0] for Agent:AgentConfig[Address:
192.168.51.41, ProxyForAddress: null, Port: 161, Community: snmpstring,$
2013-07-05 08:50:05,193 DEBUG [pool-6-thread-1] Snmp4JStrategy:
processResponse: SNMP operation successful, value: [CZJ7250]
2013-07-05 08:50:05,193 DEBUG [pool-6-thread-1]
SnmpAssetProvisioningAdapter: fetchSnmpAssetString: Fetched asset
properties from SNMP agent:
Serial => CZJ7250
2013-07-05 08:50:05,193 DEBUG [pool-6-thread-1]
SnmpAssetProvisioningAdapter: doUpdate: Setting asset field
"serialNumber" to value: CZJ72506XM
2013-07-05 08:50:05,194 DEBUG [pool-6-thread-1] Snmp4JStrategy: get:
OID: [.1.3.6.1.2.1.1.6.0] for Agent:AgentConfig[Address: 192.168.51.41,
ProxyForAddress: null, Port: 161, Community: snmpstring, Timeout$
2013-07-05 08:50:05,201 DEBUG [pool-6-thread-1] Snmp4JStrategy:
processResponse: SNMP operation successful, value: [Almere]
2013-07-05 08:50:05,202 DEBUG [pool-6-thread-1]
SnmpAssetProvisioningAdapter: fetchSnmpAssetString: Fetched asset
properties from SNMP agent:
Location => Almere
2013-07-05 08:50:05,202 DEBUG [pool-6-thread-1]
SnmpAssetProvisioningAdapter: doUpdate: Setting asset field "division"
to value: Almere
2013-07-05 08:50:05,203 DEBUG [pool-6-thread-1] Snmp4JStrategy: get:
OID: [.1.3.6.1.4.1.232.11.2.2.1.0] for Agent:AgentConfig[Address:
192.168.51.41, ProxyForAddress: null, Port: 161, Community: snmpstring$
2013-07-05 08:50:05,208 DEBUG [pool-6-thread-1] Snmp4JStrategy:
processResponse: SNMP operation successful, value: [Windows Server 2008
R2, x64 Enterprise Edition Service Pack 1]
2013-07-05 08:50:05,208 DEBUG [pool-6-thread-1]
SnmpAssetProvisioningAdapter: fetchSnmpAssetString: Fetched asset
properties from SNMP agent:
DataInstalled => Windows Server 2008 R2, x64 Enterprise Edition
Service Pack 1
2013-07-05 08:50:05,208 DEBUG [pool-6-thread-1]
SnmpAssetProvisioningAdapter: doUpdate: Setting asset field
"dateInstalled" to value: Windows Server 2008 R2, x64 Enterprise Edition
Service Pack 1
2013-07-05 08:50:05,209 DEBUG [pool-6-thread-1] Snmp4JStrategy: get:
OID: [.1.3.6.1.4.1.232.11.2.2.1.0] for Agent:AgentConfig[Address:
192.168.51.41, ProxyForAddress: null, Port: 161, Community: snmpstring$
2013-07-05 08:50:05,212 DEBUG [pool-6-thread-1] Snmp4JStrategy:
processResponse: SNMP operation successful, value: [Windows Server 2008
R2, Standard Edition, Service Pack 1]
2013-07-05 08:50:05,212 DEBUG [pool-6-thread-1]
SnmpAssetProvisioningAdapter: fetchSnmpAssetString: Fetched asset
properties from SNMP agent:
OperationSystem => Windows Server 2008 R2, x64 Standard Edition
Service Pack 1
How can I trigger a refresh of the snmp asset adapter. Now I restart
OpenNMS, change/delete some asset fields and the rescan and wait for 5
minutes.
An 'Asset Info' rescan button would be nice.
Kind regards,
Fred
Van: David S Hustace [via OpenNMS] [[hidden email]]
Verzonden: donderdag 4 juli 2013 20:56
Aan: Fred Ebben
Onderwerp: Re: snmp asset adapter
Does anybody have a working snmp-asset-adapter-configuration.xml
What does it mean to have a "working snmp-asset-adapter-configuration" ?
David
________________________________
View this message in context: RE: snmp asset adapter
<http://opennms.530661.n2.nabble.com/snmp-asset-adapter-tp7571447p758382
5.html>
Sent from the OpenNMS - discuss mailing list archive
<http://opennms.530661.n2.nabble.com/OpenNMS-discuss-f529575.html> at
Nabble.com.