moog-snow-catalog v1.0.8
Moogsoft ServiceNow CMDB table to Catalog Upload Utility
moog-snow-catalog is a utility intended to export a CMDB table as CSV, and upload as a catalog to Moogsoft Cloud.
The utility:
- Queries the ServiceNow Table API to extract CIs (with fields being user defined)
- Save the table locally as a CSV file
- Deletes any existing catalog with the same name
- Uploads the CSV file as a Moogsoft data enrichment catalog
Installation
Prerequisites
moog-snow-catalog is a Node.js utility and requires Node.js to be installed, available here
Install the moog-snow-catalog
CLI utility
Install the node module.
$ npm install moog-snow-catalog
Link to create a command line utility.
$ npm link moog-snow-catalog
Depending on your computer/OS, you may need to close, and re-open your shell to update your environment to execute the commands.
The utility reads configuration from a local configuration file (msc-config.yaml by default, see example) use the init option to create a template in your current working directory.
$ moog-snow-catalog --init
Edit the config file to use your Moogsoft
apiKey
and specify your ServiceNow URL and credentials. Also this file is used to customize the table, and fields that will be extracted. This is a YAML file, so the correct indentation must be preserved.
The config file
---
moog:
apiKey: 'foo-bar-0123434-ahdgefwvbs14535'
snow:
hostname: 'mysnow.service-now.com'
username: 'admin'
password: 'foobar'
cmdb_table: 'cmdb_ci'
sysparm_fields:
- name
- support_group
- sys_class_name
Where:
moog.apiKey
: Moogsoft API keysnow.hostname
: The hostname (from URI) of your ServiceNow instancesnow.username
: The username used for a basic auth API requestsnow.password
: The password used for a basic auth API requestsnow.cmdb_table
: The cmdb table to be queriedsnow.sysparm_fields
: A list of fields to be extracted from the table
Usage
moog-snow-catalog [-i] [-d] [-l debug] [-c config_file] [-h]
--init: Create a template config file (./msc-config.yaml)
--dryrun: Query ServiceNow, create a CSV file, but don't upload it to Moogsoft or delete a catalog
--loglevel debug: Be more verbose
--conf config_file: Specify an alternative config file (default is ./msc-config.yaml)
--help: The usage message
Examples
Run the utility
$ moog-snow-catalog
Query the ServiceNow table API, and create a CSV file with the defined fields. This is a great first step
$ moog-snow-catalog -d
Get more detail - Useful for debugging issues
$ moog-snow-catalog -l debug