Community
OpenEnergyMonitor

Community

WARNING emonCMS couldn’t send to server, URLError: [Errno -2] Name or service not known

Hi, about 4 days ago I had a power failure in the house. after the electricity came back the emonbase rebooted and now it does not transmit data to emoncms anymore

here is the content of the log file.
Any clue?
(I have an old installation on SD that always worked and is READONLY)
thanks

2019-10-15 12:16:18,780 INFO EmonHub Pre-Release Development Version (rc1.2)
2019-10-15 12:16:18,782 INFO Opening hub...
2019-10-15 12:16:44,880 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:16:44,882 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:17:05,012 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:17:05,015 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:17:25,140 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:17:25,143 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:17:45,274 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:17:45,277 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:18:05,408 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:18:05,410 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:18:25,542 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:18:25,544 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:18:45,673 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:18:45,675 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:19:05,808 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:19:05,811 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:19:25,944 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:19:25,947 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:19:46,080 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:19:46,082 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:20:06,209 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:20:06,212 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:20:26,354 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:20:26,356 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:20:46,480 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:20:46,482 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:21:06,600 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:21:06,603 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:21:26,740 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:21:26,743 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:21:46,880 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:21:46,883 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:22:07,032 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:22:07,036 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:22:27,171 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:22:27,174 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:22:47,318 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:22:47,320 WARNING emonCMS send failure: wanted 'ok' but got ''
2019-10-15 12:23:07,457 WARNING emonCMS couldn't send to server, URLError: [Errno -2] Name or service not known
2019-10-15 12:23:07,460 WARNING emonCMS send failure: wanted 'ok' but got ''

Is this a local emoncms or emoncms.org?

A quick search on the forum threw up several post that have this error (or similar) e.g. Emoncms.org posting problem

Can you post your emonhub.cfg file please.

Also have you changed anything?

[edit] can you change the log level to

loglevel = DEBUG

And post the log please (just one iteration will be fine).

Emoncms.org

Please answer these…

I have not changed anything. it was just a power outage, lasted for a few minutes. when I had power back, I saw the RPi on my router being active activity so I thought everything was ok. only after a couple of days I noticed that data was missing from emoncms.org
i did not touch it, I didn’t even go in the room until yesterday evening…
it’s been working in that same position since march 2015…
here is the config.

**# SPECIMEN emonHub configuration file**
**# Note that when installed from apt, a new config file is written **
**# by the debian/postinst script, so changing this file will do **
**# nothing in and of itself.**

**# Each Interfacer and each Reporter has**
**# - a [[name]]: a unique string**
**# - a type: the name of the class it instantiates**
**# - a set of init_settings (depends on the type)**
**# - a set of runtimesettings (depends on the type)**
**# Both init_settings and runtimesettings sections must be defined,**
**# even if empty. Init settings are used at initialization,**
**# and runtime settings are refreshed on a regular basis.**

**# All lines beginning with a '#' are comments and can be safely removed.**

**#######################################################################**
**#######################    emonHub  settings    #######################**
**#######################################################################**
**[hub]**

**# loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL**
**# see here : http://docs.python.org/2/library/logging.html**
**loglevel = WARNING**


**#######################################################################**
**#######################        Reporters        #######################**
**#######################################################################**
**[reporters]**

**# This reporter sends data to emonCMS**
**[[emonCMS]]**
**    Type = EmonHubEmoncmsReporter**
**    [[[init_settings]]]**
**    [[[runtimesettings]]]**
**	url = http://emoncms.org**
**        apikey = 134570cf7bd364b5xxxxxxxxxxxxxxxxxxx**


**#######################################################################**
**#######################       Interfacers       #######################**
**#######################################################################**
**[interfacers]**

**# This interfacer manages the RFM2Pi module**
**[[RFM2Pi]]**
**    Type = EmonHubJeeInterfacer**
**    [[[init_settings]]]**
**        com_port = /dev/ttyAMA0**
**    [[[runtimesettings]]]**
**        group = 210**
**        frequency = 433**
**        baseid = 15**
**	interval = 120**

**#######################################################################**
**#######################          Nodes          #######################**
**#######################################################################**
**[nodes]**

**# List of nodes by node ID**
**# 'datacode' is default for node and 'datacodes' are per value data codes.**
**# if both are present 'datacode' is ignored in favour of 'datacodes'**
**[[99]]**
**	datacode = h**
**	datacodes = l, h, h, h,**

A.

Hi @andrearimo, that can’t be the active config as it is all commented out.

Depending on exactly how old, this may or may not work.

try

 systemctl status emonhub

And post the output here please.

-bash: systemctl: command not found

Ok

service emonhub status

it’s not all commented out, the asterisks were added here, they are not in the original file.
i found this file in /etc/emonhub/

Image deleted as contained API key - mod

[email protected] /etc/emonhub $ service emonhub status

This script must be run as root

[email protected] /etc/emonhub $ sudo service emonhub status

[ ok ] Checking OpenEnergyMonitor emonHub: emonhub process is running.

Ok, so when posting code or bash output, put in 3 ‘backticks’ (found at the top left of the keyboard normally) on a line on their own, then the code, then 3 more backticks on a line following the code.

    ```
    code
    ```

Could you re paste into the comment above please.

Can you check if the Pi can access emoncms.org please

ping emoncms.org

Ctl-C to end. Should look like this;

PING emoncms.org (80.243.190.58) 56(84) bytes of data.
64 bytes from 58-190-243-80.rackcentre.redstation.net.uk (80.243.190.58): icmp_seq=1 ttl=54 time=17.8 ms
64 bytes from 58-190-243-80.rackcentre.redstation.net.uk (80.243.190.58): icmp_seq=2 ttl=54 time=17.8 ms
64 bytes from 58-190-243-80.rackcentre.redstation.net.uk (80.243.190.58): icmp_seq=3 ttl=54 time=17.7 ms
64 bytes from 58-190-243-80.rackcentre.redstation.net.uk (80.243.190.58): icmp_seq=4 ttl=54 time=17.7 ms
[email protected] /etc/emonhub $ cat emonhub.conf 
# SPECIMEN emonHub configuration file
# Note that when installed from apt, a new config file is written 
# by the debian/postinst script, so changing this file will do 
# nothing in and of itself.

# Each Interfacer and each Reporter has
# - a [[name]]: a unique string
# - a type: the name of the class it instantiates
# - a set of init_settings (depends on the type)
# - a set of runtimesettings (depends on the type)
# Both init_settings and runtimesettings sections must be defined,
# even if empty. Init settings are used at initialization,
# and runtime settings are refreshed on a regular basis.

# All lines beginning with a '#' are comments and can be safely removed.

#######################################################################
#######################    emonHub  settings    #######################
#######################################################################
[hub]

# loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL
# see here : http://docs.python.org/2/library/logging.html
loglevel = WARNING


#######################################################################
#######################        Reporters        #######################
#######################################################################
[reporters]

# This reporter sends data to emonCMS
[[emonCMS]]
    Type = EmonHubEmoncmsReporter
    [[[init_settings]]]
    [[[runtimesettings]]]
	url = http://emoncms.org
        apikey = 134570cfxxxxxxxxxxxxxxxxxxxxxxxxxxx


#######################################################################
#######################       Interfacers       #######################
#######################################################################
[interfacers]

# This interfacer manages the RFM2Pi module
[[RFM2Pi]]
    Type = EmonHubJeeInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyAMA0
    [[[runtimesettings]]]
        group = 210
        frequency = 433
        baseid = 15
	interval = 120

#######################################################################
#######################          Nodes          #######################
#######################################################################
[nodes]

# List of nodes by node ID
# 'datacode' is default for node and 'datacodes' are per value data codes.
# if both are present 'datacode' is ignored in favour of 'datacodes'
[[99]]
	datacode = h
	datacodes = l, h, h, h,
1 Like
[email protected] /etc/emonhub $ ping emoncms.org
ping: unknown host emoncms.org
[email protected] /etc/emonhub $ ping 80.243.190.58
PING 80.243.190.58 (80.243.190.58) 56(84) bytes of data.
64 bytes from 80.243.190.58: icmp_req=1 ttl=48 time=35.2 ms
64 bytes from 80.243.190.58: icmp_req=2 ttl=48 time=35.3 ms
64 bytes from 80.243.190.58: icmp_req=3 ttl=48 time=35.3 ms
64 bytes from 80.243.190.58: icmp_req=4 ttl=48 time=35.1 ms
64 bytes from 80.243.190.58: icmp_req=5 ttl=48 time=35.7 ms
64 bytes from 80.243.190.58: icmp_req=6 ttl=48 time=35.5 ms
64 bytes from 80.243.190.58: icmp_req=7 ttl=48 time=35.6 ms
64 bytes from 80.243.190.58: icmp_req=8 ttl=48 time=35.5 ms
64 bytes from 80.243.190.58: icmp_req=9 ttl=48 time=35.0 ms
64 bytes from 80.243.190.58: icmp_req=10 ttl=48 time=35.1 ms
64 bytes from 80.243.190.58: icmp_req=11 ttl=48 time=35.6 ms
64 bytes from 80.243.190.58: icmp_req=12 ttl=48 time=35.3 ms
64 bytes from 80.243.190.58: icmp_req=13 ttl=48 time=35.5 ms
64 bytes from 80.243.190.58: icmp_req=14 ttl=48 time=35.2 ms
64 bytes from 80.243.190.58: icmp_req=15 ttl=48 time=35.5 ms
64 bytes from 80.243.190.58: icmp_req=16 ttl=48 time=35.7 ms
64 bytes from 80.243.190.58: icmp_req=17 ttl=48 time=35.1 ms
64 bytes from 80.243.190.58: icmp_req=18 ttl=48 time=35.3 ms
64 bytes from 80.243.190.58: icmp_req=19 ttl=48 time=35.5 ms
64 bytes from 80.243.190.58: icmp_req=20 ttl=48 time=35.2 ms
64 bytes from 80.243.190.58: icmp_req=21 ttl=48 time=35.2 ms

it seems it does not resolve the address

Try rebooting the router and then the Pi.

from the mac I can ping emoncms.org

Might be how the IP address has been applied after the power failure. Could try just rebooting the Pi unless you have tried that.

It is also possible the SD card is failing. Odd things like this tend to be the first sign IME.

I rebooted the router and now the PI, didn’t work. would you recommend a specific version? my pi is still the PI 1. can I just download the latest?

My suspicion is the SD Card is dying. Can you not get to the Pi via SSH? It might be on a different IP address now.

@TrystanLea -

  • Have you tested the scripts on a Pi 1?
  • Could just ‘emonhub’ be installed?
  • could there be something in the script that configures emonhub for the older boards? An alternative config for instance?

The scripts would be the best way forward. If you just need this setup to communicate with emoncms.org, then an install of just the emonhub should work.

Take care though - you have the older RFM board so the default settings will not work. Ah but you have a backup of your emonhub.cfg here (except for the API key which I munged!).

I solved!
for some reason the nameserver was set to

[email protected] ~ $ cat /etc/resolv.conf
domain homenet.telecomitalia.it
search homenet.telecomitalia.it
nameserver 192.168.1.251

I changed the FS to rw via

rpi-rw

then I edited the resolve.conf to point name server to 192.168.1.1

now all works…

I have no idea how it was set to that IP which is not even present on my network… it might be the SD failing, but for now it works.

1 Like