Target Audience:
This series of articles is aimed at customers who administer iQSonar version 4 installations. The examples will be based on duplicating results which were available as database views / reports available in the version 3 of iQSonar, but using the V4 RestAPI to derive the information. Users should be familiar with PowerShell. The outputs of these scripts will be saved as CSV files. In a customer environment it might be expected to export data selected directly to another database or reporting tool rather than using CSV as an intermediate transfer format.
For these worked examples, we will use PowerShell scripting tools, as PowerShell is installed as part of Windows Server 2012 and Windows Server 2016 without any additional prerequisites or requirements other than the base operating system. It should be noted that other scripting languages or even compiled languages can also be used to interact with the RestAPI. In the introductory RestAPI series, some of the worked examples are given in PHP and Python as well as in PowerShell.
Note that, as these are longer scripts with slightly more complex logic than the initial tutorial scripts they are expected to either be used "as is" with only the user/password/server updated for the customer environment, or used as the basis upon which the customer's own developers can build custom scripts in PowerShell or other scripting languages. It is not expected that anyone other than a developer would make substantial changes to these scripts.
Pre-requisites:
In order to use these scripts in your environment, you will need
- An instance of iQSonar v4 with the RestAPI integration installed. (This is installed by default, but can be turned off)
- An iQSonar user with permission to access the RestAPI, and the password for this user.
- A windows computer on which you have permission to run PowerShell, and for some of the examples, the facility to install additional PowerShell modules from Microsoft. The PowerShell scripts can be run from the server or from your workstation (Windows 7, Windows 8 and Windows 10 should all work).
Worked Examples
These examples are derived using the RestAPI as it was deployed with the Gwynn R3 release of iQSonar. The YAML specification of the RestAPI endpoints (including which fields are available, and which fields are required (therefore always present) or optional (therefore not always present) in a given endpoint can be accessed using the RestAPI Endpoint /api/v1/yaml
- OutputDevices - the OutputDevices report in V3 of iQSonar returns core information on all scanned devices and the associated virtualization information.
- OutputApplications - the OuputApplications report in V3 of iQSonar returns information on the scanned enterprise applications and the hosts they are running on.