vcl-utils

A simple tool to monitor an Apache VCL infrastructure.

npm install vcl-utils
15 downloads in the last month

vcl-utils

Introduction

This is a node.js tool for monitoring an apache-vcl infrastructure. It quickly checks on the status of all nodes controlled by a given management node.

Install

npm install vcl-utils

Requirements

Examples

Check all nodes and report back on their status, capturing any errors:

var health = require('vcl-utils').Health;

health.on('error', function(err) {
    console.log('ERROR :: ' + err);
});

health.on('info', function(msg) {
    console.log('INFO :: ' + msg);
});

health.check({
    config: '/etc/vcl/vcld.conf'
  });

Or, you can check only for computers with incorrect image revisions:

var health = require('vcl-utils').Health;

health.on('incorrectImage', function(host) {
    console.log('Incorrect Image :: ' + host);
  });

health.check({
    config: '/etc/vcl/vcld.conf'
  });

API

Health events

  • info - Information about each computer managed by this management node.

  • error - Any errors encountered in connecting to computers.

  • incorrectImage - All computers with a non-matching image.

All other events correspond to the state value of a VCL node. Some of these include:

  • available - All computers in an available state.

  • failed - All computers in a failed state.

  • inuse - All computers currently in use.

  • reloading - All computers currently reloading.

  • reserved - All currently reserved computers.

  • maintenance - All computers in the maintenance state.

Health methods

health.check({
    config: '/etc/vcl/vcld.conf'
  });

The check() method will find all computers for a given management node, and (if the computer is 'available'), it will login and check that the image revisionid matches what is listed in the database. For any other state, the computer will not be checked, but an event corresponding to that state will be emitted.

Health.check() options

When issuing a health check, you can set the following option:

  • config: The path to the vcld.conf file. (Default: /etc/vcl/vcld.conf)

It is typically unnecessary to set additional values. If, however, it is necessary to pass additional values to the MySQL connection, these can be set here. The full list of MySQL configuration values are available at the node-mysql page.

npm loves you