Various plugins for telegraf

Valérianne Dashie 071e959871
Update nvidia_smi to specify GPU ID
5 months ago
battery_linux docs 8 months ago
icecast2_listeners Add icecast2 listeners 7 months ago
nvidia_smi Update nvidia_smi to specify GPU ID 5 months ago
wireless docs 8 months ago
.gitignore Add icecast2 listeners 7 months ago
LICENSE Initial commit 8 months ago Update readme 7 months ago


Various plugins for telegraf

Build & use

cd plugin-name
go build
cp plugin-name /whatever/you/want
add to /etc/telegraf/telegraf.conf :
  command = "/whatever/you/want/plugin-name"
  data_format = "influx"
some plugins can be configured on command line, try -help for the one indicated


  • Improve and use it instead of /proc/net/wireless
    • quality stats are not accessible directly from wireless_info struct, need to get them using IOCTL (and some structs with an union)


Parses /proc/net/wireless and returns it in influxdb format, one line per interface line in the file

cat /proc/net/wireless
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
 face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22
wlp3s0: 0000   70.  -34.  -256        0      0      0      0   5358        0

pnwireless,interface=wlp3s0 status=0000,qual_link=70,qual_level=-34,qual_noise=-256,disc_pkt_nwid=0,disc_pkt_crypt=0,disc_pkt_frag=0,disc_pkt_retry=0,disc_pkt_misc=5358,missed_beacons=0

nvidia_smi.go (-help)

Get some metrics from nvidia-smi tool

C:\Program Files\NVIDIA Corporation\NVSMI>nvidia-smi.exe --format=csv,noheader,nounits --query-gpu=fan.speed,,memory.used,,pstate,temperature.gpu,name,uuid,compute_mode
34, 2048, 124, 1924, P8, 33, GeForce GTX 770, GPU-24ee6344-5880-6c41-a846-30d4193a6367, Default

nvidiasmi,uuid=GPU-24ee6344-5880-6c41-a846-30d4193a6367 gpu_name="GeForce GTX 770",gpu_compute_mode="Default",fan_speed=34,memory_total=2048,memory_used=247,memory_free=1801,pstate=8,temperature=33

fan_speed = 0-100 (%)
pstate = 0 (maximum perf) to 12 (minimum perf)
compute_mode = Default / Exclusive_Process / Prohibited
uuid = unique identifier of gpu
name = card name
memory_* = in MiB
temperature = in degree celcius


Get batteries informations

See /sys/class/power_supply/BAT0/uevent

battery_linux,battery=BAT0,idx=0 present=1,cycle_count=0,voltage_min_design=11100000,voltage_now=12794000,power_now=0,energy_full_design=62160000,energy_full=57430000,energy_now=57430000,capacity=100

battery = BATx name from /sys/class/power_supply/ folder
idx = the x from BATx
present = is the battery present
cycle_count = well...
voltage_min_design = uV (?)
voltage_now = uV (?)
power_now = uW
energy_full_design = uWh
energy_now = uWh
energy_full = uWh 
capacity = %
battery_status = Textual status (AFAIK can be: [Unknown, Discharging] at least)
capacity_level = Textual capacity level (AFAIK can be: [Normal] at least)

remaining time is (energy_now/1000) / (power_now/1000)
see also

uV to V : uV / 1000000.0 (.0 to get float)
uWh to Wh : uWh / 1000000.0 (.0 to get float)

icecast2_listeners.go (-help)

Get Icecast2 listeners counts

See http://icecast_host:port/admin/listmounts

./icecast2_listeners -addr -pass whateverpassword -host
icecast2, ic2_listeners_response=13.108927000000001
icecast2,,mount=/mymount listeners=0
icecast2, listenerstotal=0

ic2_listeners_response = HTTP call response time in ms
tag mount = the mount point name
listeners = count for this mount point
listenerstotal = total for all mounts
There is one ...,mount=/xxx listeners=xxx per mountpoint