The Zegami Command Line Interface (CLI) allows administrators to manage Zegami server, collections and users.

The Zegami CLI can be executed from the command line and the –help (or -h) option can be used on any command to find out more.

Command Line Interface

Basic Usage

In general the Zegami CLI is used by selecting the resource, then an action for the resource. Before using the client, switch to the zegami user and the zegami base directory.

$ sudo su zegami
$ cd /opt/zegami
$ python ./zegami.pyc <resource> <action> [parameters]

Starting the Server

Zegami comes built in with a simple web server. To start it run

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc server start

Creating a Collection

Collections can be created via the CLI. For a step-by-step see our tutorial on creating a collection.

The default arguments for creating a collection are the collection name, path to the data source conf file and path to the image source conf file.

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc collections create test datasource.conf imagesource.conf

The following optonal arguments can also be used

--dataSource

The data source plugin to use. Out-of-the-box the following data source plugins are available: CSVDataSource (default) – used to process Comma and Tab delimited data files ODBCDataSource – collection based on an SQL query

--imageSource

The image source plugin to use. Out-of-the-box the following image source plugins are available: FilesystemImageSource – use images located in a directory that the server has access to. ODBCImageSource - images stored as blobs in an RDMS. * S3ImageSource (beta) - images stored in an Amazon Web Services Simple Storage Service (S3) bucket.

--tileSize

The size of the Deep Zoom tile. The default is 256.

--collectionId

If the optional collection id is specified then it will update the parameters for an existing collection.

The following is an example of using the explicit parameters:

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc collections create test --dataSource ODBCDataSource --imageSource FilesystemImageSource /zegami/datasource.conf /zegami/imagesource.conf

Example of how to update the parameters of an existing collection:

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc collections create --collectionId 556eb6b05f1c37459b3ac5ff test /zegami/datasource.conf /zegami/imagesource.conf

List all Collections

Listing all avaliable collections

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc collections list

Process a Collection

Process a collection by id, where 556eb6b05f1c37459b3ac5ff is the collection id.

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc collections process 556eb6b05f1c37459b3ac5ff

Remove a Collection

Remove (delete) a collection by id, where 556eb6b05f1c37459b3ac5ff is the collection id

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc collections remove 556eb6b05f1c37459b3ac5ff

Create a User

There are two options for creating a user - using the optional arguments or in interactive mode.

Users created via the CLI are automatically assinged the Administrator role. A users role can be changed using the modify command.

Interactive mode is triggered by calling users create without any arguments. You will then be prompted to enter the users details:

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc users create

Username: user1 First Name: User Last Name: One E-mail: user@company.com Password: Re-enter Password:

User successfully created

Alternatively the following arguments can be used:

--username

The username of the new user.

--password

The password

--first

The first name of the user

--last

The users last name

--email

The email address

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc users create --username user1 --password password --first User --last One --email user@company.com

List Users

List all users

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc users list

Modify a Users Role

Modify an existing users Role.

The default arguments for modifying a user is the username followed by the new Role.

Possible Role values are: user – read only access to public collections. manager – can create new collections and edit collections created by the user. * admin – can create and manage all collections. Can manage server configuration and users.

The following example will put user1 in the user role.

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc users modify user1 user

Delete a User

Deletes a user by username.

The follwoing example will delete user1.

$ sudo su zegami
$ cd /opt/zegami
$ python bin/zegami.pyc users delete user1

View Server Logs

The following example will display latest 50 server log entries.

python bin/zegami.pyc tail logs

View Web Logs

The following example will display latest 50 web log entries.

python bin/zegami.pyc tail weblogs

Search logs

Serach for logs by specific level by adding optional argument -l LEVEL or --level LEVEL Level of logs to look for - could be "DEBUG", "INFO", "WARNING", "CRITICAL", "ERROR".

The following example will search logs with level ERROR.

python bin/zegami.pyc tail logs --level ERROR

Use optional argument -timestamp TIMESTAMP, --timestamp TIMESTAMP.

The following example will search logs before the specified timestamp.

python bin/zegami.pyc tail logs --timestamp "2017-04-13 13:06:12,345"