File: README

package info (click to toggle)
downtimed 0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 592 kB
  • ctags: 177
  • sloc: sh: 1,447; ansic: 893; xml: 45; makefile: 18
file content (259 lines) | stat: -rw-r--r-- 8,683 bytes parent folder | download
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
downtimed - system downtime monitoring and reporting tool
=========================================================

Copyright (c) 2009-2013 EPIPE Communications. All rights reserved.

This software is licensed under the terms and conditions of the FreeBSD
License which is also known as the Simplified BSD License. You should have
received a copy of that license along with this software.

Software web site:

  http://dist.epipe.com/downtimed/

Development version is available at Launchpad:

  https://launchpad.net/downtimed

Main development branch of downtimed is available with Bazaar VCS:

  bzr branch lp:downtimed

Author's e-mail address for reporting bugs, sending contributions etc:

  opensource@epipe.com


Portability
===========

Currently supported operating systems:
 - Recent versions of FreeBSD, NetBSD and OpenBSD
 - Modern GNU/Linux distributions
 - Mac OS X/Darwin
 - GNU/Hurd
 - Solaris / OpenSolaris / OpenIndiana

The software probably works on other modern *BSD variants with zero or
little modifications.

The only really non-portable part of the program is the getboottime()
function which uses an operating system specific interface for finding
the exact moment when the kernel started again. The function can be
easily altered to add support for additional operating systems. The
author would appreciate receiving any such patches to be integrated in
the main distribution.

Also for the sake of convenience the program uses some functions which
are available only in modern operating systems. These include for example
asprintf(3), vasprintf(3), snprintf(3), err(3) and errx(3).


History
=======

The author of this software had a Xen based virtual private server
(VPS) running FreeBSD operating system. Occasionally the owner of the
physical non-virtual machine would turn off the VPS to do some system
administration tasks on the host operating system, which the author did
not have access to. The author wanted to have some sort of record of when,
why and how long the VPS had been down. The standard FreeBSD system did
not provide such a facility.

After some looking around it seemed that there was only programs for
monitoring uptime but not downtime. Also most of these programs were
complicated and were intended to be run on a remote host and thus they
would be actually monitoring the system availability through the network
instead of the actual downtime of the FreeBSD operating system running
on the VPS. Also they would require an another server for monitoring
the primary server.

Therefore downtimed was needed.


Features
========

downtimed was made to monitor operating system downtime, shutdowns and
crashes on the monitored host itself and to keep a record of such events.

downtimed(8) is a daemon process which is intended to be started
automatically from system boot scripts every time when the operating
system of a server starts. First the daemon logs its findings about the
previous downtime to a specified logging destination as well as in a
database file which can be displayed with downtimes(1) command.

Thereafter the downtimed(8) daemon just keeps waiting in the background
and periodically updates a time stamp file on the disk. The time stamp
is used to determine the approximate time when the system was last up
and running. In case of a graceful system shutdown it records a stamp
to another file on the disk. These files are used for reporting the next
time the daemon starts.

downtimes(1) is a command-line tool which can be used to inspect previous
downtime records recorded in the downtime database file.


Installation
============

Installation should be preferably done through a port or a package
which is tailored to your specific operating system.

If one does not exist or if you yourself are making such a port or a
package, the basic GNU autotools based installation should be as follows:

  ./configure
  make
  make install

The above does NOT install any startup scripts which are REQUIRED for
proper function of downtimed. See the following chapter.

The program also needs a persistent data directory for the time stamp
and the downtime database files. It should be created on *BSD and
MacOS X as follows:

  mkdir /var/db/downtimed

...or on GNU/Linux, Debian GNU/kFreeBSD, GNU/Hurd or Solaris as follows:

  mkdir /var/lib/downtimed

Note that you can determine the default data directory location on
your system by issuing "downtimed -v" command or you can specify a
different directory with the "-d" option. Set the directory permissions
as appropriate in your environment. If you are installing a port or
package tailored for your system, this step is most likely taken care
for you automatically.


Startup scripts
===============

It seems that every different operating system and distribution has
invented their own ways of starting system daemons during the boot
process. That is a major pain in the ass.

The downtimed distribution includes the following operating system and
distribution specific startup script samples. They are located in the
"startup-scripts" directory. It is assumed that system administrators
or port/package maintainers will implement and configure the required
startup scripts.

Arch Linux
----------
Arch Linux startup script is included as archlinux-startup.sh. It should
be installed as /etc/rc.d/downtimed and added to the DAEMONS setting in
/etc/rc.conf.

Debian
------
A startup script for GNU/Debian and related distributions is included as
debian-startup.sh. It should be installed as /etc/init.d/downtimed.
Running the command "update-rc.d downtimed defaults" enables starting the
service at the system startup.

FreeBSD
-------
A sample startup script for FreeBSD is included as freebsd-startup.sh.
It should be installed as /usr/local/etc/rc.d/downtimed. Add:
	downtimed_enable="YES"
...in one of the following files to enable boot time startup:
	/etc/rc.conf
	/etc/rc.conf.local
	/etc/rc.conf.d/downtimed
Add the following if you want to configure downtimed(8) command line
options:
	downtimed_flags="<set as needed>"

Mac OS X
--------
Mac OS X/Darwin launchd(8) configuration file com.epipe.downtimed.plist is
also included. This file should be installed to /Library/LaunchDaemons.

OpenIndiana / OpenSolaris / Solaris
-----------------------------------
SMF (Service Management Facility) manifest for OpenIndiana, OpenSolaris
and Solaris 10 & 11 is in downtimed.smf.xml. It is not usable on Solaris
9 and older as they need a SysV style init script instead.

openSUSE
--------
A startup script for openSUSE is included as opensuse-startup.sh. It
should be installed as /etc/init.d/downtimed. Running the command
"innserv /etc/init.d/downtimed" enables starting the service at the
system startup.

Red Hat based distributions (RHEL, Fedora, SL, Oracle, CentOS, etc.)
--------------------------------------------------------------------
A startup script for Red Hat related distributions is included as
redhat-startup.sh. It should be installed as /etc/rc.d/init.d/downtimed.
Running the command "chkconfig --add downtimed" enables starting the
service at the system startup.

Ubuntu
------
A startup script for GNU/Linux distributions using upstart(8) to bring
up system daemons, such as the Ubuntu distribution, is included in
upstart-startup.conf. It should be installed as /etc/init/downtimed.conf.


These startup scripts are not installed by default.

This program is not really useful unless there is a proper startup script
in place. Refer to your operating system or distribution manual on how
to create and manage daemon startup scripts.


Usage documentation
===================

Have a look at downtimed(8) manual page:

  man downtimed

... as well as the downtimes(1) manual page:

  man downtimes

Alternatively you can find a PDF version of the manual pages at:

  http://dist.epipe.com/downtimed/


Contributions
=============

If you port this software to a new operating system, find bugs or
implement new features, it would be nice if you could send your patches
to the author either through Launchpad or by e-mail. See the top of this
document for contact information.


Acknowledgements
================

The following people have contributed patches or other improvements to
this software:

Henrik Ahlgren <pablo@seestieto.com>
 - Mac OS X patches

Mats Erik Andersson <openbsd@gisladisker.se>
 - OpenBSD, Debian GNU/kFreeBSD and other patches

Federico Lucifredi <flucifredi@acm.org>
 - openSUSE startup script

Jason Melton <jason.melton@gmail.com>
 - Arch Linux startup script

Douglas Thrift <douglas@douglasthrift.net>
 - FreeBSD 9 compatibility fix

Others who I may have forgotten. (Sorry!)

Thank You!

/* eof */