How to have Volt values or other metrics

Hi all,

I am a newbie with influxdb, telegraf and grafana.
I’m trying to make a complete dashboard for my raspberry.
So, I’m looking at what already exists and I can find a lot of good ideas.

First of all, I must specify I’m running all oh these with docker.

I found this : GitHub - robcowart/raspberry_pi_stats: A script to collect various Raspberry Pi statistics, which are sent via Telegraf to InfluxDB.

I find it complete and a lot of metrics I don’t have.

But, unfortunately, the script doesn’t write anything right through telegraf.

When I launch it directly I have :

raspberry_pi,host=Corlypi4b1 soc_temp=38.9,arm_freq=1500398464i,core_freq=500000992i,h264_freq=0i,isp_freq=0i,v3d_freq=500000992i,uart_freq=48001464i,pwm_freq=0i,emmc_freq=250000496i,pixel_freq=81000000i,vec_freq=0i,hdmi_freq=120010256i,dpi_freq=0i,core_volts=0.8375,sdram_c_volts=1.1,sdram_i_volts=1.1,sdram_p_volts=1.1,config_arm_freq=1500000000i,config_core_freq=500000000i,config_gpu_freq=500000000i,config_sdram_freq=0i,arm_mem=998000000i,gpu_mem=16000000i,malloc_total_mem=4000000i,malloc_mem=4000000i,reloc_total_mem=10000000i,reloc_mem=9000000i,oom_count=0i,oom_ms=0i,mem_reloc_allocation_failures=0i,mem_reloc_compactions=0i,mem_reloc_legacy_block_failures=0i

but, through Telegraf I can read this in the logs :

 [inputs.exec] Error in plugin: metric parse error: expected field at 1:39: "raspberry_pi,host=Corlypi4b1 soc_temp=,arm_freq=i,core_freq=i,h264_freq=i,isp_freq=i,v3d_freq=i,uart_freq=i,pwm_freq=i,emmc_freq=i,pixel_freq=i,vec_freq=i,hdmi_freq=i,dpi_freq=i,core_volts=,sdram_c_volts=,sdram_i_volts=,sdram_p_volts=,config_arm_freq=i,config_core_freq=i,config_gpu_freq=i,config_sdram_freq=i,arm_mem=i,gpu_mem=i,malloc_total_mem=i,malloc_mem=i,reloc_total_mem=i,reloc_mem=i,oom_count=i,oom_ms=i,mem_reloc_allocation_failures=i,mem_reloc_compactions=i,mem_reloc_legacy_block_failures=i"

I don’t really understand, maybe it’s related to an old version of telegraf and that’s why it doesn’t work anymore.
But maybe someone ther knows how to add these metrics in order to add them in Influxdb and grafana.

thank you for your help, please let me know if you need mor info

The issue is in the shell script as there are no values for the fields. Maybe that’s a permission issue, but nothing that Telegraf can fix as the metric is already “broken” when handed over to Telegraf…

Is there any reason you are using the script instead of parsing the output of the underlying command in Telegraf?

Hello Srebhan,
thank you for your answer.

in fact I don’t know if there is an other way to get the metrics, as I wrote, i’m a new telegraf & influxdb user.

I think it could be a permission issue but I don’t really know how to get rid of this, or it could also be because it cannot find what he need and I should add some env volumes…
but I am a little bit lost.
that’s why I was asking if someone tried to have these metrics, already used this kind of script or use another way to have this.

What would you recommend ?

@gcorly I have two suggestions for you. First, you could run the script called by Telegraf manually and verify that the fields are filled correctly. If that works, you can try to run Telegraf as exactly the same user manually (i.e. run telegraf not the systemd service) using the --test --debug option. If this works, probably your user running Telegraf in your systemd service does not have sufficient permissions.

As a second recommendation, you could take a look at Telegraf’s plugins and check if we got you covered.

@srebhan thank you for these advices.
I will take a look at Telegraf’s plugins.

For your 1st suggestion :
I am running telegraf through docker and I tried to launch the script, even just a command and it seems that telegraf docker user doesn’t have sufficient permissions.
and another things to change in order to make it work in fact.
I must add some entries in order to link path and libraries.
I worked on it yesterday but it’s tricky, now for example I can launch vcgencmd but the libraries are not reachable…

I tried to add LD_LIBRARY_PATH but It does not work either… I am working on it but I’m still looking for advices or other way to have these metrics.

thank you for your help

@srebhan I achieve to got what I wanted.

you were right, it was permissions issue.
I didn’t know how to add multiples group to Telegraf user, as I’m running it through docker.

For everyone who could be in the the same situation as me, I tried a lot of things in my docker compose
but the right way to do this is to add these lines :

user: telegraf:990
group_add:
- video

now everything is good.

thank you for your help

1 Like