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 = {
|
postfix = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
@ -3111,6 +3082,8 @@ root ALL=(ALL) SETENV: ALL
|
|||||||
(import ../upstart-jobs/pcmcia.nix)
|
(import ../upstart-jobs/pcmcia.nix)
|
||||||
|
|
||||||
# services
|
# services
|
||||||
|
(import ../upstart-jobs/zabbix-agent.nix)
|
||||||
|
(import ../upstart-jobs/zabbix-server.nix.nix)
|
||||||
(import ../upstart-jobs/disnix.nix)
|
(import ../upstart-jobs/disnix.nix)
|
||||||
(import ../upstart-jobs/cron.nix)
|
(import ../upstart-jobs/cron.nix)
|
||||||
(import ../upstart-jobs/cron/locate.nix)
|
(import ../upstart-jobs/cron/locate.nix)
|
||||||
|
@ -418,18 +418,6 @@ let
|
|||||||
inherit config pkgs;
|
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.
|
# Postfix mail server.
|
||||||
++ optional config.services.postfix.enable
|
++ optional config.services.postfix.enable
|
||||||
(import ../upstart-jobs/postfix.nix {
|
(import ../upstart-jobs/postfix.nix {
|
||||||
|
@ -1,5 +1,35 @@
|
|||||||
|
# Zabbix agent daemon.
|
||||||
{config, pkgs}:
|
{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
|
let
|
||||||
|
|
||||||
cfg = config.services.zabbixAgent;
|
cfg = config.services.zabbixAgent;
|
||||||
@ -20,17 +50,14 @@ let
|
|||||||
StartAgents = 5
|
StartAgents = 5
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
user = {
|
||||||
|
name = "zabbix";
|
||||||
{
|
|
||||||
name = "zabbix-agent";
|
|
||||||
|
|
||||||
users = [
|
|
||||||
{ name = "zabbix";
|
|
||||||
uid = (import ../system/ids.nix).uids.zabbix;
|
uid = (import ../system/ids.nix).uids.zabbix;
|
||||||
description = "Zabbix daemon user";
|
description = "Zabbix daemon user";
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
job = {
|
||||||
|
name = "zabbix-agent";
|
||||||
|
|
||||||
job = ''
|
job = ''
|
||||||
start on network-interfaces/started
|
start on network-interfaces/started
|
||||||
@ -59,5 +86,23 @@ in
|
|||||||
while ${pkgs.procps}/bin/pkill -u zabbix zabbix_agentd; do true; done
|
while ${pkgs.procps}/bin/pkill -u zabbix zabbix_agentd; do true; done
|
||||||
end script
|
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}:
|
{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
|
let
|
||||||
|
|
||||||
stateDir = "/var/run/zabbix";
|
stateDir = "/var/run/zabbix";
|
||||||
@ -20,17 +40,14 @@ let
|
|||||||
DBUser = zabbix
|
DBUser = zabbix
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
user = {
|
||||||
|
name = "zabbix";
|
||||||
{
|
|
||||||
name = "zabbix-server";
|
|
||||||
|
|
||||||
users = [
|
|
||||||
{ name = "zabbix";
|
|
||||||
uid = (import ../system/ids.nix).uids.zabbix;
|
uid = (import ../system/ids.nix).uids.zabbix;
|
||||||
description = "Zabbix daemon user";
|
description = "Zabbix daemon user";
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
job = {
|
||||||
|
name = "zabbix-server";
|
||||||
|
|
||||||
job = ''
|
job = ''
|
||||||
description "Zabbix server daemon"
|
description "Zabbix server daemon"
|
||||||
@ -62,4 +79,23 @@ in
|
|||||||
end script
|
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