@cryptotaxi247 / netdata-1 / commits / f2329db8b

Start-stop-restart for windows, plus move info to its own file (#18894)

Co-authored-by: ilyam8 <ilya@netdata.cloud>

Fotis Voutsas committed Oct 30, 2024 at 11:51 UTC f2329db8bbdfeb21cfa7ea577fc4f04c8c56eb51
2 files changed +31 -128
docs/netdata-agent/reload-health-configuration.md new
+9
@@ -0,0 +1,9 @@
1 +# Reload health configuration
2 +
3 +## Unix systems
4 +
5 +No need to restart the Netdata Agent after modifying health configuration files (alerts). Use `netdatacli` to avoid metric collection gaps.
6 +
7 +```bash
8 +sudo netdatacli reload-health
9 +```
docs/netdata-agent/start-stop-restart.md
+22 -128
@@ -1,28 +1,22 @@
1 # Start, stop, or restart the Netdata Agent
2
3 -When you install the Netdata Agent, the [daemon](/src/daemon/README.md) is
4 -configured to start at boot and stop and restart/shutdown.
3 +The Netdata Agent automatically starts at boot after installation.
4
6 -You will most often need to _restart_ the Agent to load new or editing configuration files.
7 -[Health configuration](#reload-health-configuration) files are the only exception, as they can be reloaded without restarting
8 -the entire Agent.
5 +> In most cases, you need to **restart the Netdata service** to apply changes to configuration files. [Health configuration](/docs/netdata-agent/reload-health-configuration.md) files, which define alerts, are an exception. They can be reloaded **without restarting** by using the `netdatacli` tool.
6 +>
7 +> Restarting the Netdata Agent will cause temporary gaps in your collected metrics. This occurs while the netdata process reinitializes its data collectors and database engine.
8
10 -Stopping or restarting the Netdata Agent will cause gaps in stored metrics until the `netdata` process initiates
11 -collectors and the database engine.
9 +## Unix systems
10
13 -## Using `systemctl`, `service`, or `init.d`
11 +### Using `systemctl`, `service`, or `init.d`
12
15 -This is the recommended way to start, stop, or restart the Netdata daemon.
13 +| Action | Systemd | Non-systemd |
14 +|---------|--------------------------------|------------------------------|
15 +| start | `sudo systemctl start netdata` | `sudo service netdata start` |
16 +| stop | `sudo systemctl stop netdata` | `sudo service netdata stop` |
17 +| restart | `sudo systemctl stop netdata` | `sudo service netdata stop` |
18
17 -- To **start** Netdata, run `sudo systemctl start netdata`.
18 -- To **stop** Netdata, run `sudo systemctl stop netdata`.
19 -- To **restart** Netdata, run `sudo systemctl restart netdata`.
20 -
21 -If the above commands fail, or you know that you're using a non-systemd system, try using the `service` command:
22 -
23 -- **service**: `sudo service netdata start`, `sudo service netdata stop`, `sudo service netdata restart`
24 -
25 -## Using `netdata`
19 +### Using `netdata`
20
21 Use the `netdata` command, typically located at `/usr/sbin/netdata`, to start the Netdata daemon.
22
@@ -32,122 +26,22 @@ sudo netdata
26
27 If you start the daemon this way, close it with `sudo killall netdata`.
28
35 -## Using `netdatacli`
29 +### Using `netdatacli`
30
37 -The Netdata Agent also comes with a [CLI tool](/src/cli/README.md) capable of performing shutdowns. Start the Agent back up
38 -using your preferred method listed above.
31 +The Netdata Agent also comes with a [CLI tool](/src/cli/README.md) capable of performing shutdowns. Start the Agent back up using your preferred method listed above.
32
33 ```bash
34 sudo netdatacli shutdown-agent
35 ```
36
44 -## Netdata MSI installations
45 -
46 -Netdata provides an installer for Windows using WSL, on those installations by using a Windows terminal (e.g. the Command prompt or Windows Powershell) you can:
47 -
48 -- Start Netdata, by running `start-netdata`
49 -- Stop Netdata, by running `stop-netdata`
50 -- Restart Netdata, by running `restart-netdata`
51 -
52 -## Reload health configuration
53 -
54 -You do not need to restart the Netdata Agent between changes to health configuration files, such as specific health
55 -entities. Instead, use [`netdatacli`](#using-netdatacli) and the `reload-health` option to prevent gaps in metrics
56 -collection.
57 -
58 -```bash
59 -sudo netdatacli reload-health
60 -```
61 -
62 -If `netdatacli` doesn't work on your system, send a `SIGUSR2` signal to the daemon, which reloads health configuration
63 -without restarting the entire process.
64 -
65 -```bash
66 -killall -USR2 netdata
67 -```
68 -
69 -## Force stop stalled or unresponsive `netdata` processes
70 -
71 -In rare cases, the Netdata Agent may stall or not properly close sockets, preventing a new process from starting. In
72 -these cases, try the following three commands:
73 -
74 -```bash
75 -sudo systemctl stop netdata
76 -sudo killall netdata
77 -ps aux| grep netdata
78 -```
79 -
80 -The output of `ps aux` should show no `netdata` or associated processes running. You can now start the Netdata Agent
81 -again with `service netdata start`, or the appropriate method for your system.
82 -
83 -## Starting Netdata at boot
84 -
85 -In the `system` directory you can find scripts and configurations for the
86 -various distros.
87 -
88 -### systemd
89 -
90 -The installer already installs `netdata.service` if it detects a systemd system.
91 -
92 -To install `netdata.service` by hand, run:
93 -
94 -```sh
95 -# stop Netdata
96 -killall netdata
97 -
98 -# copy netdata.service to systemd
99 -cp system/netdata.service /etc/systemd/system/
100 -
101 -# let systemd know there is a new service
102 -systemctl daemon-reload
103 -
104 -# enable Netdata at boot
105 -systemctl enable netdata
106 -
107 -# start Netdata
108 -systemctl start netdata
109 -```
110 -
111 -### init.d
112 -
113 -In the system directory you can find `netdata-lsb`. Copy it to the proper place according to your distribution
114 -documentation. For Ubuntu, this can be done via running the following commands as root.
115 -
116 -```sh
117 -# copy the Netdata startup file to /etc/init.d
118 -cp system/netdata-lsb /etc/init.d/netdata
119 -
120 -# make sure it is executable
121 -chmod +x /etc/init.d/netdata
122 -
123 -# enable it
124 -update-rc.d netdata defaults
125 -```
126 -
127 -### openrc (gentoo)
128 -
129 -In the `system` directory you can find `netdata-openrc`. Copy it to the proper
130 -place according to your distribution documentation.
131 -
132 -### CentOS / Red Hat Enterprise Linux
133 -
134 -For older versions of RHEL/CentOS that don't have systemd, an init script is included in the system directory. This can
135 -be installed by running the following commands as root.
136 -
137 -```sh
138 -# copy the Netdata startup file to /etc/init.d
139 -cp system/netdata-init-d /etc/init.d/netdata
140 -
141 -# make sure it is executable
142 -chmod +x /etc/init.d/netdata
143 -
144 -# enable it
145 -chkconfig --add netdata
146 -```
37 +## Windows systems
38
148 -_There have been some recent work on the init script, see PR
149 -<https://github.com/netdata/netdata/pull/403>_
39 +> **Note**
40 +>
41 +> You will need to run PowerShell as administrator.
42
151 -### other systems
43 +- To **start** Netdata, run `Start-Service Netdata`.
44 +- To **stop** Netdata, run `Stop-Service Netdata`.
45 +- To **restart** Netdata, run `Restart-Service Netdata`.
46
153 -You can start Netdata by running it from `/etc/rc.local` or equivalent.
47 +If you prefer to manage the Agent through the GUI, you can start-stop and restart the `Netdata` service from the "Services" tab of Task Manager.