Synchronize hosts/containers/grafana
This commit is contained in:
parent
5810750141
commit
ca44a44ede
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
<nixpkgs/nixos/modules/profiles/minimal.nix>
|
||||||
../../../lib
|
../../../lib
|
||||||
../../../lib/lxc-container.nix
|
../../../lib/lxc-container.nix
|
||||||
../../../lib/shared.nix
|
../../../lib/shared.nix
|
||||||
|
@ -15,21 +16,27 @@
|
||||||
hq.interface = "eth0";
|
hq.interface = "eth0";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.openssh.enable = true;
|
||||||
|
|
||||||
|
boot.isContainer = true;
|
||||||
|
# /sbin/init
|
||||||
|
boot.loader.initScript.enable = true;
|
||||||
|
boot.loader.grub.enable = false;
|
||||||
|
|
||||||
networking.hostName = "grafana";
|
networking.hostName = "grafana";
|
||||||
networking.useNetworkd = true;
|
networking.useNetworkd = true;
|
||||||
# Needs IPv4 for obtaining certs?
|
|
||||||
networking.useDHCP = false;
|
|
||||||
networking.interfaces.eth0.useDHCP = true;
|
|
||||||
services.resolved.enable = false;
|
|
||||||
|
|
||||||
# List packages installed in system profile. To search, run:
|
# Create a few files early before packing tarball for Proxmox
|
||||||
# $ nix search wget
|
# architecture/OS detection.
|
||||||
environment.systemPackages = with pkgs; [
|
system.extraSystemBuilderCmds = ''
|
||||||
vim
|
mkdir -m 0755 -p $out/bin
|
||||||
];
|
ln -s ${pkgs.bash}/bin/bash $out/bin/sh
|
||||||
|
mkdir -m 0755 -p $out/sbin
|
||||||
|
ln -s ../init $out/sbin/init
|
||||||
|
'';
|
||||||
|
|
||||||
# http https
|
# http https influxdb
|
||||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
networking.firewall.allowedTCPPorts = [ 80 443 8086 ];
|
||||||
# collectd
|
# collectd
|
||||||
networking.firewall.allowedUDPPorts = [ 25826 ];
|
networking.firewall.allowedUDPPorts = [ 25826 ];
|
||||||
|
|
||||||
|
@ -37,8 +44,8 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
agree = true;
|
agree = true;
|
||||||
config = ''
|
config = ''
|
||||||
grafana.hq.c3d2.de
|
grafana.hq.c3d2.de
|
||||||
proxy / localhost:3000
|
proxy / localhost:3000
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
services.grafana = {
|
services.grafana = {
|
||||||
|
@ -49,32 +56,31 @@
|
||||||
};
|
};
|
||||||
users.allowSignUp = true;
|
users.allowSignUp = true;
|
||||||
};
|
};
|
||||||
services.influxdb =
|
services.influxdb = let
|
||||||
let
|
collectdTypes = pkgs.stdenv.mkDerivation {
|
||||||
collectdTypes = pkgs.stdenv.mkDerivation {
|
name = "collectd-types";
|
||||||
name = "collectd-types";
|
src = ./.;
|
||||||
src = ./.;
|
buildInputs = [ pkgs.collectd ];
|
||||||
buildInputs = [ pkgs.collectd ];
|
buildPhase = ''
|
||||||
buildPhase = ''
|
mkdir -p $out/share/collectd
|
||||||
mkdir -p $out/share/collectd
|
cat ${pkgs.collectd}/share/collectd/types.db >> $out/share/collectd/types.db
|
||||||
cat ${pkgs.collectd}/share/collectd/types.db >> $out/share/collectd/types.db
|
echo "stations value:GAUGE:0:U" >> $out/share/collectd/types.db
|
||||||
echo "stations value:GAUGE:0:U" >> $out/share/collectd/types.db
|
'';
|
||||||
'';
|
installPhase = ''
|
||||||
installPhase = ''
|
cp -r . $out
|
||||||
cp -r . $out
|
'';
|
||||||
'';
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
enable = true;
|
|
||||||
extraConfig = {
|
|
||||||
logging.level = "debug";
|
|
||||||
collectd = [{
|
|
||||||
enabled = true;
|
|
||||||
database = "collectd";
|
|
||||||
typesdb = "${collectdTypes}/share/collectd/types.db";
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = {
|
||||||
|
logging.level = "debug";
|
||||||
|
collectd = [{
|
||||||
|
enabled = true;
|
||||||
|
database = "collectd";
|
||||||
|
typesdb = "${collectdTypes}/share/collectd/types.db";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# This value determines the NixOS release with which your system is to be
|
# This value determines the NixOS release with which your system is to be
|
||||||
# compatible, in order to avoid breaking some software such as database
|
# compatible, in order to avoid breaking some software such as database
|
||||||
|
@ -82,4 +88,3 @@
|
||||||
# should.
|
# should.
|
||||||
system.stateVersion = "18.09"; # Did you read the comment?
|
system.stateVersion = "18.09"; # Did you read the comment?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue