Skip to content

Using the Administration Utility

Gurpartap edited this page Mar 18, 2013 · 7 revisions

Cognizant can be administered using the cognizant command line utility. This is an application for performing administration tasks like monitoring, starting, stopping processes or loading configuration and processes' information.

The cognizant utility provides a command line interface as well as a shell to administer processes. It communicates with the daemon process through its command socket.

Here are some basic operational commands for an application named redis-example:

$ cognizant monitor redis --app redis-example # by group name
$ cognizant restart redis-server-7000 --app redis-example # by process name

To get cognizant to ignore a particular process' (or group's) state:

$ cognizant unmonitor sleep --app example

Now check status of all managed processes:

$ cognizant status --app example
+----------------+-------+--------------------------------------+-------+-------+---------+
| Process        | Group | State                                | PID   | % CPU | Memory  |
+----------------+-------+--------------------------------------+-------+-------+---------+
| redis-server-1 | redis | running since 1 minute               | 23442 | 10.70 | 3.7 MB  |
+----------------+-------+--------------------------------------+-------+-------+---------+
| redis-server-2 | redis | running since 2 minutes              | 23444 | 0.0   | 1.7 MB  |
+----------------+-------+--------------------------------------+-------+-------+---------+
| sleep          |       | unmonitored since less than a minute |       | 0.0   | 0 Bytes |
+----------------+-------+--------------------------------------+-------+-------+---------+
2012-11-23 01:16:18 +0530

Available options and commands for cognizant are:

$ cognizant --help
    
NAME
    cognizant - administration utility for cognizantd
    
SYNOPSIS
    cognizant [GLOBAL OPTIONS] COMMAND [ARGUMENTS...]
    
GLOBAL OPTIONS
    -a, --app NAME             The name of the application container (required)
    -s, --sockfile FILE          The socket lock file of the application server (required)
    -v, --version              Print the version number and exit
    -t, --trace                Turn on tracing, enabling full backtrace
        --help                 Show this message
    
COMMANDS
    help [COMMAND]    Shows a list of commands or help for one command
    shell             Enter the Cognizant shell for easy control
    status [NAME]     Display status of managed process(es) or group(s)
    load FILE         Loads the process information from specified Ruby file
    monitor NAME      Monitor the specified process or group
    unmonitor NAME    Unmonitor the specified process or group
    start NAME        Start the specified process or group
    stop NAME         Stop the specified process or group
    restart NAME      Restart the specified process or group
    shutdown          Stop the monitoring daemon without affecting processes