Commit graph

74 commits

Author SHA1 Message Date
Rob Vermaas 7a32f2d15a Fix node_modules references in uptime module. 2013-07-31 13:35:21 +02:00
Bjørn Forsman 38a4d6d6d7 apcupsd-service: "UPS daemon" => "APC UPS daemon" description update
Sometimes systemd only prints the service description. Then it is nice
to know which UPS daemon we're dealing with.
2013-07-22 14:58:51 +02:00
Bjørn Forsman fe9ac2ca1c apcupsd-service: workaround for "A stop job is running for UPS daemon"
When apcupsd has initiated a shutdown, systemd always ends up waiting
for it to stop ("A stop job is running for UPS daemon"). This is weird,
because in the journal one can clearly see that apcupsd has received the
SIGTERM signal and has already quit (or so it seems). This reduces the
wait time from 90 seconds (default) to just 5. Then systemd kills it
with SIGKILL.
2013-07-22 14:57:28 +02:00
Bjørn Forsman 95e2006653 apcupsd-service: put UPS in hibernate mode when shutting down
This adds a special systemd service that calls "apcupsd --killpower"
(put UPS in hibernate mode) just before shutting down the system.
Without this command, the UPS will stay on until the battery is
completely empty.
2013-07-22 14:57:05 +02:00
Bjørn Forsman d6e5484e2b apcupsd-service: create missing /run/apcupsd/ directory
apcupsd complains about this missing directory when it is starting the
shutdown procedure.
2013-07-22 14:54:27 +02:00
Bjørn Forsman dc61694d01 apcupsd-service: add services.apcupsd.hooks option
Each attribute in this option should name an apcupsd event and the
string value it contains will be executed in a shell in response to that
event. See "man apccontrol" for the list of events and what they
represent.

Now it is easy to hook into the apcupsd event system:

  services.apcupsd.hooks = {
    onbattery  = ''# shell commands to run when the onbattery event is emitted'';
    doshutdown = ''# shell commands to notify that the computer is shutting down'';
  };
2013-07-22 14:19:21 +02:00
Shea Levy 272d641f0c Documentation improvement
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-19 11:22:46 -04:00
Shea Levy 18de9f64ae Add uptime module
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-18 19:25:35 -04:00
Bjørn Forsman 44f1a8d8c7 Add apcupsd service
apcupsd is a daemon for controlling APC UPSes. It is very simple to
configure. If you have an USB based UPS, the default settings should be
useable without further adjustments:

  services.apcupsd.enable = true;

This will give you autodetection of USB UPSes, network access limited to
localhost (for security) and the shutdown sequence will be started when
the system when the battery level is below 50 percent, or when the UPS
has calculated that it has 5 minutes or less of remaining power-on time.

You can provide your own configuration file contents with this option:

  services.apcupsd.configText = "contents of apcupsd.conf";

Bug/annoyance 1: When apcupsd calls "wall" (on powerfail etc. events),
it prints an error message because stdout is not connected to a tty (it
is connected to the journal):

  wall: cannot get tty name: Inappropriate ioctl for device

The message still gets through though, to ctrl-alt-f[1-6] terminals.

Bug/annoyance 2: apcupsd tries to call "mail" (on powerfail etc.
events), and that fails because I'm not passing in any mail program at
the moment (because that would require more configuration options). A
solution to this would be to simply let the user fully configure the
apcupsd event handling logic in nix.
2013-07-17 21:23:09 +02:00
Domen Kozar 36f2ec84a9 dd-agent: cleanup, add dogstatsd systemd service 2013-06-29 19:33:44 +02:00
Domen Kozar a20630476f cleanup dd-agent 2013-06-29 18:45:57 +02:00
aszlig 3bf1210635
zabbix-server: Swap order of database population.
Starting with Zabbix 2.0 the order of data imports is important[*] and will lead
to errors if not done in the right order. Zabbix 1.8 works fine with the swapped
order as well, so this change shouldn't affect any pre-2.0 users.

[*] https://www.zabbix.com/documentation/2.0/manual/appendix/install/db_scripts

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2013-06-13 03:34:29 +02:00
aszlig 62d5282602
zabbix-server: Make it easier to use peer auth.
Quoting from the manual about DBHost:

```
In case of MySQL localhost or empty string results in using a socket. In case of
PostgreSQL only empty string results in attempt to use socket.
```
https://www.zabbix.com/documentation/2.0/manual/appendix/config/zabbix_server

With this commit we should avoid some race conditions in systemd, because if the
host is set to "", there is no condition that postgresql has to be started prior
to the Zabbix server.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2013-06-13 03:34:28 +02:00
aszlig bf28d5c109
zabbix-server: Add PID file to systemd config.
This is to avoid (in some cases) constant restarting of the Zabbix server, which
causes odds bugs and crashes in the exit handler (if it's too early during
startup).

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2013-06-13 01:56:09 +02:00
Eelco Dolstra 945849b86f Don't set $TZ
We don't need to set $TZ, because we have /etc/localtime.  In fact,
setting $TZ without $TZDIR doesn't work anymore since Glibc no longer
contains zone info.
2013-04-22 18:56:19 +02:00
Marc Weber f3e6b42258 replace list by listOf using same style as for attrsOf 2013-03-14 17:09:21 +01:00
Peter Simons 415ff3c39a smartd: change 'devices' option from "list of strings" to "list of attribute sets"
The smartd used to expect a list of devices to monitor. After this patch, it
expects a list of attribute sets, which may have two attributes:

 - device: path to the device (required)
 - options: smartd options to apply to this particular device (optional)

A concrete example configuration would be:

  services.smartd = {
    enable = true;
    devices = [ { device = "/dev/sda"; } { device = "/dev/sdb"; options = "-d sat"; } ];
  };

Furthermore, the config option 'deviceOpts' can be used to configure options
that are applied to *every* device.
2013-03-10 01:19:44 +01:00
Shea Levy f3d4d24d6b dd-agent: Run as a separate user 2013-02-27 09:25:37 -05:00
Eelco Dolstra ae4e94d9ac Rename ‘boot.systemd’ to ‘systemd’
Suggested by Mathijs Kwik.  ‘boot.systemd’ is a misnomer because
systemd affects more than just booting.  And it saves some typing.
2013-01-16 12:33:18 +01:00
Shea Levy 19127aa416 Add dd-agent module 2013-01-08 16:19:51 -05:00
Eelco Dolstra 74bae63135 smartd: Remove unnecessary PartOf dependency 2013-01-07 16:01:22 +01:00
Mathijs Kwik f61f0c139b systemd: convert smartd job to service 2012-12-27 12:23:50 +01:00
Rob Vermaas 859badc966 Zabbix agent: RemainAfterExit=true seems to give more reliable restarts, cannot completely figure out why, as Type=forking should be enough. 2012-12-11 20:54:19 +01:00
Eelco Dolstra b1da38f564 Merge remote-tracking branch 'origin/master' into systemd 2012-11-30 16:12:04 +01:00
Eelco Dolstra 6705358ede Convert Zabbix agent/server to systemd
Note all the crap systemd doesn't need :-)
2012-10-26 16:22:19 +02:00
Jack Cummings e8d8b6b399 smartd: Add options for each device being monitored 2012-10-09 14:00:59 -04:00
Eelco Dolstra 3ad370ae0a Merge remote-tracking branch 'origin/master' into systemd
Conflicts:
	modules/misc/ids.nix
	modules/services/mail/postfix.nix
	modules/services/system/nscd.nix
	modules/services/x11/desktop-managers/xfce.nix
	modules/system/boot/stage-1.nix
2012-09-28 11:35:27 -04:00
Peter Simons 5ef71c6d22 smartd: convert service to systemd 2012-09-25 16:38:05 -04:00
Eelco Dolstra 1e666c10fa Get rid of the last use of mkThenElse 2012-09-20 16:55:32 -04:00
Eelco Dolstra 44d091674b Merge branch 'master' of github.com:NixOS/nixos into systemd
Conflicts:
	modules/config/networking.nix
	modules/services/networking/ssh/sshd.nix
	modules/services/ttys/agetty.nix
	modules/system/boot/stage-2-init.sh
	modules/system/upstart-events/shutdown.nix
2012-07-16 17:27:11 -04:00
Eelco Dolstra 73532c3855 Global replace /var/run/current-system -> /run/current-system 2012-07-16 11:34:21 -04:00
Eelco Dolstra 4a95f8996b To ease migration to systemd, generate units from the ‘jobs’ option
Also get rid of the ‘buildHook’ job option because it wasn't very useful.
2012-06-16 00:19:43 -04:00
Eelco Dolstra 801cd7402c * Don't use ‘chown user.group’ since that syntax is not officially
supported (you're supposed to say ‘chown user:group’).

svn path=/nixos/trunk/; revision=34161
2012-05-17 19:43:32 +00:00
Joachim Schiele bc6ca7944f fixed a upstart issue where upsd was never started
svn path=/nixos/trunk/; revision=33494
2012-03-31 11:39:30 +00:00
Eelco Dolstra 6093b54b73 * Zabbix: use the path attribute.
svn path=/nixos/trunk/; revision=33278
2012-03-19 19:43:31 +00:00
Eelco Dolstra 7278e37072 * Don't set DBHost if the database is on localhost, otherwise Zabbix
will use TCP/IP instead of a Unix domain socket.
* Simplify Zabbix's start condition.  Zabbix now retries if the
  database is down instead of bailing out.

svn path=/nixos/trunk/; revision=32426
2012-02-20 13:40:47 +00:00
Eelco Dolstra b11a33717f * zabbix-server: don't require PostgreSQL to be started
if we're using a remote server.

svn path=/nixos/trunk/; revision=31852
2012-01-26 13:32:02 +00:00
Peter Simons 0cd9ff9fcc smartd: run smartd daemon using the given search path to improve readability of ps output
svn path=/nixos/trunk/; revision=30569
2011-11-25 17:09:44 +00:00
Peter Simons ef932017fc smartd: run the mail notification script with ${pkgs.stdenv.shell} rather than /bin/sh
svn path=/nixos/trunk/; revision=30568
2011-11-25 17:09:37 +00:00
Peter Simons 20b364f4de Reverting revisions 30103-30106: "always set nixpkgs.config.{state,store}Dir", etc.
After the change from revision 30103, nixos-rebuild suddenly consumed
freaky amounts of memory. I had to abort the process after it had
allocated well in excess of 30GB(!) of RAM. I'm not sure what is causing
this behavior, but undoing that assignment fixes the problem. The other
two commits needed to be revoked, too, because they depend on 30103.

svn path=/nixos/trunk/; revision=30127
2011-10-30 15:19:58 +00:00
Shea Levy 09cf6ce70c find modules | fgrep .nix | fgrep -v .svn | fgrep -v nixpkgs.nix | xargs sed -i -e 's|/nix/var|${config.nixpkgs.config.nix.stateDir}|g' -e 's|/nix/store|${config.nixpkgs.config.nix.storeDir}|g'
Don't assume /nix/store or /nix/var in NixOS modules, this is configurable

svn path=/nixos/trunk/; revision=30104
2011-10-29 21:03:57 +00:00
Lluís Batlle i Rossell 1fe1481adf Fixing systemhealth for kernels 3.x
svn path=/nixos/trunk/; revision=30068
2011-10-27 18:06:54 +00:00
Lluís Batlle i Rossell 62dede7121 The system health url moved.
svn path=/nixos/trunk/; revision=29881
2011-10-18 21:44:06 +00:00
Peter Simons 8abea71eaa modules/services/monitoring/smartd.nix: run the daemon with --no-fork to make life easier for upstart
svn path=/nixos/trunk/; revision=29287
2011-09-14 18:30:10 +00:00
Peter Simons d1cf78c756 modules/services/monitoring/smartd.nix: provide the implicitly set flag '-a' explicitly
svn path=/nixos/trunk/; revision=29286
2011-09-14 18:30:07 +00:00
Peter Simons eb6e1310b8 strip trailing whitespace; no functional change
svn path=/nixos/trunk/; revision=29285
2011-09-14 18:20:50 +00:00
Eelco Dolstra 7dc59f0bb0 * Zabbix: only enable PostgreSQL if it's on the same machine.
svn path=/nixos/trunk/; revision=29185
2011-09-11 15:55:43 +00:00
Peter Simons a84ada1d92 modules/services/monitoring/smartd.nix: pass TZ variable to smartd to ensure that notification e-mails have a proper time zone
svn path=/nixos/trunk/; revision=28702
2011-08-19 20:44:12 +00:00
Nicolas Pierron 66ffeb3fd9 UPS: Make sure the driver pid files can be stored.
svn path=/nixos/trunk/; revision=27979
2011-07-27 20:55:39 +00:00
Nicolas Pierron e231543033 Add new services: freepops, fuppes and ups.
svn path=/nixos/trunk/; revision=27977
2011-07-27 20:55:28 +00:00