#266

Product support

Visit this product's website for support.

Categories

  • Miscellaneous
  • Utility

Keios Service Monitor is a MIT licensed plugin for OctoberCMS, allowing simple, agentless monitoring of SSH hosts, processes and websites.

Latest updates

With version 1.1.0 we introduce

  • E-mail alerts for admin and to service owners
  • More caching, more speed
  • Logs filter support
  • CheckConfig controller that makes it easy for admin to check if everything is set correctly.

How it works

Plugin uses ssh keys to authorize with added servers and run uname command on them. If command return results, server is marked as online. SSH connections are made using LaravelCollective Remote Library.

Process monitoring is done in a similar way, but instead of uname, either ps or netstat commands are run and grepped to find appropriate command name (and port, in case of netstat).

Websites are monitored using curl requests and websites are marked online if one of the allowed http codes are returned. See documentation for more details.

Component uses ajax requests to update monitored services and browser generic notifications to inform you about status changes.

Requirements

  • Rainlab User

Recommendations

  • Queue setup with Redis or Beanstalkd.
  • For server and processes monitoring, user running app must have SSH key generated and authorized on target hosts.
  • To not make unnecessary load while updating records with scheduler, we strongly advise to use either Redis or Memcached with October running monitoring.

Configuration

After installation, go to Backend -> Monitor -> Check Config. It will display remaining configuration steps.

checkconfig

Configure queues and run queue worker!

Use redis, it's easy to install and configure. It will make app 5 times faster (will push manual checks to background).

Backend -> Settings -> Keios Monitor

  • Enter cron-format schedule strings in first three fields

For example */2 * * * * to run check status jobs every two minutes.

  • Enter path to SSH key that should be used to authorize on monitored servers
  • Enter e-mail, to which warnings should be sent.

Leave it empty if you don't want any admin e-mails, it can be spammy.

Configure user plugin

Components will not work without User being logged in. Configure Rainlab User plugin properly (with Session redirects to login page) or install theme

Configure scheduler

Add cronjob for October scheduler to run every minute. If your october is in /var/www/monitor, it should look as follows:

$ sudo crontab -e

* * * * * /usr/bin/php /var/www/monitor/artisan schedule:run

Read more in OctoberCMS Docs

Boost it!

We advise to install Keios Apparatus plugin for notifications support.

Components

Plugin comes with several components. Components use bootstrap classes to columnize results, you may want to install our simple oc-monitor-theme to gain immediate support for all modules.

theme

keios monitor

keios monitor

  • km_livemonitor - displays enabled services and their statuses in 3 columns
  • km_charts - displays charts for last 24h, 7 days and 30 days
  • km_logwidget - displays last n logs
  • km_authdata - test ssh connection with selected host
  • km_manageservices - add, edit, disable and delete services.
  • km_helper - provides ajax methods for live refresh. put this one in layout.

Usage

Application allows to monitor three types of entities: posix processes, ssh connections and websites.

Administrator has direct access to all entities from the backend. Frontend users have access only to services owned by them.

Server Monitoring

Host you add to monitor will stay "offline" until you authorize your public key on it

Add content of id_rsa.pub from the path configured in settings (or displayed in the frontend theme in Authorization tab) to ~/.ssh/authorized_keys (where ~ is home directory of selected user on the server).

Server can be either added by administrator from backend, or by Users in frontend if:

  • Their server limit is not reached
  • They have permission to create server.

Permissions can be set in Backend -> Users tab.

permissions

Users which are concurently logged into Backend as superuser automatically gain all permissions.

You can test if server is authorized properly using Authorize page of the theme (where km_authdata component allows testing connection). If not working, make sure about {% flash %} messages support in the theme (or Apparatus apparatusFlashMessages component dropped to end of layout).

Process Monitoring

Process belong to servers and are checked on the server you select while creating/editing them.

You can use two modes of checking if process is running: ps and netstat.

First one will run

ps aux|grep -v "grep"|grep -c $processName

on the server, second one will run

netstat -anp|grep $processName|grep -c $processPort

Process ownership works in the same way as in Servers - User must have permissions to manage them or be logged into backend as superuser. If User has permission, it is possible to edit servers and create servers until limit is reached.

All processes will go offline if their server goes offline.

Website monitoring

Website monitoring is done with multi_curl and will report website offline if CURL gets any response different than 200, 201, 301, 302.

Remember that monitor may create false traffic in your Analytics and you should blacklist the monitoring server IP. You can find details on how to do it with Google Analytics here

Permissions and limits for frontend users work the same as with Processes and Servers.

Console commands

php artisan monitor:check-website <url>
php artisan monitor:check-server <host>
php artisan monitor:check-process <name>

these commands will manually run a check. Url, host and name are optional - all entities will be checked if not provided.

You can also run jobs with

php artisan schedule:run

If you are using queues, you will have to either run queue listener or schedule queue:work tasks.

 php artisan queue:work --tries=3 # Will run a job queued
 php artisan queue:listen --timeout=600 # Will listen to jobs and run them

E-mail notifications

  • E-mails to administrator are sent if e-mail is configured in backend settings
  • E-mails to given service owners are sent if user has "enable mailer" set in his profile.

In both cases notifications are sent only for services that have "Enable alerts" option enabled.

  • Found the plugin useful on 23 Dec, 2016

    This plugin doesn't install on the latest build of OctoberCMS. It installs through the plugins but the backend menu doesn't appear at all.

  • author

    Replied on 5 Jan, 2017

    Hello,

    Could you make sure that you have Rainlab.User installed? It's required by this plugin. Fact that it doesn't appear on the backend menu would suggest that the requirement is not met.

    If that doesn't help, please kindly open a ticket on BitBucket repo https://bitbucket.org/keiosdevs/oc-monitor/issues I will gladly provide you further help there.

    Best Regards Jakub / Keios Solutions

1.1.0

Filters

Dec 17, 2016

1.0.11

Mailing to service owners

Dec 17, 2016

1.0.10

Configuration helper controller

Dec 17, 2016

1.0.9

Support for filters in log

Dec 17, 2016

1.0.8

Assign profiles to old users

Dec 17, 2016

1.0.7

Monitor profiles

Dec 17, 2016

1.0.6

Jobs

Dec 16, 2016

1.0.5

Ownership required

Dec 16, 2016

1.0.4

Services ownership

Dec 16, 2016

1.0.2

Logging for charts

Dec 16, 2016

1.0.1

First version of Monitor

Dec 09, 2016