Git Product home page Git Product logo

cronologger's Introduction

This script will archive cron or for that matter any output
to a CouchDB document. There are two main drivers

 - Reduce the amount of cron e-mail spam
 - Have logs of cron jobs that can be correlated to adverse events

Script will log following items

  - Command line used
  - Hostname script ran on
  - Username script ran on
  - Time started
  - How long the job took (job_duration)
  - Exit/return code of the job


REQUIREMENTS
============

- CouchDB 0.10+ for storage
- curl web client installed on all the nodes running cronologger

INSTALLATION
============

First create a database on CouchDB. 

Then at top of cronologger script define the URL to CouchDB ie.

URL_BASE="http://localhost:5984/cronologger"

You could also define environment variables CRONOLOGGER_SERVER (defaults to localhost)
and CRONOLOGGER_DB (defaults cronologger) ie.

export CRONOLOGGER_SERVER=couch01
export CRONOLOGGER_DB=crondb

RUNNING
=======

To run it simply precede a command with the cronologger command ie.

  cronologger /usr/local/bin/backup_db.sh

That's it. Check out CouchDBs web interface 

http://localhost:5984/_utils/

on your CouchDB you should see an entry for the job that just ran.

WEB GUI
=======

There is PHP based web GUI however you have to create CouchDB views to be able
to use it. You can find the view specification in cronview.json. To install/refresh the
view define CRONOLOGGER_SERVER and CRONOLOGGER_DB variables and run refresh_view.sh

export CRONOLOGGER_SERVER=couch01
export CRONOLOGGER_DB=crondb

Copy contents of the web subdirectory to your web document root ie. /var/www/html/cronologger.
To configure web GUI create a config.php file which should only contain values that
override the default values specified in config.default.php e.g.

<?php

$couchdb_server = "couch01";

?>

The web interface requires php >= 5.2, and 'allow_url_fopen = On' configured in your 
php.ini file.

Enjoy.

##########################################################################################

All the scripts are licensed under the Apache License, Version 2.0 (the "License") 
unless otherwise noted; you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software distributed under the 
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
either express or implied. See the License for the specific language governing permissions 
and limitations under the License. 

cronologger's People

Contributors

deanwilson avatar gavincarr avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.