...
Introduction
The purpose of this article is how to export and import dashboards, maps, and charts from an old server
...
running opCharts and migrate to a new server.
...
Reviewing your dashboards, charts, or maps
...
:
You can use the opcharts-cli.pl tool. This is located in /usr/local/omk/bin.
Some examples below for listing views:
Code Block |
---|
/usr/local/omk/bin/opcharts-cli.pl act=list-dashboards |
...
/usr/local/omk/bin/opcharts-cli.pl act=list-charts |
...
/usr/local/omk/bin/opcharts-cli.pl act=list-maps |
...
As well as:
Code Block |
---|
cd /usr/local/omk/bin/ |
...
./opcharts-cli.pl act=list-dashboards |
...
./opcharts-cli.pl act=list-charts |
...
./opcharts-cli.pl act=list-maps |
...
For a full list of available operations, we can run opcharts-cli.pl on its own, for example /usr/local/omk/bin/opcharts-cli.pl
...
./opcharts-cli.pl
...
.
Code Block |
---|
Usage: opcharts-cli.pl act=[action to take] [options...]
opcharts-cli.pl act=list-{charts|maps|dashboards|business|pollers|collectors|enterprise}
opcharts-cli.pl act=delete-{charts|maps|dashboards|business|pollers|collectors|enterprise} [name=A name=B...]
opcharts-cli.pl act=export-{charts|maps|dashboards|business|pollers|collectors|enterprise} [name=A name=B...] [file=path]
file: save JSON to file, otherwise printed to STDOUT.
name: list of resource names to export. defaults to all resources.
opcharts-cli.pl act=import-{charts|maps|dashboards|business|pollers|collector|enterprise} [name=A name=B...] [file=path] [force=true]
file: read JSON from file, otherwise read from STDIN
name: list of resource names to import. defaults to all resources.
force: if true will force the import to happen, replacing existing entries if they exist with the same name
opcharts-cli.pl act=import-subnets [force=true]
caches the subnets
opcharts-cli.pl act=clear-subnets
clears the subnet cache
opcharts-cli.pl act=import-user-dashboard name=dashboard-name users='user1, user2, ...'
change the default dashboard for a list of users
opcharts-cli.pl act=clear-all-node-depend
clear all node depend (subnet)
opcharts-cli.pl act=update-subnet-dependency
Update all nodes dependencies
opcharts-cli.pl act=setup-db
Sets up opCharts required indexes for MongoDB
opcharts-cli.pl act=enrich-business-services
Enrich data for each business service to make fields sortable
opcharts-cli.pl act={add|delete}-enterprise-service-object name="Enterprise Service Name" [type=node|interface|monitored_service] [node_uuid=A] [index=1] [monitored_service_name=A]
Add or delete a node, interface or monitored service from an existing enterprise service.
opcharts-cli.pl act=migrate-business-service [name=A] [rename=B]
Creates an enterprise service from a business service, if the migrated name conflicts you can pass 'rename=example' to give the enterprise service a new name.
options:
info=true: print informational output
debug=true: print diagnostic output |
Exporting dashboards, maps, and charts to a file (Export All Files)
Code Block |
---|
/usr/local/omk/bin/opcharts-cli.pl act=export-maps file=/tmp/ |
...
maps.json |
...
/usr/local/omk/bin/opcharts-cli.pl act=export-dashboards file=/tmp/dashboards.json |
...
/usr/local/omk/bin/opcharts-cli.pl act=export-charts file=/tmp/charts.json |
Use an FTP application of your preference to copy the files
Instead of using an FTP application, you can use the SCP Linux command on SSH with the IP address of your destination:
scp dashboards.json omkadmin@192.168.0.85:/tmp/
scp charts.json omkadmin@192.168.0.85:/tmp/
scp mpas.json omkadmin@192.168.0.85:/tmp/
...
You can then either use a SFTP application of choice to download these from the NMIS server to your local machine, or use SCP to copy direct from the CLI.
If you only require exporting a single view, you can instead add the name=My_Dashboard argument to the command:
Code Block |
---|
/usr/local/omk/bin/opcharts-cli.pl act=export-dashboards name=My_Dashboard file=/tmp/my_dashboard.json |
Importing dashboards, maps, and charts from a file
Code Block |
---|
/usr/local/omk/bin/opcharts-cli.pl act=import-maps file=/tmp/mpas.json |
...
/usr/local/omk/bin/opcharts-cli.pl act=import-dashboards file=/tmp/dashboards.json |
...
/usr/local/omk/bin/opcharts-cli.pl act=import-charts file=/tmp/charts.json |
...
After you import the dashboards/charts/maps
...
OPTIONAL: Export the specific dashboard, maps, and charts name.
In this example, the dashboard name is Road to Madness.
/usr/local/omk/bin/opcharts-cli.pl act=export-dashboards name="Road to Madness" file=/tmp/road_to_madness_dashboard.json
...
this will then be displayed in the relevant section of the opCharts GUI.