- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2019 10:20 AM
Hello,
Is there any way to kick off discovery from JavaScript using just device name.
I am working on vCenter MID extension. I get the device name in the parm fields in the event from vCenter, from there I capture the name and populate it in the CMDB. Once addition is done I wanted to kick off discovery update the CI. I know how to run the discovery from script but not sure about running it without any IP address. Please suggest me any ideas here. Thanks!
Solved! Go to Solution.
- Labels:
-
Discovery
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2019 02:37 PM
So far so good. You have a probe object. Now you need to stick an address on it and mail it.
I think the values allows you to pass in some parameters, but I honestly don't know. Personally, i would just omit that argument, but if you want to try to work it out by example, by all means, go for it.
So, now you have a probe. Assuming you don't need to fool with other probe parameters, you can just set the ip or hostname in the source field and create the probe.
Here's an example i tried out with a simple Linux probe:
var ipOrHostname = 'timserve';
var mid = 'tims_mid';
var probe = SncProbe.get("Linux - CPU");
probe.setSource(ipOrHostname);
probe.create(mid);
I see an output and then input appear on the ecc_queue as a result of running this script.
If you don't just know which mid to use, that's a little more work.
var source = 'timserve';
var probe = SncProbe.get("Linux - CPU");
probe.setSource(source);
probe.createForAutoSelectMidServer('Discovery', [{'capability': 'ssh'}], null);
The arguments for createForAutoSelectMidServer() are frankly a little baffling. It's SncProbe.createForAutoSelectMidServer(String application, Object[] capabilities, String sensorECCID).
Application is a mid server application such as "Discovery" or "Orchestration".
Capabilities is an array of objects with a capability and a value, but I always wind up ignoring the value. If you poke at your mid server capabilities, you should be able to find what you need. I needed "ssh" for my probe.
sensorECCID is the sysid of the ecc_queue input we're responding to. Ignore it unless you are responding to another probe, which you're not.
Hope it helps,
- Tim.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2019 10:43 AM
Tim, please update your mid selection code with the code that commented in other place. I figured out how to run the powershell on VMs. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2019 11:21 AM
Thanks for your input Ian. Please let me know if you any other thoughts. My goal is to run the scan against the CI once it created through Script Action. Other way is to get the ip address using VmDeployedEvent which gets me device name and serial number, I don't know if I can pull IP address from vCenter using this event.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2019 06:28 AM
Just curious, what is the use case for wanting to kick off the Discovery by device name vs IP address?
Mary
