This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Automated creation of NPM server nodes including specific node resources

I have a PS script that utilizes both the SDK and the Internet Explorer PS Object.  The script does the following:

Script Input Arguments:  Script Action (Currently just adds, but in the future it would delete, modify custom props, etc...), Node Name, Node's IP Address, Orion Poller name, server profile csv file (contains the custom properties to populate).  Powershell syntax:

Script Requirements: 

  • Discovery profile to be used by the script only.  The profile should include the SNMP strings required to add an SNMP node. Currently this is hard coded in the script.
  • csv File that contains custom property names as headers and the property values.  The custom property fields need to already exist.  You can modify the script fairly easily to read in your custom props.
  • (optional) a logfile name/path hard coded in the script that outputs script process and actions.
  • Internet Explorer browser (tested on v8 and v9)
  • I have not tested this on an NPM SSL website.

Script Syntax: <script name> add <node (server) name> <node IP Address> <Orion Poller Name> <server Profile Name>

Script Process Overview:

  • Prompts for SW credentials - Can be modified to use specific credentials without prompting.
  • Reads in arguments
  • Connects to Orion instance on the poller name specified.
  • Reads the custom properties from the csv file into a hash table
  • Starts discovery process
    • Modifies the discovery profile (currently coded in the script) and changes the discovery scope to only scan the IP address of the node (using the node's IP address argument)
    • logs into website using previously supplied credentials
    • Starts running the discovery scan using the modified discovery profile.
    • Adds the discovered node including it's resources found during the discovery.
    • Verifies the node has been added.
  • Updates the node's custom properties with the values from the csv file.
  • Removes specific node resources.  (I used this to remove the many virtual adapters found on Windows 2008 servers), but can be modified to remove other node resources as well.

 I don't want to post the script yet because I would like it to be more scripter friendly, but contact me if you are interested.

Chris

  • That's, cool, Chris! Thanks for sharing!

    If you don't mind, I'd like to understand the set of things you needed to drive the website for so I can take them as feature requests for the API. Here's what I'm guessing:

    1. To modify the discovery profile.
    2. To start the discovery.
    3. To import the discovered node once the discovery completes.

    Is that the right list?

  • Chris,

    Yes, very interested.  Our SW environment allows many people to enter in new devices and there is a good degree of user error, mainly because custom properties allow non-validated entries and the 2008 machines drive me crazy with the amount of unneeded adapters.  If I could shoot someone a script to inject some variables (that could be validated with some modification on my part), it would be awesome.  I wouldn't mind checking it out and testing it.

     

    Thanks!

  • That's, cool, Chris! Thanks for sharing!

    If you don't mind, I'd like to understand the set of things you needed to drive the website for so I can take them as feature requests for the API. Here's what I'm guessing:

     

    1. To modify the discovery profile.
    2. To start the discovery.
    3. To import the discovered node once the discovery completes.

     Is that the right list?

    That's correct.  I manually set the discovery profile to a generic IP address not being used (10.0.0.1) for example.  The script looks for that IP address in the xml field (since you guys removed the start/end IP address columns :).  It then modifies it to the IP address of the server being added.  After the discovery has finished, it changes it back to the generic IP.

    The discovery profile is only used by the script, so the settings won't be inadvertently changed and is set to not discover VMWare.

    I wasn't able to do it using the SDK, because I don't know the specifics of the node resources, and automating a discovery seemed the best way to do this. 

    Also, not sure if I mentioned this but the script doesn't have to be executed from an Orion server.  I installed the SDK on my laptop and am running it from there.

    Let me know if you have any questions, or if you would like a copy of the script!

    Chris

  • FormerMember
    0 FormerMember

    Hi Chris

     

    I would be keen to have a look at your script, please could you send it to me

     

    Thanks

    James

  • FormerMember
    0 FormerMember

    I would like to get a copy of your script.

     

    -Mark

  • I would like to recieve a copy of this also! It sounds like you have a great start to something that could be quite useful to me. We have an automated sync to an external inventory source setup that updates the custom properties but I would like to be able to automate discoveries and resource addition and filtering in conjuntion with the inventory sync to ensure our monitoring is up to date with inventory.

    Thanks in advance.

  • I would like to get a copy of your script.

    -Ed

  • I would also be very interested in this script and would appreciate a copy. I've been tasked with outomating our server build process and this would fall right in line with that!

    Thanks!

  • Can anyone in this chain send me a copy as well? Specifically the Internet Explorer component to automate the running of the Discovery Job.

    Thanks!

    -Ben

  • Can you please share the script? Working on a similar scenario. So the script would be of great help.

    Thanks in advance,

    Tanya