Bug #10522
closedTelegraf, Netstat fails (missing lsof)
100%
Description
Enabling netstat from the web interface (as part of Telegraf) ... fails. The error message can be seen from a command line test run,
telegraf --test --input-filter netstat --config /usr/local/etc/telegraf.conf
2020-05-03T03:18:31Z I! Starting Telegraf 1.13.4 2020-05-03T03:18:31Z E! [inputs.netstat] Error in plugin: error getting net connections info: exec: "lsof": executable file not found in $PATH 2020-05-03T03:18:31Z E! [telegraf] Error running agent: One or more input plugins had an error
The fix is to manually install lsof, but shouldn't it be part of the package, to avoid this extra manual step?
Thanks!
Updated by Manuel Piovan about 5 years ago
can't reproduce, it work for me
[2.4.5-RELEASE][root@pfSense.trmultiservice.lab]/root: telegraf --test --input-filter netstat --config /usr/local/etc/telegraf.conf
2020-05-04T18:55:20Z I! Starting Telegraf 1.13.4
netstat,host=pfSense.trmultiservice.lab tcp_close=0i,tcp_close_wait=0i,tcp_closing=0i,tcp_established=3i,tcp_fin_wait1=0i,tcp_fin_wait2=0i,tcp_last_ack=0i,tcp_listen=14i,tcp_none=0i,tcp_syn_recv=0i,tcp_syn_sent=0i,tcp_time_wait=0i,udp_socket=17i 1588618521000000000
the path is /usr/local/sbin/lsof
check your config or
try to reinstall lsof with
pkg install --force lsof-4.93.2_9,8
or ask the forum
Updated by Russell Morris about 5 years ago
Yes, it works for me as well - after I manually install lsof. The reason I raised this is that lsof should be included when telegraf is installed ... agreed?
Thanks!
Updated by Viktor Gurov about 5 years ago
correct, see https://github.com/influxdata/telegraf/blob/master/plugins/inputs/net/NETSTAT_README.md:
Netstat Input Plugin This plugin collects TCP connections state and UDP socket counts by using lsof.
Updated by Jim Pingle about 5 years ago
- Status changed from New to Pull Request Review
Updated by Renato Botelho about 5 years ago
- Status changed from Pull Request Review to Feedback
- Assignee set to Renato Botelho
- % Done changed from 0 to 100
PR has been merged. Thanks!
Updated by Russell Morris about 5 years ago
Thanks very much for the quick action!
Updated by Viktor Gurov almost 5 years ago
- Status changed from Feedback to Resolved
Good:
New packages to be INSTALLED: pfSense-pkg-Telegraf: 0.9_4 [pfSense] lsof: 4.93.2_9,8 [pfSense] telegraf: 1.13.4_1 [pfSense] Number of packages to be installed: 3 The process will require 66 MiB more space. 14 MiB to be downloaded. [1/3] Fetching pfSense-pkg-Telegraf-0.9_4.txz: . done [2/3] Fetching lsof-4.93.2_9,8.txz: .......... done [3/3] Fetching telegraf-1.13.4_1.txz: .......... done ...