Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

level=fatal msg="open /dev/cuaU0: device busy" #9

Closed
sachaz opened this issue Oct 17, 2022 · 43 comments
Closed

level=fatal msg="open /dev/cuaU0: device busy" #9

sachaz opened this issue Oct 17, 2022 · 43 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@sachaz
Copy link

sachaz commented Oct 17, 2022

Hi,
On compiled linky_exporter v2.0.1 on OpenBSD
/usr/local/bin/linky_exporter -d /dev/cuaU0 -p 9101

I got messages like open /dev/cuaU0: device busy

cu or minicom on this device is working

@syberalexis
Copy link
Owner

Hi,

Your device seems used by another process on your machine.

You can check that with the command : lsof /dev/cuaU0

@sachaz
Copy link
Author

sachaz commented Oct 17, 2022

Thanks but I have allready checked with a gnuwatch "fstat |grep cuaU0"
The only process using /dev/cuaU0 is _nodeexp linky_exporter 28904 8 / 16830 crw-rw---- rwe cuaU0

@syberalexis
Copy link
Owner

syberalexis commented Oct 24, 2022

EDIT : Can you try to compile from source in your openbsd please ?

Like this :

git clone git@github.com:syberalexis/linky-exporter.git
cd linky-exporter
GOOS=openbsd GOARCH=amd64 VERSION=0.1.3 make clean build
./dist/linky-exporter-0.1.3-openbsd-amd64

EDIT 2 : Sorry, i didn't understand the situation faster ^^

@sachaz
Copy link
Author

sachaz commented Oct 27, 2022

HI,
thanks for your replies <3

Openbsd 7.1
go1.17.7
I already compiled from source (I didn't found binaries for OpenBSD), the code is v2.0.1

@syberalexis
Copy link
Owner

Hi,
Can you try to compile with go 1.14 ?
I will try to install a BSD and reproduce your bug.

@syberalexis
Copy link
Owner

syberalexis commented Oct 30, 2022

Hum, the dependency to use serial port have a PR to support freebsd : https://github.com/tarm/serial/pull/55/files.
I will try to compile with this or search an other dependency.

@sachaz
Copy link
Author

sachaz commented Nov 1, 2022

Hi,
Please note than I'm talking about OpenBSD, not others *BSD.

@syberalexis
Copy link
Owner

Oh yes, sorry.
The library i use to run serial doesn't support OpenBSD or FreeBSD.
I try to use an other serial library to support them and compile an OpenBSD exporter to you.

@syberalexis
Copy link
Owner

You can find an OpenBSD version in release https://github.com/syberalexis/linky-exporter/releases/tag/v2.1.0
Can you try one and tell me if it works please ?

@sachaz
Copy link
Author

sachaz commented Nov 2, 2022

Hi,
thanks for your reply.

I tried to compile & from binary, I get the same issue: Serial port busy :(

#/usr/local/bin/linky_exporter -d /dev/cuaU0 --port=9101 --baud=9600 --parity="ParityNone" --size=7 --stopbits="Stop1"
INFO[0000] Beginning to serve on port :9101             
FATA[0017] Serial port busy 

@syberalexis syberalexis self-assigned this Nov 2, 2022
@syberalexis syberalexis added the bug Something isn't working label Nov 2, 2022
@syberalexis
Copy link
Owner

Hi,
Oh damn :(
Do you run the exporter with root user ?
I try to find a compatible mini computer to install OpenBSD..

@jude16
Copy link

jude16 commented Nov 3, 2022

Hi,

Same issue here in a docker container running on raspberry.
I can successfully reach the metrics once, but if I reload the page, it says the port is busy.

I’m running the latest version, my Dockerfile :

FROM golang:1.19 as builder
RUN mkdir /build
ADD . /build/
WORKDIR /build
RUN CGO_ENABLED=0 GOOS=linux make build


FROM alpine:3
ARG VERSION
COPY --from=builder /build/dist/linky-exporter-${VERSION}-linux-arm64 linky-exporter
RUN addgroup -S exporter && adduser -S exporter -G exporter
#USER exporter
ENTRYPOINT [ "./linky-exporter" ]

I had to comment the USER argument due to permission issue.

I’ll try to reproduce with a previous release of linky-exporter

@jude16
Copy link

jude16 commented Nov 3, 2022

I’m not reproducing the problem with v2.0.1

@syberalexis
Copy link
Owner

Hi jude16,

Thank you for your testing and review.
I passed the v2.1.0 in pre-release. I will need to reinstall my test plateform to release a better version.

@sachaz
Copy link
Author

sachaz commented Nov 4, 2022

Yes I tried as root too :(

@syberalexis
Copy link
Owner

Hi sachaz,
I see you try baudrate 9600.
Does your Linky is in Standard TIC mode ? or Historical TIC mode ?
Can you print me the cu command with a first result of a TIC please.

@sachaz
Copy link
Author

sachaz commented Nov 13, 2022

hey,

As far I know I'm in strandard TIC mode (we asked to Enercoop to active the "advanced mode".

I use minicom:

cat /etc/minicom/minirc.dfl 
# Machine-generated file - use "minicom -s" to change parameters.
pu port             /dev/cuaU0
pu baudrate         9600
pu bits             7
pu parity           E
pu stopbits         1
Bienvenue dans minicom 2.8

OPTIONS: I18n 
Compilé le Apr  8 2022, 08:49:03.
Port /dev/cuaU0

Bienvenue dans minicom 2.8

OPTIONS: I18n 
Compilé le Apr  8 2022, 08:49:03.
Port /dev/cuaU0, 15:35:07

Tapez CTRL-A Z pour voir l'aide concernant les touches spéciales


MSG1         PAS DE          MESSAGE            <
PRM     16140520874326  2
RELAIS  000     B
NTARF   01      N
NJOURF  00      &
NJOURF+1        00      B
PJOURF+1        00008001 NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE NONUTILE      9
  ADSC  XXXXXX    7
VTIC    02      J
DATE    H221113153547           D
NGTF          BASE              <
EASTF   040626660E      -       F
EASF01  040393601       <
EASF02  000233059       9
EASF03  000000000       $
EASF04  000000000       %
EASF05  000000000       &
EASF06  000000000       '
EASF07  000000000       (
EASF08  000000000       )
EASF09  000000000       *
EASF10  000000000       "
EASD01  040626660       >
EASD02  000000000       !
EASD03  000000000       "
EASD04  000000000       #
IRMS1   007     5
URMS1   239     H
PREF    06      E
PCOUP   06      _
SINSTS  01700   N
SMAXSN  H221113002750   01750   2
SMAXSN-1        H221112151524   01750   S
CCASN   H221113150000   01421   3
CCASN-1 H221113140000   01430   P
UMOY1   H221113153000   236     ,
STGE    00DA0001        K
MSG1         PAS DE          MESSAGE            <
PRM     16140520874326  2
RELAIS  000     B
NTARF   01      N
NJOURF  00      &
NJOURF+1        00      B

@syberalexis
Copy link
Owner

syberalexis commented Nov 13, 2022

Hi,

Oh, the exporter doesn't support Standard TIC mode for now.
An issue is open (#7) and I need to work on it to add the support ;)
You can try the fork from this repo by hugocollignon but i think it doesn't support OpenBSD too.
If you try it, tell me if it work, please.

I try to work on it this week or the week after ;)

Have a nice week.

EDIT: I edit your post to hide your linky id ;)

@sachaz
Copy link
Author

sachaz commented Nov 15, 2022

Hi,

hoooooo okay !maybe add this information in your readme ?
Thanks for the kindness of hiding the id ;)
I will tell you if I test the fork

@syberalexis
Copy link
Owner

Hi,

Yes, I prepare a better version of the project.
With standard and historical tic mode, more documentation, dashboard example, etc.
And potentially an integration with Home Assistant.
At the begin of the project, I didn’t see there have two modes ^^

@sachaz
Copy link
Author

sachaz commented Nov 17, 2022

Hi,
as Enercoop, they didn't knew that mode before we asked for it activation.
Our non profit hosting center would be pleased to have this tool ;)

@hugocollignon
Copy link

Hello

Yes I think we are only few geeks which read this (https://www.enedis.fr/media/2035/download) Enedis documentation to see that there are 2 modes, historical & standard.

French part (because this applies only here):

  • Demande faite à mon précédent fournisseur d'énergie de basculer la TIC d'historique à standard
  • Ils m'ont répondu de demander à Enedis
  • Enedis m'a dit que c'est à faire côté fournisseur : ils ont un portail sur une appli d'Enedis qui permet de changer ces options, que ce soit TIC, puissance allouée etc
  • Le fournisseur ne connaissait pas l'option, sans doute que jamais personne ne demande ça, il a fallu leur donner le code prestation d'Enedis, voir https://www.enedis.fr/media/2014/download, page 30, prestation F185, option 1 (gratuite dans le cas d'un Linky)
  • Il y a vraiment beaucoup plus d'infos en version standard, et la TIC écrit beaucoup plus vite !

@sachaz
Copy link
Author

sachaz commented Nov 29, 2022

Thanks @hugocollignon it's helpfull for a non-enedis provider request for standard mode.

@syberalexis
Copy link
Owner

syberalexis commented Dec 8, 2022

Hello,

I have a little good news.
I find the time to rewrite the code.

Can you try this new version and tell me if it's work and send produced metrics please or produced error ^^
It's not a final version, i have one bug to track ^^

To build the new version :

git clone  git@github.com:syberalexis/linky-exporter.git
cd linky-exporter
git checkout standard-tic-mode

Choose the good command to build on your destination environment ;)
OpenBSD amd64 :

BUILD_GO111MODULE=on GOOS=openbsd GOARCH=amd64 make clean build

OpenBSD armv6 :

BUILD_GO111MODULE=on GOOS=openbsd GOARCH=arm GOARM=6 make clean build

OpenBSD armv7 :

BUILD_GO111MODULE=on GOOS=openbsd GOARCH=arm GOARM=7 make clean build

Linux amd64 :

BUILD_GO111MODULE=on GOOS=linux GOARCH=amd64 make clean build

Linux armv6 :

BUILD_GO111MODULE=on GOOS=linux GOARCH=arm GOARM=6 make clean build

Linux armv7 :

BUILD_GO111MODULE=on GOOS=linux GOARCH=arm GOARM=7 make clean build

I will start in few days code comments and refoactoring.
Documentation, dashboard will appear after.

Have a nice day.

@sachaz
Copy link
Author

sachaz commented Dec 8, 2022

Salut syberalexis,

Waowww with this winter getting colder this is a good news :)

Here are my steps:

git clone https://github.com/syberalexis/linky-exporter.git
cd linky-exporter/ && git checkout standard-tic-mode

then try to build:

BUILD_GO111MODULE=on GOOS=openbsd GOARCH=amd64 make clean build

No closing parenthesis in archive specification
*** Parse error in /home/sacha/linky-exporter: Error in archive specification: "(amd64, arm)" (Makefile:10)
*** Parse error: Need an operator in 'else' (Makefile:12)
*** Parse error: Need an operator in 'endif' (Makefile:14)
*** Parse error: Missing dependency operator (Makefile:42)
*** Parse error: Need an operator in 'endif' (Makefile:44)

There is an error in your variables declaration in the Makefile ?

Have a nice day

@syberalexis
Copy link
Owner

Hello sachaz,

It’ seems to be make command is different on openbsd than other unix systems. Can you try the command gmake in replacement of make, please.

Have a nice evening.

@sachaz
Copy link
Author

sachaz commented Dec 9, 2022

Hey syberalexis,

Sure you are right it's gmake to be used here.
When I launch it with dist/linky-exporter--openbsd-amd64 -d /dev/cuaU0 --port=9101 --baud=9600 --parity="ParityNone" --size=7 --stopbits="Stop1"
After some tries I got again the message: ERRO[0712] open /dev/cuaU0: device busy
And it seems to not have the right values:

linky_energy_total{linky_id="",mode="used"} 0
# HELP linky_intensity Courant efficace en A
# TYPE linky_intensity gauge
linky_intensity{linky_id="",phase="1"} 0
# HELP linky_timestamp Synchronized timestamp in Linky
# TYPE linky_timestamp counter
linky_timestamp{contract="",linky_id="",pricing="",version="1"} 0
# HELP linky_voltage Tension efficace en V
# TYPE linky_voltage gauge
linky_voltage{linky_id="",phase="1"} 0
# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.
# TYPE promhttp_metric_handler_requests_in_flight gauge
promhttp_metric_handler_requests_in_flight 1
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 2
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0

after if I try a minicom/cu on the /dev/cua00 the device is still busy

Kind regards

@syberalexis
Copy link
Owner

Hello,

Oh sorry, I just remember, I forgot to add parameters to change the mode…
And the auto detect function is not ready too.

Can you pull last version and modify in cmd/linky-exporter/main.go at line 82, the core.Historical by core.Standard ?

I change main parameters this weekend ;)

have a nice day

@sachaz
Copy link
Author

sachaz commented Dec 9, 2022

Hola,

thanks for all your support.

Now the daemon is crashing (launched as root for now):

panic: runtime error: index out of range [7] with length 4

goroutine 41 [running]:
github.com/syberalexis/linky-exporter/pkg/core.(*StandardTicValue).parseRelais(0xc000274180, 0x3?)
        /home/sacha/linky-exporter/pkg/core/linky-standard-tic-value.go:452 +0xde
github.com/syberalexis/linky-exporter/pkg/core.(*StandardTicValue).ParseParam(0xc000274180, {0xc00021a500?, 0x7f7ffffc7cd1?}, {0xc0002190f0?, 0x2, 0x2})
        /home/sacha/linky-exporter/pkg/core/linky-standard-tic-value.go:368 +0x1106
github.com/syberalexis/linky-exporter/pkg/core.LinkyConnector.GetLastStandardTicValue({0x0, 0x0, {0x7f7ffffc7cd1, 0xa}, 0x2580, 0x7, 0x4e, 0x1})
        /home/sacha/linky-exporter/pkg/core/linky-connector.go:113 +0x185
github.com/syberalexis/linky-exporter/pkg/prom.(*LinkyCollector).Collect(0xc00024c000, 0xc0000a2300?)
        /home/sacha/linky-exporter/pkg/prom/linky-colletor.go:140 +0x2ba
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
        /home/sacha/linky-exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:453 +0x10d
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
        /home/sacha/linky-exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:545 +0xbac

Good day for you too

@syberalexis
Copy link
Owner

Hello,

I fix the problem and add mode choice to command.
Can you pull the branch, build it and run it like this, please :
dist/linky-exporter--openbsd-amd64 -d /dev/cuaU0 --standard --debug

I hope it's good but i write more tests to increase quality.

Have a nice day :)

@sachaz
Copy link
Author

sachaz commented Dec 11, 2022

Hi,

here is an output of the daemon after the first curl http://localhost:9101/metrics

cerbere11|18:26:19|:/home/sacha/linky-exporter#dist/linky-exporter--openbsd-amd64 -d /dev/cuaU0 --port=9101 --baud=9600 --parity="ParityNone" --size=7 --stopbits="Stop1" 
INFO[0000] Trying to auto detect TIC mode...            
INFO[0003] Standard Mode detected !                     
INFO[0003] Beginning to serve on port :9101             
ERRO[0015] Not supported mode !    

@syberalexis
Copy link
Owner

Hi,

Can you try with parameters --device /dev/cuaU0 --port=9101 --standard --debug please ?
--standard automatically add baudrate, parity, framesize, stopbits

I work on the auto detect mode and fixed parameters ;)

@sachaz
Copy link
Author

sachaz commented Dec 11, 2022

cerbere11|18:43:42|:/home/sacha/linky-exporter#dist/linky-exporter--openbsd-amd64 --device /dev/cuaU0 --port=9101 --standard --debug

INFO[0000] Debug mode enabled !                                                                                                    
INFO[0000] Beginning to serve on port :9101                                                                                        
DEBU[0002] Read serial with config device:/dev/cuaU0 baudrate:9600 framesize:7 parity:78 stopbits:1                                
DEBU[0002] Read serial data...                                                                                                     
DEBU[0003] ADSC XXXX    7                                                                                                  
DEBU[0003] VTIC 02      J                                                                                                          
DEBU[000NGTFATE       BASE              <                                                                                          
DEBU[0003] LTARF              BASE              F                                                                                  
DEBU[0003] EAST 041585377       7                                                                                                  
DEBU[0003] EASF01       041352318       =                                                                                          
DEBU[0003] EASF02       000233059       9                                                                                          
DEBU[0003] EASF03       000000000       $                                                                                          
DEBU[0003] EASF04       000000000       %                                                                                          
DEBU[0003] EASF05       000000000       &                                                                                          
DEBU[0003] EASF06       000000000       '                                                                                          
DEBU[0003] EASF07       000000000       (                                                                                          
DEBU[0003] EASF08       000000000       )                                                                                          
DEBU[0003] EASF09       000000000       *                                                                                          
DEBU[0003] EASF10       000000000       "                                                                                          
DEBU[0003] EASD01       041585377       H                                                                                          
DEBU[0003] EASD02       000000000       !                                                                                          
DEBU[0003] EASD03       000000000       "                                                                                          
DEBU[0003] EASD04       000000000       #                                                                                          
DEBU[0003] IRMS1        006     4                                                                                                  
DEBU[0003] URMS1        228     F                                                                                                  
DEBU[0003] PREF 06      E                                                                                                          
DEBU[0003] PCOUP        06      _                                                                                                  
DEBU[0004] SINSTS       01471   S                                                                                                  
DEBU[0004] SMAXSN       H221211054844   02860   ?                                                                                  
DEBU[0004] SMAXSN-1     H221210141550   03080   N                                                                                  
DEBU[0004] CCASN        H221211180000   01315   7                                                                                  
DEBU[0004] CCASN-1      H221211170000   01299   _                                                                                  
DEBU[0004] UMOY1        H221211184000   230     )                                                                                  
DEBU[0004] STGE 00DA0001        K                                                                                                  
DEBU[0004] MSG1      PAS DE          MESSAGE            <                                                                          
DEBU[0004] PRM  16140520874326  2                                
DEBU[0004] RELAIS       000     B                                                                                                  
DEBU[0004] NTARF        01      N                                                                                                  
DEBU[0004] NJOURF       00      &                                                                                                  
DEBU[0004] NJOURF+1     00      B                                                                                                  
DEBU[0005] Read serial data ended !                              
DEBU[0020] Read serial with config device:/dev/cuaU0 baudrate:9600 framesize:7 parity:78 stopbits:1 
DEBU[0020] Read serial data...                           
DEBU[0021] ADSC 021662870343    7                          
DEBU[0021] VTIC 02      J                                     
DEBU[0021] DATE H221211184402           =                         
DEBU[0021] NGTF       BASE              <                      
DEBU[0021] LTARF              BASE              F                      
DEBU[0021] EAST 041585384       5                             
DEBU[0021] EASF01       041352325       ;                            
DEBU[0021] EASF02       000233059       9                            
DEBU[0021] EASF03       000000000       $                            
DEBU[0021] EASF04       000000000       %                            
DEBU[0021] EASF05       000000000       &                            
DEBU[0021] EASF06       000000000       '                            
DEBU[0021] EASF07       000000000       (                            
DEBU[0021] EASF08       000000000       )                            
DEBU[0021] EASF09       000000000       *                            
DEBU[0021] EASF10       000000000       "                            
DEBU[0021] EASD01       041585384       F
EASD02  000000000       !       
DEBU[002EASD04D00000000000000000#       "
DEBU[0021] IRMS1        006     4                                   
DEBU[0021] URMS1        232     A                                   
DEBU[0021] PREF 06      E                                     
DEBU[0022] PCOUP        06      _                                    
DEBU[0022] SINSTS       01487   Z                               
DEBU[0022] SMAXSN       H221211054844   02860   ?                  
DEBU[002CCASNAXSH22121118000010101315   7 080   N
DEBU[0022] CCASN-1      H221211170000   01299   _                
DEBU[0022] UMOY1        H221211184000   230     )                     
DEBU[0022] STGE 00DA0001        K                              
DEBU[0022] MSG1      PAS DE          MESSAGE            <      
DEBU[0022] PRM  16140520874326  2                         
DEBU[0022] RELAIS       000     B                                  
DEBU[0022] NTARF        01      N                                    
DEBU[0022] NJOURF       00      &                                   
DEBU[0022] NJOURF+1     00      B                                 
DEBU[0023] Read serial data ended ! 

@sachaz
Copy link
Author

sachaz commented Dec 11, 2022

here are the Prometheus outputs:

An error has occurred while serving metrics:

collected metric "linky_load_curve_point" { label:<name:"linky_id" value:"021662870343" > label:<name:"mode" value:"used" > gauge:<value:1299 > } was collected before with the same name and label values

or

# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0.000134842
go_gc_duration_seconds{quantile="0.25"} 0.000249822
go_gc_duration_seconds{quantile="0.5"} 0.000254419
go_gc_duration_seconds{quantile="0.75"} 0.000278116
go_gc_duration_seconds{quantile="1"} 0.000838313
go_gc_duration_seconds_sum 0.001755512
go_gc_duration_seconds_count 5
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 7
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.19.1"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 3.203144e+06
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 8.664616e+06
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 4422
# HELP go_memstats_frees_total Total number of frees.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 26824
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 8.8856e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 3.203144e+06
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 2.727936e+06
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 5.070848e+06
# HELP go_memstats_heap_objects Number of allocated objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 6195
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 2.490368e+06
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 7.798784e+06
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
# TYPE go_memstats_last_gc_time_seconds gauge
go_memstats_last_gc_time_seconds 1.6707809971145592e+09
# HELP go_memstats_lookups_total Total number of pointer lookups.
# TYPE go_memstats_lookups_total counter
go_memstats_lookups_total 0
# HELP go_memstats_mallocs_total Total number of mallocs.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 33019
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 4800
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 15600
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 63512
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 65280
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 6.053976e+06
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 973178
# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 589824
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 589824
# HELP go_memstats_sys_bytes Number of bytes obtained from system.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 1.8332688e+07
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 9
# HELP linky_energy Energie en Wh
# TYPE linky_energy counter
linky_energy{index="D1",linky_id="XXXX",mode="used"} 4.1585532e+07
linky_energy{index="F1",linky_id="XXXX",mode="used"} 4.1352473e+07
linky_energy{index="F2",linky_id="XXXX",mode="used"} 233059
# HELP linky_energy_total Total Energie en Wh
# TYPE linky_energy_total counter
linky_energy_total{linky_id="XXXX",mode="used"} 4.1585532e+07
# HELP linky_intensity Courant efficace en A
# TYPE linky_intensity gauge
linky_intensity{linky_id="XXXX",phase="1"} 6
# HELP linky_movable_peak Pointe mobile
# TYPE linky_movable_peak gauge
linky_movable_peak{linky_id="XXXX",phase="1",type="end"} 0
linky_movable_peak{linky_id="XXXX",phase="1",type="start"} 0
linky_movable_peak{linky_id="XXXX",phase="2",type="end"} 0
linky_movable_peak{linky_id="XXXX",phase="2",type="start"} 0
linky_movable_peak{linky_id="XXXX",phase="3",type="end"} 0
linky_movable_peak{linky_id="XXXX",phase="3",type="start"} 0
# HELP linky_power Puissance apparente en VA
# TYPE linky_power gauge
linky_power{linky_id="XXXX",mode="used",phase="1"} 1420
# HELP linky_power_last_year Puissance apparente n-1 en VA
# TYPE linky_power_last_year gauge
linky_power_last_year{linky_id="XXXX",mode="used",phase="1"} 3080
# HELP linky_power_max Puissance apparente en VA
# TYPE linky_power_max gauge
linky_power_max{linky_id="XXXX",mode="used",phase="1"} 2860
# HELP linky_power_reference Puissance apparente de référence en kVA
# TYPE linky_power_reference counter
linky_power_reference{linky_id="XXXX",type="breaking"} 6
linky_power_reference{linky_id="XXXX",type="subscribed"} 6
# HELP linky_status Statut issu du registre
# TYPE linky_status gauge
linky_status{linky_id="XXXX",name="Contact sec"} 0
linky_status{linky_id="XXXX",name="Couleur du jour pour le contrat historique tempo"} 0
linky_status{linky_id="XXXX",name="Couleur du lendemain pour le contrat historique tempo"} 0
linky_status{linky_id="XXXX",name="Dépassement de la puissance de référence"} 0
linky_status{linky_id="XXXX",name="Fonctionnement producteur/consommateur"} 0
linky_status{linky_id="XXXX",name="Mode dégradée de l horloge"} 0
linky_status{linky_id="XXXX",name="Organe de coupure"} 0
linky_status{linky_id="XXXX",name="Pointe mobile (PM)"} 0
linky_status{linky_id="XXXX",name="Préavis pointes mobiles"} 0
linky_status{linky_id="XXXX",name="Sens de l énergie active"} 0
linky_status{linky_id="XXXX",name="Statut du CPL"} 0
linky_status{linky_id="XXXX",name="Surtension sur une des phases"} 0
linky_status{linky_id="XXXX",name="Synchronisation CPL"} 0
linky_status{linky_id="XXXX",name="Tarif en cours sur le contrat distributeur"} 0
linky_status{linky_id="XXXX",name="Tarif en cours sur le contrat fourniture"} 0
linky_status{linky_id="XXXX",name="État de la sortie communication Euridis"} 0
linky_status{linky_id="XXXX",name="État de la sortie télé-information"} 0
linky_status{linky_id="XXXX",name="État du cache-bornes distributeur"} 0
# HELP linky_timestamp Synchronized timestamp in Linky
# TYPE linky_timestamp counter
linky_timestamp{contract="BASE",linky_id="XXXX",pricing="BASE",version="�"} -6.795364578871345e+18
# HELP linky_voltage Tension efficace en V
# TYPE linky_voltage gauge
linky_voltage{linky_id="XXXX",phase="1"} 229
# HELP linky_voltage_average Tension moyenne en V
# TYPE linky_voltage_average gauge
linky_voltage_average{linky_id="XXXX",phase="1"} 230
# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.
# TYPE promhttp_metric_handler_requests_in_flight gauge
promhttp_metric_handler_requests_in_flight 1
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 7
promhttp_metric_handler_requests_total{code="500"} 14
promhttp_metric_handler_requests_total{code="503"} 0

@syberalexis
Copy link
Owner

syberalexis commented Dec 11, 2022

Ah good news, it's work pretty well, except linky_load_curve_point ^^
I fixed it now, you can pull the branch ;)

EDIT: I see version label is buggy :/

@sachaz
Copy link
Author

sachaz commented Dec 11, 2022

YEY !!!

It works fine now !
Time to do some graphing do you have an allready done on Graphana ?

@syberalexis
Copy link
Owner

:)

Not now for this new exporter metrics.
It's my next task to update my Electrical monitoring ;)

I fixed the autodetect mode too :)

@sachaz
Copy link
Author

sachaz commented Dec 11, 2022

For OpenBSD people here is a simple daemonize script in /etc/rc.d/linky_exporter

#!/bin/ksh

daemon="/usr/local/bin/linky_exporter --device /dev/cuaU0 --port=9101 --standard" 
daemon_logger="daemon.info"
daemon_user="_nodeexporter"
. /etc/rc.d/rc.subr

pexp="${daemon}.*"
rc_bg=YES
rc_reload=NO

rc_cmd $1

with a

usermod -G dialer _nodeexporter
chmod 555 /etc/rc.d/linky_exporter
rcctl enable linky_exporter

@syberalexis
Copy link
Owner

Thank you, I will include this into the new version of documentation :)

@sachaz
Copy link
Author

sachaz commented Dec 12, 2022

Dear syberalexis,

image
I have some holes in my graph due to timeouts accessing to the serial device I guess ?
(Maybe it could be better to create another issue ?)

@syberalexis
Copy link
Owner

Hello,

What is your scrape_interval and scrape_timeout in Prometheus config ?

If there is an optimization problem, you will can open a new issue ;)

@sachaz
Copy link
Author

sachaz commented Dec 12, 2022

Hey

Let's go to #11 Daemon Optimization :)

@syberalexis
Copy link
Owner

Hello,

The new released version of Linky exporter is ready : https://github.com/syberalexis/linky-exporter/releases/tag/v3.0.0 ;)

A dashboard is available with id 17649.
The link https://grafana.com/grafana/dashboards/17649-fr-linky-exporter/ is buggy. I opened a ticket in GrafanaLabs.

Have a nice day.
Best regards,

@syberalexis syberalexis added the enhancement New feature or request label Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants