prometheus: beginnings
This commit is contained in:
parent
f4e04faef3
commit
665e79a984
8
data.nix
8
data.nix
@ -7,6 +7,14 @@ rec {
|
|||||||
updaterbot-deployee = 502;
|
updaterbot-deployee = 502;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ports = {
|
||||||
|
grafana = 3000;
|
||||||
|
prometheus = 9001;
|
||||||
|
exporters = {
|
||||||
|
node = 9002;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
people_pubkeys = {
|
people_pubkeys = {
|
||||||
motiejus = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+qpaaD+FCYPcUU1ONbw/ff5j0xXu5DNvp/4qZH/vOYwG13uDdfI5ISYPs8zNaVcFuEDgNxWorVPwDw4p6+1JwRLlhO4J/5tE1w8Gt6C7y76LRWnp0rCdva5vL3xMozxYIWVOAiN131eyirV2FdOaqTwPy4ouNMmBFbibLQwBna89tbFMG/jwR7Cxt1I6UiYOuCXIocI5YUbXlsXoK9gr5yBRoTjl2OfH2itGYHz9xQCswvatmqrnteubAbkb6IUFYz184rnlVntuZLwzM99ezcG4v8/485gWkotTkOgQIrGNKgOA7UNKpQNbrwdPAMugqfSTo6g8fEvy0Q+6OXdxw5X7en2TJE+BLVaXp4pVMdOAzKF0nnssn64sRhsrUtFIjNGmOWBOR2gGokaJcM6x9R72qxucuG5054pSibs32BkPEg6Qzp+Bh77C3vUmC94YLVg6pazHhLroYSP1xQjfOvXyLxXB1s9rwJcO+s4kqmInft2weyhfaFE0Bjcoc+1/dKuQYfPCPSB//4zvktxTXud80zwWzMy91Q4ucRrHTBz3PrhO8ys74aSGnKOiG3ccD3HbaT0Ff4qmtIwHcAjrnNlINAcH/A2mpi0/2xA7T8WpFnvgtkQbcMF0kEKGnNS5ULZXP/LC8BlLXxwPdqTzvKikkTb661j4PhJhinhVwnQ==";
|
motiejus = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+qpaaD+FCYPcUU1ONbw/ff5j0xXu5DNvp/4qZH/vOYwG13uDdfI5ISYPs8zNaVcFuEDgNxWorVPwDw4p6+1JwRLlhO4J/5tE1w8Gt6C7y76LRWnp0rCdva5vL3xMozxYIWVOAiN131eyirV2FdOaqTwPy4ouNMmBFbibLQwBna89tbFMG/jwR7Cxt1I6UiYOuCXIocI5YUbXlsXoK9gr5yBRoTjl2OfH2itGYHz9xQCswvatmqrnteubAbkb6IUFYz184rnlVntuZLwzM99ezcG4v8/485gWkotTkOgQIrGNKgOA7UNKpQNbrwdPAMugqfSTo6g8fEvy0Q+6OXdxw5X7en2TJE+BLVaXp4pVMdOAzKF0nnssn64sRhsrUtFIjNGmOWBOR2gGokaJcM6x9R72qxucuG5054pSibs32BkPEg6Qzp+Bh77C3vUmC94YLVg6pazHhLroYSP1xQjfOvXyLxXB1s9rwJcO+s4kqmInft2weyhfaFE0Bjcoc+1/dKuQYfPCPSB//4zvktxTXud80zwWzMy91Q4ucRrHTBz3PrhO8ys74aSGnKOiG3ccD3HbaT0Ff4qmtIwHcAjrnNlINAcH/A2mpi0/2xA7T8WpFnvgtkQbcMF0kEKGnNS5ULZXP/LC8BlLXxwPdqTzvKikkTb661j4PhJhinhVwnQ==";
|
||||||
};
|
};
|
||||||
|
@ -63,6 +63,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
# TODO move to grafana service lib
|
||||||
|
friendlyport.ports = [myData.ports.grafana];
|
||||||
|
|
||||||
deployerbot = {
|
deployerbot = {
|
||||||
main = {
|
main = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -106,11 +109,40 @@
|
|||||||
services = {
|
services = {
|
||||||
tailscale.enable = true;
|
tailscale.enable = true;
|
||||||
|
|
||||||
#grafana = {
|
grafana = {
|
||||||
# enable = true;
|
enable = true;
|
||||||
# domain = "vno1-oh2.servers.jakst"; # TODO tailscale service?
|
settings = {
|
||||||
# addr = myData.hosts."vno1-oh2.servers.jakst".jakstIP;
|
server = {
|
||||||
#};
|
# TODO tailscale service?
|
||||||
|
domain = "${config.networking.hostName}.${config.networking.domain}";
|
||||||
|
http_addr = myData.hosts."${config.networking.hostName}.${config.networking.domain}".jakstIP;
|
||||||
|
http_port = myData.ports.grafana;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
prometheus = {
|
||||||
|
enable = true;
|
||||||
|
port = myData.ports.prometheus;
|
||||||
|
exporters = {
|
||||||
|
node = {
|
||||||
|
enable = true;
|
||||||
|
enabledCollectors = ["systemd"];
|
||||||
|
port = myData.ports.exporters.node;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
scrapeConfigs = [
|
||||||
|
{
|
||||||
|
job_name = "${config.networking.hostName}.${config.networking.domain}";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = ["127.0.0.1:${toString config.services.prometheus.exporters.node.port}"];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
nsd = {
|
nsd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
hosts = lib.attrVals ["mxp10.motiejus.jakst" "fwmine.motiejus.jakst"] myData.hosts;
|
hosts = lib.attrVals ["mxp10.motiejus.jakst" "fwmine.motiejus.jakst"] myData.hosts;
|
||||||
ips = lib.catAttrs "jakstIP" hosts;
|
ips = lib.catAttrs "jakstIP" hosts;
|
||||||
startLines = map (ip: "iptables -A INPUT -p tcp --match multiport --dports ${ports} --source ${ip} -j ACCEPT") ips;
|
startLines = map (ip: "iptables -A INPUT -p tcp --match multiport --dports ${ports} --source ${ip} -j ACCEPT") ips;
|
||||||
stopLines = map (ip: "iptables -D INPUT -p tcp --match multiport --dports ${ports} --source ${ip} -j ACCEPT") ips;
|
# TODO: when stopping the firewall, systemd uses the old ports. So this is a two-phase process.
|
||||||
|
# How to stop the old one and start the new one?
|
||||||
|
stopLines = map (ip: "iptables -D INPUT -p tcp --match multiport --dports ${ports} --source ${ip} -j ACCEPT || :") ips;
|
||||||
in {
|
in {
|
||||||
networking.firewall.extraCommands = lib.concatLines startLines;
|
networking.firewall.extraCommands = lib.concatLines startLines;
|
||||||
networking.firewall.extraStopCommands = lib.concatLines stopLines;
|
networking.firewall.extraStopCommands = lib.concatLines stopLines;
|
||||||
|
Loading…
Reference in New Issue
Block a user