14 Replies Latest reply: Feb 19, 2014 4:28 PM by lfcowart RSS

Automated creation of NPM server nodes including specific node resources

chrisaustin

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