-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1099 from OpenNMS/jira/HZN-915
HZN-915: Added ReST service for invoking one-time discovery scans
- Loading branch information
Showing
5 changed files
with
654 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
opennms-doc/guide-development/src/asciidoc/text/rest/discovery.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
==== Discovery | ||
This endpoint can be used to trigger a one-time discovery scan. | ||
|
||
===== POSTs (Submitting one-time scan configuration) | ||
|
||
[options="header", cols="5,10"] | ||
|=== | ||
| Resource | Description | ||
| `/opennms/api/v2/discovery` | Submits an one-time scan configuration | ||
|=== | ||
|
||
The following XML structure is used to define a scan job. | ||
|
||
.Sample configuration file `discovery.xml` | ||
[source,XML] | ||
---- | ||
<discoveryConfiguration> | ||
<specifics> | ||
<specific> | ||
<location>Default</location> | ||
<retries>3</retries> | ||
<timeout>2000</timeout> | ||
<foreignSource>My-ForeignSource</foreignSource> | ||
<content>192.0.2.1</content> | ||
</specific> | ||
</specifics> | ||
<includeRanges> | ||
<includeRange> | ||
<location>Default</location> | ||
<retries>3</retries> | ||
<timeout>2000</timeout> | ||
<foreignSource>My-ForeignSource</foreignSource> | ||
<begin>192.0.2.10</begin> | ||
<end>192.0.2.254</end> | ||
</includeRange> | ||
</includeRanges> | ||
<excludeRanges> | ||
<excludeRange> | ||
<begin>192.0.2.60</begin> | ||
<end>192.0.2.65</end> | ||
</excludeRange> | ||
</excludeRanges> | ||
<includeUrls> | ||
<includeUrl> | ||
<location>Default</location> | ||
<retries>3</retries> | ||
<timeout>2000</timeout> | ||
<foreignSource>My-ForeignSource</foreignSource> | ||
<content>http://192.0.2.254/addresses.txt</content> | ||
</includeUrl> | ||
</includeUrls> | ||
</discoveryConfiguration> | ||
---- | ||
|
||
The scan itself can be triggered by posting the configuration to the ReST endpoint as follows: | ||
|
||
.Trigger one-time scan | ||
[source, bash] | ||
---- | ||
curl -H "Content-Type: application/xml" -u admin:admin -X POST -d @discovery.xml http://localhost:8980/opennms/api/v2/discovery | ||
---- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.