Network Scanning Integration for Samanage

Document created by Administrator on Jan 17, 2017Last modified by Jason Yeary on Feb 5, 2018
Version 4Show Document
  • View in full screen mode

Use Case

Enhance the Samanage IT asset management solution to collect inventory of networked assets across your network, and manage these assets through the Samanage application.


Using NMAP for network scanning

The following solution is using the popular open source NMAP tool to scan your network and detect any networked device, and collect their information. NMAP is a very popular and robust network scanning open source solution that is actively maintained by the community. NMAP runs on Windows or Unix.


How does it work?

The code example is available on GitHub as a ruby script that:

  1. Invokes the NMAP tool to collect the network inventory
  2. Parses the output from the NMAP tool
  3. Upload the parsed information to Samanage using the Samanage API.
  4. Create a report of all assets collected that were not imported automatically along with the reason.

It is recommend to run the code below periodically to detect new devices on your network and load them into Samanage.


To use the tool, follow this steps:

  • Add a new custom field called "MacAddress" to your Other Asset object via the setup section in Samanage. The tool will populate this field with the MacAddress of the collected devices.

  • Create additional Asset Types in your Other Asset module. If the appropriate asset type does not exist when the tool runs, an error message will be displayed and that asset will not get into your inventory. Typical types that you will want to add are: ‘general purpose’, ‘Unknown’, ‘VoIP Phone’.

  • Edit the sample code to provide your subnet prefix - for example 192.168.*.*. that means that the entire subnet of 192.168 will be scanned. You can provide multiple subnet ranges by separating them via commas.

  • Edit the Samanage API gem to provide your user/password that is used for API access. This user should have the permission to create new assets in Other Assets.

  • Run the samanage-network-scanner.rb file in the command prompt or terminal.
    • Please note that ruby needs to be installed first, download here;
    • Change your directory to the folder where the scripts are stored;
    • ruby samanage-network-scanner.rb API_TOKEN

1 person found this helpful