1source: Extensions/Agent-Setup.md
2path: blob/master/doc/
3
4The agent can be used to gather data from remote systems you can use
5LibreNMS in combination with check_mk (found
6[here](https://github.com/librenms/librenms-agent)). The agent can be
7extended to include data about [applications](Applications.md) on the
8remote system.
9
10# Installation
11
12## Linux / BSD
13
14Make sure that systemd or xinetd is installed on the host you want to
15run the agent on.
16
17The agent uses TCP-Port 6556, please allow access from the **LibreNMS
18host** and **poller nodes** if you're using the [Distributed Polling](Distributed-Poller.md)
19setup.
20
21On each of the hosts you would like to use the agent on, you need to do the following:
22
231: Clone the `librenms-agent` repository:
24
25```bash
26cd /opt/
27git clone https://github.com/librenms/librenms-agent.git
28cd librenms-agent
29```
30
312: Copy the relevant check_mk_agent to `/usr/bin`:
32
33| linux | freebsd |
34| --- | --- |
35| `cp check_mk_agent /usr/bin/check_mk_agent` | `cp check_mk_agent_freebsd /usr/bin/check_mk_agent` |
36
37```bash
38chmod +x /usr/bin/check_mk_agent
39```
40
413: Copy the service file(s) into place.
42
43| xinetd | systemd |
44| --- | --- |
45| `cp check_mk_xinetd /etc/xinetd.d/check_mk` | `cp check_mk@.service check_mk.socket /etc/systemd/system` |
46
474: Create the relevant directories.
48
49```bash
50mkdir -p /usr/lib/check_mk_agent/plugins /usr/lib/check_mk_agent/local
51```
52
535: Copy each of the scripts from `agent-local/` into
54`/usr/lib/check_mk_agent/local` that you require to be graphed.  You
55can find detail setup instructions for specific applications above.
56
576: Make each one executable that you want to use with `chmod +x
58/usr/lib/check_mk_agent/local/$script`
59
607: Enable the check_mk service
61
62| xinetd | systemd |
63| --- | --- |
64| `/etc/init.d/xinetd restart` | `systemctl enable check_mk.socket && systemctl start check_mk.socket` |
65
668: Login to the LibreNMS web interface and edit the device you want to
67monitor. Under the modules section, ensure that unix-agent is enabled.
68
699: Then under Applications, enable the apps that you plan to monitor.
70
7110: Wait for around 10 minutes and you should start seeing data in
72your graphs under Apps for the device.
73
74### Restrict the devices on which the agent listens: Linux systemd
75If you want to restrict which network adapter the agent listens on, do the following:
76
771: Edit `/etc/systemd/system/check_mk.socket`
78
792: Under the `[Socket]` section, add a new line `BindToDevice=` and the name of your network adapter.
80
813: If the script has already been enabled in systemd, you may need to issue a `systemctl daemon-reload` and then `systemctl restart check_mk.socket`
82
83
84## Windows
851. Grab version 1.2.6b5 of the check_mk agent from the check_mk github repo (exe/msi or compile it yourself depending on your usage): https://github.com/tribe29/checkmk/tree/v1.2.6b5/agents/windows
862. Run the msi / exe
873. Make sure your LibreNMS instance can reach TCP port 6556 on your target.
88