forked from vvuksan/cronologger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
87 lines (56 loc) · 2.52 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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.