Use the new scheme for zabbix upstart-job.
svn path=/nixos/branches/fix-style/; revision=13329
This commit is contained in:
parent
3a25babf1b
commit
9c751d377d
@ -2322,35 +2322,6 @@ in
|
||||
};
|
||||
|
||||
|
||||
zabbixAgent = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to run the Zabbix monitoring agent on this machine.
|
||||
It will send monitoring data to a Zabbix server.
|
||||
";
|
||||
};
|
||||
|
||||
server = mkOption {
|
||||
default = "127.0.0.1";
|
||||
description = ''
|
||||
The IP address or hostname of the Zabbix server to connect to.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
zabbixServer = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to run the Zabbix server on this machine.
|
||||
";
|
||||
};
|
||||
};
|
||||
|
||||
postfix = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
@ -3111,6 +3082,8 @@ root ALL=(ALL) SETENV: ALL
|
||||
(import ../upstart-jobs/pcmcia.nix)
|
||||
|
||||
# services
|
||||
(import ../upstart-jobs/zabbix-agent.nix)
|
||||
(import ../upstart-jobs/zabbix-server.nix.nix)
|
||||
(import ../upstart-jobs/disnix.nix)
|
||||
(import ../upstart-jobs/cron.nix)
|
||||
(import ../upstart-jobs/cron/locate.nix)
|
||||
|
@ -418,18 +418,6 @@ let
|
||||
inherit config pkgs;
|
||||
})
|
||||
|
||||
# Zabbix agent daemon.
|
||||
++ optional config.services.zabbixAgent.enable
|
||||
(import ../upstart-jobs/zabbix-agent.nix {
|
||||
inherit config pkgs;
|
||||
})
|
||||
|
||||
# Zabbix server daemon.
|
||||
++ optional config.services.zabbixServer.enable
|
||||
(import ../upstart-jobs/zabbix-server.nix {
|
||||
inherit config pkgs;
|
||||
})
|
||||
|
||||
# Postfix mail server.
|
||||
++ optional config.services.postfix.enable
|
||||
(import ../upstart-jobs/postfix.nix {
|
||||
|
@ -1,5 +1,35 @@
|
||||
# Zabbix agent daemon.
|
||||
{config, pkgs}:
|
||||
|
||||
###### interface
|
||||
let
|
||||
inherit (pkgs.lib) mkOption;
|
||||
|
||||
options = {
|
||||
services = {
|
||||
zabbixAgent = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to run the Zabbix monitoring agent on this machine.
|
||||
It will send monitoring data to a Zabbix server.
|
||||
";
|
||||
};
|
||||
|
||||
server = mkOption {
|
||||
default = "127.0.0.1";
|
||||
description = ''
|
||||
The IP address or hostname of the Zabbix server to connect to.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
###### implementation
|
||||
let
|
||||
|
||||
cfg = config.services.zabbixAgent;
|
||||
@ -20,17 +50,14 @@ let
|
||||
StartAgents = 5
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
name = "zabbix-agent";
|
||||
|
||||
users = [
|
||||
{ name = "zabbix";
|
||||
user = {
|
||||
name = "zabbix";
|
||||
uid = (import ../system/ids.nix).uids.zabbix;
|
||||
description = "Zabbix daemon user";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
job = {
|
||||
name = "zabbix-agent";
|
||||
|
||||
job = ''
|
||||
start on network-interfaces/started
|
||||
@ -59,5 +86,23 @@ in
|
||||
while ${pkgs.procps}/bin/pkill -u zabbix zabbix_agentd; do true; done
|
||||
end script
|
||||
'';
|
||||
};
|
||||
|
||||
ifEnable = pkgs.lib.ifEnable cfg.enable;
|
||||
in
|
||||
|
||||
{
|
||||
require = [
|
||||
(import ../upstart-jobs/default.nix)
|
||||
# (import ../system/user.nix) # users = { .. }
|
||||
options
|
||||
];
|
||||
|
||||
services = {
|
||||
extraJobs = ifEnable [job];
|
||||
};
|
||||
|
||||
users = {
|
||||
extraUsers = ifEnable [user];
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,25 @@
|
||||
# Zabbix server daemon.
|
||||
{config, pkgs}:
|
||||
|
||||
###### interface
|
||||
let
|
||||
inherit (pkgs.lib) mkOption;
|
||||
|
||||
options = {
|
||||
services = {
|
||||
zabbixServer = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
description = "
|
||||
Whether to run the Zabbix server on this machine.
|
||||
";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
###### implementation
|
||||
let
|
||||
|
||||
stateDir = "/var/run/zabbix";
|
||||
@ -20,17 +40,14 @@ let
|
||||
DBUser = zabbix
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
name = "zabbix-server";
|
||||
|
||||
users = [
|
||||
{ name = "zabbix";
|
||||
user = {
|
||||
name = "zabbix";
|
||||
uid = (import ../system/ids.nix).uids.zabbix;
|
||||
description = "Zabbix daemon user";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
job = {
|
||||
name = "zabbix-server";
|
||||
|
||||
job = ''
|
||||
description "Zabbix server daemon"
|
||||
@ -62,4 +79,23 @@ in
|
||||
end script
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
ifEnable = pkgs.lib.ifEnable config.services.zabbixServer.enable
|
||||
in
|
||||
|
||||
{
|
||||
require = [
|
||||
(import ../upstart-jobs/default.nix)
|
||||
# (import ../system/user.nix) # users = { .. }
|
||||
options
|
||||
];
|
||||
|
||||
services = {
|
||||
extraJobs = ifEnable [job];
|
||||
};
|
||||
|
||||
users = {
|
||||
extraUsers = ifEnable [user];
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user