Package: overc
OverCOverC (pronounced: oversee): simplistic monitoring solution that is a
pleasure to use.Features:Simplicity is the root of all genius: easy to configure and useDynamic and extensible: everything is a plugin, in any scripting
languageAgent-less: data is pushed to OverC serverTable of ContentsInstallationOverclientOverC ServerQuickstart with DockerSending DataJSON ProtocolPingReporting ServicesReporting AlertsOvercliSimple CommandsContinuous MonitoringAutorun MonitorOverC ServerServer InstallationUbuntuServer ConfigurationInstallationOverclientThis tiny app with no dependencies is used to push information to OverC
server:$ sudo pip install overcOverC ServerReceives information about running services through JSON API, and
provides a user interface:$ sudo install overc[server]Then you deploy it as a WSGI application, usingoverc.wsgi.appas
the entry point. Please refer toServer
Intallationmanual.OverC server uses configuration file in INI format. More details are
given inServer Configuration.Quickstart with DockerIf you’re lazy to set it up, there’s a Docker container ready for you :)$ docker start overc-db || docker run --name="overc-db" -d -e MYSQL_ROOT_PASSWORD='root' -e MYSQL_DATABASE='overc' -e MYSQL_USER='overc' -e MYSQL_PASSWORD='overc' -e MYSQL_SET_KEYBUF=32M kolypto/mysql
$ docker start overc-server || docker run --name="overc-server" -d --link overc-db:db -e OVERC_DB_LINK=DB_PORT_3306 -p 5000:80 kolypto/overc-serverNow you have a full-featured OverC server running on port5000!Container description is available inmisc/docker/overc-server.Sending DataJSON ProtocolOverC uses an extremely simple JSON protocol to report arbitrary
monitoring data. You can use the API as you like, but there also is acommand-line overcli toolavailable which offers a
complete solution.In general, the following HTTP codes can be sent in response:In response, you get one of the following HTTP codes:200: success400: malformed request (e.g. not enough data provided)403: authentication failed (e.g. wrong server key)PingChecks whether the connection works fine:{"server":{"name":"localhost","key":"1234"}}In addition to connection-checking, it also tests server authentication.
Proceed to the next section for more information.Reporting ServicesOverC does not connect to anything: all data should be POSTed to it as
JSON to/api/set/service/status:{"server":{"name":"localhost","key":"1234"},"period":60,"services":[{"name":"application","state":"OK","info":"up 32h"},{"name":"cpu","state":"OK","info":"28% load"},{"name":"queue","state":"OK","info":"3 items"},]}Keys explained:"server"is theServeridentification.Whenever a Server reports for the first time, OverC remembers it and
stores its name and access key. Subsequent connections are only
authorized if the same server key is used.You can provide any name/key pair for the server identification: the
server is automatically registered at OverC. Just make sure you keep
using the same identification pair: if you try to send a key that’s
different from the one that was used initially, you’ll get an403 Forbiddenerror in response."period"is the reporting period in seconds the server promises
to keep.If any of the services do not report within the declared period – an
alert is raised."services"is the list ofServicesand their currentStates.Each Service has a"name"which should not be changed.For each Service, the current State is reported:"state"is a
string which supports one of the following values:"OK": service runs fine"WARN": warning condition"ERR": critical error condition"UNK": unknown, which probably means that its state cannot be
retrieved.Any other string is converted to"UNK".Any additional information can be reported with"info": arbitrary
string with runtime data.Finally, a different period can be specified per service using the"period"key.Note that there’s no need to explicitly define Servers and Services: all
data is accepted automatically.Reporting AlertsIt’s possible to send alerts directly by pushing JSON object to/api/set/alerts:{"server":{"name":"localhost","key":"1234"},"alerts":[{"message":"System down"},{"message":"System down"},{"message":"Cannot check state for service A","service":"queue"},]}If you want to alert about something happened with a particular service,
use the “service” key to specify its name.Keys explained:"server"is theServeridentification."alerts"is the list of alerts you’d like to report"message": alert message text"service": (optional) service name to report the alert for, if
any.OvercliSimple CommandsOverC comes with a command-line client utility which allows to interact
with OverC server.Two main arguments are:-s,--server: OverC Server URL. Example:http://localhost:5000/-i,--server-id: Server identification,<server-name>:<server-key>. Example: ‘localhost:1234’.Identification pair is arbitrary, just keep using the same key.This way, most commands are invoked like this:$ overcli -s 'http://localhost:5000' -i 'localhost:1234' <command-name> [arguments...]Example: usepingto test the connection:$ overcli -s 'http://localhost:5000' -i 'localhost:1234' pingExample: report single service’s state:$ overcli -s 'http://localhost:5000' -i 'localhost:1234' service-status 60 'app' 'OK' 'Runs fine'Example: report a single alert:$ overcli -s 'http://localhost:5000' -i 'localhost:1234' alert "Something bad has happened"Continuous MonitoringThe tools described above are just thin wrappers around the HTTP JSON
client and are probably not enough for real monitoring challenges. Usingovercli, you can set up continuous monitoring for your services
using simple scripts.First, create the configuration file (anywhere):[overc]server=http://user:password@mon.example.com:5000/my-name=a.example.commy-key=1234[service:app]period=5command=./plugin.d/app.sh[service:que]period=10max-lag=3command=./plugin.d/que.sh[service:cpu]period=10command=./plugin.d/cpu.sh[service:echo]period=5command=echo 1Section[overc]specifies generic settings:server: URL to OverC Servermy-name,my-key: This server identification, name and key.Section[service:<name>]defines a service to be monitored and
reportedperiodis the time period in seconds defining how often the
service status should be reportedmax-lag(optional) - specifies the maximum time in seconds the
command is known to lag. Scheduler takes this value into
consideration so each command manages to report in time. If not
specified – command exec time is measured manually.command– an arbitrary command that tests your service:
monitoring plugin.The command should be a script which prints out the service info,
and its return code defines the status:CodeStatus0OK1WARN2FAIL>= 3UNKAny other code is also converted to"UNK".NOTE: This actually followsNagios Plugin
API, so
they are reusable! :)Having this config file, just launch the monitor:$ overcli -s 'http://localhost:5000' -i 'localhost:1234' monitor config.iniAll service states will be updated immediately, and continuously
monitored ever since. Any fatal exceptions are reported as alerts to the
monitoring server.For the sake of completeness, here’s an example plugin which simply
checks whether a process is running:#! /usr/bin/env bashapplicaton_name="$1"# Try to get PID of the running application, or die with code 2 ("FAIL")application_pid=$(pidof$applicaton_name)||{echo'Not running!';exit2}# Running fine: print PID, exit with 0 ("OK")echo"PID:$application_pid"exit0Then use it like this:command=./plugin.d/pid-check.sh "httpd"Autorun MonitorOkay, we know how to launch the monitor, but we want it to run
continuously.There are multiple ways to do so:Supervisor.If you’re already using this awesome process manager, just putthis
config filein/etc/supervisor/conf.d/.upstart.With Ubuntu, you might like theupstart
script: just put it in/etc/init/.It automatically lists all/etc/overc/monitor*.inifiles and launch
a separate monitoring for each file!OverC ServerServer InstallationOverC Server is a WSGI application, and requires a WSGI application
server to run. More info:Flask: Starting your app with
uwsgiuwsgi: Quickstart for Python/WSGI
applicationsIt requires a MySQL database, make sure you set it up. You don’t need to
crate any tables: OverC does this for you.Finally, OverC uses a configuration file in INI format: seeServer
ConfigurationUbuntuQuickstart guide for Ubuntu:$ sudo apt-get install nginx-full uwsgiPut uwsgi application config in/etc/uwsgi/apps-available/overc.yml,
and symlink it to/etc/uwsgi/apps-enabled/overc.yml:uwsgi:autoload:yesplugin:pythonuid:www-datagid:www-datachdir:/etc/overc/module:overc.wsgicallable:appThen, configure nginx to/etc/nginx/sites-available/overc.conf, and
symlink it to/etc/nginx/sites-enabled/overc.conf:upstream overc {
    server unix:///var/run/uwsgi/app/overc/socket;
}

server {
    listen 80;
    server_name localhost;

    root /var/www;

    access_log /var/log/nginx/overc.access.log combined;
    error_log  /var/log/nginx/overc.error.log;

    # Statics
    location /ui/static {
        alias /usr/local/lib/python2.7/dist-packages/overc/src/bps/ui/static;
    }

    location / {
        include uwsgi_params;
        uwsgi_pass overc;
    }
}And restart services:$ sudo service nginx restart
$ sudo service uwsgi restartOverC requires a MySQL database to run, so make sure you set it up as
well:$ sudo apt-get install mysql-server mysql-client
$ echo "CREATE DATABASE IF NOT EXISTS \`overc\` CHARACTER SET utf8 COLLATE utf8_general_ci;" | mysql
$ echo "GRANT ALL ON \`overc\`.* to 'overc'@'%' IDENTIFIED BY 'overc';" | mysqlServer Configuration