Looker Community

Gazer - A Command Line Tool for Looker Content Management

The Problem

User Defined Content (Dashboards and Looks) are not easily portable across Looker instances, nor can they be backed up and restored to a known state easily. It is not easy to monitor content creation, user activity, etc. In particular, it is not easy to do these activities from scripts that can be run by an operations team.

The Why

Gazer is a command line tool that provides an interface to a Looker instance for the purpose of managing content, users, schedules, etc. It can be used interactively, but also be included in scripts. Finally, it serves as a reference implementation for developers that want to build their own tools.

The How

Gazer currently has 11 commands. The most common commands are user, space, dashboard, look, and plan. Each command has several subcommands tailored for that command. The ls subcommand is very common and will produce a list of objects. The cat subcommand is also common, and will provide the json representation of an object. Typing gzr alone will list all the commands as well as the most common command line switches and options. Typing gzr COMMAND will list the subcommands for that particular command.

The user subcommands are ls, me, cat, enable, disable, and delete. So typing gzr user ls will list all the users on a Looker instance. Typing gzr user disable will disable the given user.

The space subcommands are ls, cat, tree, rm, create, and export. Typing gzr space ls will list the contents of a space. Typing gzr space export will create a set of files that describe the space, all its subspaces, and all the dashboards and looks in those spaces. They can be exported as a set of folders and files on disk suitable for storing in a code repository, or they can be exported into a tar or tgz export file. If they are stored in a code repository, it is easy to track changes over time.

The look and dashboard subcommands are cat, import, and rm. The cat subcommand can be used to save a single dashboard or look to a file. Typing gzr look import will load a look from a file. Typing gzr dashboard import will import a dashboard from a file. The file for the import subcommand can be obtained from the cat subcommand, or from the gzr space export command.

The plan subcommand is used to manage schedules. There are many subcommands, but typing gzr plan failures will list schedules that did not run properly, and gzr plan runit will rerun it.

More information and examples can be found at https://github.com/deangelo-llooker/gzr/wiki

The Setup

Gazer is deployed using the Ruby Gems distribution system. To install, make sure that Ruby 2.3 is installed on your system, then use the command gem install gazer.

This tool is open source. It is not supported by Looker’s normal support channels. It may be possible to purchase support from Looker’s Professional Services team. We are hoping that a community will grow around this tool, however, and support/enhance it further. Issues can be logged at https://github.com/deangelo-llooker/gzr/issues.

*Gazer is developed by Mike DeAngelo aka @MikeD *

9 Likes

@MikeD what a great idea! Thanks for doing this. Can Gazer be used to identify broken Looks or dashboard tiles like the content validator does?

Not at the moment, Levi. But I will look into adding that!

Hello Mike

We are facing an issue while installing on EC2 .

[ec2-user@ip-10-69-1-20 ~]$ sudo gem install gazer
ERROR: While executing gem … (Gem::DependencyError)
Unable to resolve dependencies: tty-table requires equatable (~> 0.5.0); pastel requires equatable (~> 0.6)

Do you have any solution for the above problem ?

Thanks
Karthikeya

it’s resolved you can ignore.

Hi Mike,

I have a Mac (Version 10.14.5 (18F203)) with gem version 2.5.2.3, ruby version 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18] and when I issue the command:

gem install gazer

I get this:

ERROR:  Could not find a valid gem 'looker-sdk-fork' (~> 0.0.6) in any repository
ERROR:  Possible alternatives: looker-sdk

How can I fix this?

I think that error is just a bit confusing, and what it really wants is any kind of looker-sdk.
If you install the “Possible Alternative” with gem install looker-sdk and then install gazer, you should be in business.

Thanks for pointers - it all works now.

Awesome tool!

I’ve encountered an issue using it on a dashboard that has tiles containing Merged results. Are Merged Results supposed to be supported by the tool, or is this a bug?

I’ve raised an issue on Github with the details.

AFAIK there still isn’t a merge_query api endpoint so I would imagine that’s a known limitation. I’m a :goat:! The merge query API is totally out.

I think github is probably the best place to raise the issue. Thanks Martin.