Netdata: Difference between revisions

From NixOS Wiki
imported>Plate1117
Added info on adding the node.
imported>Hurricanehrndz
mNo edit summary
Line 24: Line 24:
== samba ==
== samba ==


To enable <code>samba</code> plugin a lot of things need to be done.
To enable <code>samba</code> plugin additional permissions and configurations will need to be set.


<blockquote>Still I could not make samba to work, because systemd services seem to be forbidden to run sudo. Please update if you are able to make it work.
<pre>
</blockquote>
<pre>systemd.services.enable = true;
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 34: Line 32:


# add samba and sudo to path of python plugin
# add samba and sudo to path of python plugin
systemd.services.netdata.path = [ pkgs.sudo pkgs.samba ];
systemd.services.netdata.path = [ pkgs.samba &quot;/run/wrappers&quot; ];


# permit to run sudo smbstatus -P
# permit to run sudo smbstatus -P
Line 40: Line 38:
   netdata ALL=(root) NOPASSWD: ${pkgs.samba}/bin/smbstatus
   netdata ALL=(root) NOPASSWD: ${pkgs.samba}/bin/smbstatus
'';
'';
# as documented here : https://learn.netdata.cloud/docs/agent/collectors/python.d.plugin/samba
 
# but seem not to work
# as documented here : https://github.com/netdata/netdata/blob/master/system/netdata.service.in
systemd.services.netdata.serviceConfig.CapabilityBoundingSet = [&quot;~&quot;];</pre>
# review capabilityset above if other plugins are non functional
systemd.services.netdata.serviceConfig.CapabilityBoundingSet = [&quot;CAP_SETGID&quot;];</pre>
 
# enable profiling
services.samba.extraConfig = ''
smbd profiling level = on
'';

Revision as of 15:54, 8 November 2022

netdata is a metrics tool, which comes with a lot of sane preconfiguration. It contains of various plugins, which need to be enabled sometimes with additional effort.

Adding node

  • Install the netdata package and enable the service.
  • When adding new node in the web interface you get a token, write that token to /var/lib/netdata/cloud.d/token
  • As root run nix-shell -p netdata --run "netdata-claim.sh"


Python Plugins

nvidia-smi

To enable the nvidia-smi plugin you have to make sure nvidia-smi can be called by netdata.

systemd.services.enable = true;
systemd.services.netdata.path = [pkgs.linuxPackages.nvidia_x11];
services.netdata.configDir."python.d.conf" = pkgs.writeText "python.d.conf" ''
  nvidia_smi: yes
'';

samba

To enable samba plugin additional permissions and configurations will need to be set.

services.netdata.configDir."python.d.conf" = pkgs.writeText "python.d.conf" ''
  samba: yes
'';

# add samba and sudo to path of python plugin
systemd.services.netdata.path = [  pkgs.samba "/run/wrappers" ];

# permit to run sudo smbstatus -P
security.sudo.extraConfig = ''
  netdata ALL=(root) NOPASSWD: ${pkgs.samba}/bin/smbstatus
'';

# as documented here : https://github.com/netdata/netdata/blob/master/system/netdata.service.in
# review capabilityset above if other plugins are non functional
systemd.services.netdata.serviceConfig.CapabilityBoundingSet = ["CAP_SETGID"];
  1. enable profiling

services.samba.extraConfig = smbd profiling level = on ;