Skip to content

Starting the Monitoring Daemon

Gurpartap edited this page Mar 18, 2013 · 10 revisions

Cognizant runs the monitoring and automation (conditions) essentials through the cognizantd daemon application, which also maintains a command socket for accepting instructions from the cognizant administration utility. It starts with a run loop, polling the managed processes for their state and properties.

With its default options, cognizantd requires superuser certain features and to access to certain system directories for storing its logs and pid file. It can be started as follows:

$ sudo cognizantd    # On ubuntu, debian, os x, etc.
$ su -c 'cognizantd' # On amazon linux, centos, rhel, etc.

To start without superuser access, specify these file and directory config variables to where the user starting it has write access:

$ cognizantd ./examples/cognizantd.yml # YAML formatted.
# Find this file in source code for a detailed usage example.

Assuming

$ cat ./examples/cognizantd.yml # gives:
---
sockfile: ~/.cognizant/cognizantd.sock
pidfile: ~/.cognizant/cognizantd.pid
logfile: ~/.cognizant/cognizantd.log

applications: {
  example: {
    pids_dir: ~/.cognizant/example/pids/,
    logs_dir: ~/.cognizant/example/logs/,
    processes: {
      ...
    }
  }
}

Or

# Pass config directly into the daemon's STDIN.
$ echo <<EOF | cognizantd -
---
sockfile: ~/.cognizant/cognizantd.sock
pidfile: ~/.cognizant/cognizantd.pid
logfile: ~/.cognizant/cognizantd.log
...
EOF

Available options and commands for cognizantd are:

$ cognizantd --help
    
NAME
    cognizantd - system utility daemon to supervise your processes

SYNOPSIS:
    cognizantd [GLOBAL OPTIONS] [CONFIG FILE | -]

GLOBAL OPTIONS:
        --[no-]daemonize        Whether or not to daemonize cognizantd into background.
        --sockfile FILE         The socket lock file of the command server.
        --pidfile FILE          The pid (process identifier) lock file for the daemon.
        --syslog                Log the daemon's operational information into syslog.
        --logfile FILE          Log the daemon's operational information into a file.
        --loglevel LEVEL        The level of information to log.
    -t, --trace                 Turn on tracing, enable full backtrace.
    -v, --version               Print the version number and exit.