ainsey11 / octopusenergy-consumption-metrics

A utility written in nodejs to pull energy consumption from the Octopus Energy API for tracking usage in grafana.
22 stars 13 forks source link

Unable to get working standalone #30

Closed netcruiser2k10 closed 11 months ago

netcruiser2k10 commented 1 year ago

Hi I am currently using this via a standalone application using ubuntu 22.04.3 LTS LXC container I am having trouble getting the program to run, i install everything that is needed and put in the correct metrics that are needed however i keep getting the following error.

(redacted)@LXC-OctoMon:/opt/octomon$ npm run start

octopus-exporter@1.0.0 start node index.js

Starting Octopus Energy Consumption Metrics Container Current Settings are:

    OCTO_API_KEY =(redacted)
    OCTO_ELECTRIC_MPAN = (redacted)
    OCTO_ELECTRIC_SN = (redacted)
    OCTO_GAS_MPAN = (redacted)
    OCTO_GAS_SN = (redacted)
    INFLUXDB_URL = https://TheHive:8086
    INFLUXDB_TOKEN = (redacted)
    INFLUXDB_ORG = home
    INFLUXDB_BUCKET = octomon
    LOOP_TIME = 60
    OCTO_ELECTRIC_COST = 29.62
    OCTO_GAS_COST = 7.8
    PAGE_SIZE = 100
    VOLUME_CORRECTION = 1.02264
    CALORIFIC_VALUE = 40.1
    JOULES_CONVERSION = 3.6

Polling data from octopus API WARN: Write to InfluxDB failed (attempt: 1). Error: write EPROTO 00E86650427F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:

at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {

errno: -71, code: 'EPROTO', syscall: 'write' } ERROR: Retry buffer closed with 500 items that were not written to InfluxDB! Error: write EPROTO 00E86650427F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:

at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {

errno: -71, code: 'EPROTO', syscall: 'write' } Error submitting data to InfluxDB Sleeping for: 60 x^Z [1]+ Stopped npm run start

Can you help me figure out what is going wrong ?

Version of Nodejs installed is v21.1.0

Thanks In Advance

netcruiser2k10 commented 11 months ago

Project Cancelled due to no response

ainsey11 commented 11 months ago

Updating to say that the errors are pretty self explanatory

first of all - you have an SSL problem, either the LXC container does not have a matching CA for the influxdb server, or octopus API, or you have a proxy/firewall doing SSL MITM.

neither are issues with the code. A quick google of the error would have told you that.

ainsey11 commented 11 months ago

Issue can remain closed as not project related.