Netdata: Difference between revisions

imported>RaitoBezarius
explain how to do streaming node setups
imported>Ncfavier
m add syntax highlighting
Line 15: Line 15:
=== Receiver node ===
=== Receiver node ===


<pre>
<syntaxhighlight lang="nix">
  services.netdata.configDir."stream.conf" =
services.netdata.configDir."stream.conf" =
    let
  let
        mkChildNode = apiKey: allowFrom: ''
    mkChildNode = apiKey: allowFrom: ''
          [${apiKey}]
      [${apiKey}]
            enabled = yes
        enabled = yes
            default history = <a value of your choice>
        default history = <a value of your choice>
            default memory mode = dbengine # a good default
        default memory mode = dbengine # a good default
            health enabled by default = auto
        health enabled by default = auto
            allow from = ${allowFrom}
        allow from = ${allowFrom}
        '';
    '';
      in pkgs.writeText "stream.conf" ''
  in pkgs.writeText "stream.conf" ''
        [stream]
    [stream]
          # This won't stream by itself, except if the receiver is a sender too, which is possible in netdata model.
      # This won't stream by itself, except if the receiver is a sender too, which is possible in netdata model.
          enabled = no
      enabled = no
          enable compression = yes
      enable compression = yes


        # An allowed sender node
    # An allowed sender node
        ${mkChildNode "an API key" "an allowed IP"}
    ${mkChildNode "an API key" "an allowed IP"}
      '';
  '';
</pre>
</syntaxhighlight>


=== Sender node ===
=== Sender node ===


<pre>
<syntaxhighlight lang="nix">
  services.netdata.configDir."stream.conf" = pkgs.writeText "stream.conf" ''
services.netdata.configDir."stream.conf" = pkgs.writeText "stream.conf" ''
      [stream]  
  [stream]
        enabled = yes
    enabled = yes
        destination = receiver-hostname-or-ip-address:19999
    destination = receiver-hostname-or-ip-address:19999
        api key = any string that is set also on the receiver side
    api key = any string that is set also on the receiver side
    '';
'';
</pre>
</syntaxhighlight>


If you don't need any web UI and want to consume minimal resources on the sender node, use:
If you don't need any web UI and want to consume minimal resources on the sender node, use:


<pre>
<syntaxhighlight lang="nix">
  services.netdata = {
services.netdata = {
    config = {
  config = {
      global = { "memory mode" = "none"; };
    global = { "memory mode" = "none"; };
      web = {
    web = {
        mode = "none";
      mode = "none";
        "accept a streaming request every seconds" = 0;
      "accept a streaming request every seconds" = 0;
      };
     };
     };
   };
   };
</pre>
};
</syntaxhighlight>


This way, it won't spawn any web UI, neither store any metric locally.
This way, it won't spawn any web UI, neither store any metric locally.
Line 71: Line 71:
To enable the <code>nvidia-smi</code> plugin you have to make sure <code>nvidia-smi</code> can be called by <code>netdata</code>.
To enable the <code>nvidia-smi</code> plugin you have to make sure <code>nvidia-smi</code> can be called by <code>netdata</code>.


<pre>systemd.services.enable = true;
<syntaxhighlight lang="nix">
systemd.services.enable = true;
systemd.services.netdata.path = [pkgs.linuxPackages.nvidia_x11];
systemd.services.netdata.path = [pkgs.linuxPackages.nvidia_x11];
services.netdata.configDir.&quot;python.d.conf&quot; = pkgs.writeText &quot;python.d.conf&quot; ''
services.netdata.configDir.&quot;python.d.conf&quot; = pkgs.writeText &quot;python.d.conf&quot; ''
   nvidia_smi: yes
   nvidia_smi: yes
'';</pre>
'';
</syntaxhighlight>
== samba ==
== samba ==


To enable <code>samba</code> plugin additional permissions and configurations will need to be set.
To enable <code>samba</code> plugin additional permissions and configurations will need to be set.


<pre>
<syntaxhighlight lang="nix">
services.netdata.configDir.&quot;python.d.conf&quot; = pkgs.writeText &quot;python.d.conf&quot; ''
services.netdata.configDir.&quot;python.d.conf&quot; = pkgs.writeText &quot;python.d.conf&quot; ''
   samba: yes
   samba: yes
Line 99: Line 101:
# enable profiling
# enable profiling
services.samba.extraConfig = ''
services.samba.extraConfig = ''
smbd profiling level = on
  smbd profiling level = on
'';
'';
</pre>
</syntaxhighlight>