0.0.1 • Published 9 years ago

mops-cli v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

MOPS

MOPS Mascot

A command-line interface for performing MongoDB Cloud Manager | Ops Manager tasks through their Public API.

Benefits

  • Easily do things from the terminal that are available to the UI and API.
  • Quickly add new commands to automate things you'd like.
  • Quickly move data back and forth between Cloud Manager an Ops Manager.
  • Run custom analytics on permformance metrics data in Excel, R, etc.
  • Leverages node-mms-client JS API wrapper, a Node wrapper around the public API.

Installation

You can install the mops-cli npm package directly.

npm install -g mops-cli

Commands

The core mops commands are documented below.

configure

configure login

mops configure login -h HOSTNAME -p PORT -u USERNAME -a APIKEY

Set user credentials for MongoDB Cloud Manager | Ops Manager

OptionsDescriptionDefault
-h, --host hostThe API endpoint hostnamecloud.mongodb.com
-p, --port portThe API endpoint port443
-P, --protocol protocolThe API endpoint protocolhttps
-u, --user userEmail address or username accessing the API
-a, --apiKey apiKeyThe specified user's API key

configure defaults

mops configure defaults -g GROUPID

Set defaults to prevent always specifying options on the command line.

OptionsDescriptionDefault
-g, --groupId groupIdGroup identifier

groups

groups list

mops groups list

Display all current groups (JSON)

groups delete

mops groups delete -n GROUPNAME

Create new alert configurations

OptionsDescriptionDefault
-n, --name nameGroup name

groups create

mops groups create -n GROUPNAME

hosts

hosts list

mops hosts list -g GROUPID

Display all current hosts (JSON)

OptionsDescriptionDefault
-g, --groupId groupIdGroup identifier

metrics

metrics csv

mops metrics csv -g GROUPID -h HOSTID

Export all metrics for the specified host in CSV format

OptionsDescriptionDefault
-g, --groupId groupIdGroup identifier
-h, --hostId hostIdHost identifier
-G, --granularity granularityGranularityMINUTE
-P, --period periodPeriodP1DT24H

alertConfigs

alertConfigs list

mops alertConfigs list -g GROUPID

Display all current alert configurations (JSON)

OptionsDescriptionDefault
-g, --groupId groupIdGroup identifier

alertConfigs create

mops alertConfigs create -g GROUPID -f myAlerts.json

Create new alert configurations

OptionsDescriptionDefault
-g, --groupId groupIdGroup identifier
-f, --file filenameJSON file of alert configs

alertConfigs edit

mops alertConfigs edit -g GROUPID -i ALERTCONFIGID

Edit specified alertConfig in your text editor

OptionsDescriptionDefault
-g, --groupId groupIdGroup identifier
-i, --alertConfigId alertConfigIdAlert Configuration identifier

automationConfig

automationConfig edit

mops automationConfig edit -g GROUPID

Edit the current automationConfig in your text editor

OptionsDescriptionDefault
-g, --groupId groupIdGroup identifier

Example Workflows

Copying alerts configuration from one group to another

mops alertConfigs list -g GROUPID > myAlerts.json

mops alertConfigs create -g GROUPID -f myAlerts.json

Note: You can do a mops configure login between these two commands to change username, API key, even hosts (i.e., move from Cloud Manager to Ops Manager)

Exporting host metrics into CSV format (for Excel, R, etc.)

Run mops host list to get a list of all the host IDs in your group. Then run mops metrics csv -g GROUPID -h HOSTID > hostMetrics.csv to put all that host's metrics into a CSV file.

License

Licensed under the MIT license.

Contributors

Shout Outs

mops-cli is a MongoDB Skunkworks Project

Friendly Skunk