Mosquitto / EmoncmsNode not running

As per the title:

 

pi@emonpi /var/lib/mosquitto $ sudo service feedwriter status
Log is turned off
running

 

pi@emonpi /var/lib/mosquitto $ sudo service emoncms-nodes-service status
Log is turned off
stopped

starting emoncms-modes-service & then checking:

pi@emonpi /var/lib/mosquitto $ sudo service emoncms-nodes-service start
Log is turned off
Starting emoncms-nodes
pi@emonpi /var/lib/mosquitto $ sudo service emoncms-nodes-service status
Log is turned off
stopped

 

 

pi@emonpi /var/lib/mosquitto $ sudo service mosquitto status
[FAIL] mosquitto is not running ... failed!
pi@emonpi /var/lib/mosquitto $

 

starting mosquitto  & then checking:

pi@emonpi /var/lib/mosquitto $ sudo service mosquitto start
[ ok ] Starting Mosquitto message broker: mosquitto.
pi@emonpi /var/lib/mosquitto $ sudo service mosquitto status
[FAIL] mosquitto is not running ... failed!
pi@emonpi /var/lib/mosquitto $

 

I had, on the same raspi also openhab instance (and it was working) but in order to avoid interferences I removed it from init.d startup sequence.

So the emonpi should be running without whatsoever interference

Any help is welcome

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

Additionally, but I guess it is simply a consequence, I have no power reading on the emonpi lcd display.

Is there a log to be checked for mosquitto startup

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

2015-09-13 11:49:42,226 INFO MQTT Connecting to MQTT Server 2015-09-13 11:49:42,239 INFO MQTT Could not connect...

2015-09-13 11:49:43,136 DEBUG RFM2Pi 48 NEW FRAME : OK 5 29 5 112 1 141 6 117 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (-0) 2015-09-13 11:49:43,139 DEBUG RFM2Pi 48 Timestamp : 1442137783.14 2015-09-13 11:49:43,140 DEBUG RFM2Pi 48 From Node : 5

2015-09-13 11:49:43,141 DEBUG RFM2Pi 48 Values : [1309, 368, 1677, 246.93, 0, 0, 0, 0, 0, 0, 0] 2015-09-13 11:49:43,142 DEBUG RFM2Pi 48 adding frame to buffer => [1442137783, 5, 1309, 368, 1677, 246.93, 0, 0, 0, 0, 0, 0, 0] 2015-09-13 11:49:43,143 DEBUG RFM2Pi 48 Sent to channel' : ToEmonCMS 2015-09-13 11:49:43,341 INFO MQTT Connecting to MQTT Server

2015-09-13 11:49:43,360 INFO MQTT Could not connect...

2015-09-13 11:49:44,477 INFO MQTT Connecting to MQTT Server 2015-09-13 11:49:44,479 INFO MQTT Could not connect... 2015-09-13 11:49:45,594 INFO MQTT Connecting to MQTT Server

2015-09-13 11:49:45,597 INFO MQTT Could not connect...

2015-09-13 11:49:46,699 INFO MQTT Connecting to MQTT Server

2015-09-13 11:49:46,702 INFO MQTT Could not connect...

2015-09-13 11:49:47,804 INFO MQTT Connecting to MQTT Server

2015-09-13 11:49:47,807 INFO MQTT Could not connect... 2015-09-13 11:49:48,196 DEBUG RFM2Pi 49 NEW FRAME : OK 5 11 5 98 1 109 6 22 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (-0)
...

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

Just checked that mosquitto.pid was there in /var/run hence init.d ran it.

changed it's name 

restarted the service using sudo service restart mosquitto.

pi@emonpi /var/run $ sudo service mosquitto start
[ ok ] Starting Mosquitto message broker: mosquitto.
pi@emonpi /var/run $ sudo service mosquitto status
[FAIL] mosquitto is not running ... failed!

 

new mosquitto.pid was however written in /var/run

so I suppose either it starts & dies or the pid file is written before server launch (doh)

 

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

I checked everything I could imagine.... help!

I see the values are read from the clamps (I can see W values in the log) but due to MQTT not working there's no pub/sub - transmission

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

Up for help.
Please

pb66's picture

Re: Mosquitto / EmoncmsNode not running

Is there any more info in emoncms.log ? it looks like "emoncms-nodes-service" isn't runnig either.

Have you looked in /var/log/syslog or /var/log/messages or any of the other log files?

rather than trawling back through the logs open a few ssh windows and "tail -f" the log files and watch them while you try and start mosquitto and/or emoncms-nodes-service in another window.

When did it work last? and what have you done to the image since then?

Were you using a stock image prior to installing openHab? was it up to date?

Have you changed any mosquitto settings? firewall settings? 

It's not a straight forward or common problem so any relevant info would help us help you. You need to retrace your steps since it was working as there is a reasonable chance it is something you have done rather than an organic issue.

Paul

pb66's picture

Re: Mosquitto / EmoncmsNode not running

Also, in /etc/mosquitto/mosquitto.conf you could set "log_dest syslog" (currently "none") and "log_mode debug" to output some logging via /var/log/syslog. don't try to set other locations as that will introduce more starting errors due to permission issues and the RO filesystem. However this may not be fruitful as the broker needs to run long enough to log something.

Paul 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

Hi Paul thanks for answering first of all

Is there any more info in emoncms.log ? it looks like "emoncms-nodes-service" isn't runnig either.

I confirm that  emoncms-nodes-service is not running either.

 

Have you looked in /var/log/syslog or /var/log/messages or any of the other lof files?

>>Yes.

rather than trawling back through the logs open a few ssh windows and "tail -f" the log files and watch them while you try and start mosquitto and/or emoncms-nodes-service in another window.

>>Good idea. syslog and message? I will start from there

When did it work last? and what have you done to the image since then?

>>Before a reboot one night. Since then the image was not touched anyway really due to the problem.

Were you using a stock image prior to installing openHab? was it up to date?

>>Yes just added samba, dnsclient and openhab. and Yes it was uptodate

Have you changed any mosquitto settings? firewall settings? 

>>No for mosquitto.

>>Yes for the FW: opened ports for Samba

It's not a straight forward or common problem so any relevant info would help us help you. You need to retrace your steps since it was working as there is a reasonable chance it is something you have done rather than an organic issue.

>> Yes I understand that and am trying to trace things. It was working since a while with openhab and samba enabled. 

If I cannot trace the cause I will buy a separate PI2 for openhab :-(. I hope that just putting the stock image on the SD and rebooting will fix the issue (I bought from the kickstarter launch and the sd was included in the bundle)

 

TX again

 

Paul

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

While I issue 

pi@emonpi ~ $ sudo service emoncms-nodes-service restart
Log is turned off
Restarting emoncms-nodes (nodes_mqtt_process.php was not running...)
pi@emonpi ~ $ sudo service emoncms-nodes-service status
Log is turned off
stopped

 

this is emoncms.log tail

2015-9-15 22:00:18 FEEDWRITER INFO PHPFina bytes written: 0
2015-9-15 22:01:06 MQTT INFO Starting emoncms mqtt nodes process
2015-9-15 22:01:18 FEEDWRITER INFO PHPTimeSeries bytes written: 0
2015-9-15 22:01:18 FEEDWRITER INFO PHPFina bytes written: 0
2015-9-15 22:02:18 FEEDWRITER INFO PHPTimeSeries bytes written: 0
2015-9-15 22:02:18 FEEDWRITER INFO PHPFina bytes written: 0

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

Well... i bought an extra pi2

Better not mixing stuff.

Will simply the img put on the sd reset the emonpi?

 

pb66's picture

Re: Mosquitto / EmoncmsNode not running

I would of at least tried with a fresh image and adding the extra stuff again before buying another Pi, it may not be a compatibility issue, maybe something wasn't quite right that a re-install would fix, they should be able to run together.

Perhaps if we were using the latest v3.1.1 standard instead of the old v3.1 it would help, or even an up to date broker. the apt-get installed mosquitto broker for Raspbian wheezy is v0.15-2 (released feb 2012 !!) latest for jessie is v1.3.4-2.(~ Aug 15) in a rapidly evolving tech 3 1/2 years is a long time.

Come on Raspbian..... Sort it out !!!!

Paul

Ian Eagland's picture

Re: Mosquitto / EmoncmsNode not running

Latest mosquitto here:-

http://mosquitto.org/2013/01/mosquitto-debian-repository

Pretty sure I installed from there with no problem.

Regards

Ian

pb66's picture

Re: Mosquitto / EmoncmsNode not running

Hi Ian,

Yes that method will work (now). Previously it would only give you v3.1 because the "wheezy" package was behind so to get v3.1.1 we had to use a method that downloaded the latest "jessie" version, but now that method doesn't work since the mqtt websockets now demand a dependency that is not compatible with "wheezy" and "jessie" isn't release stable on Raspbian yet despite being "current" on most other debian platforms for some months now.

But yes currently the best way to get up to date mosquitto on wheezy is via the mosquitto repo as the wheezy version has been brought up to speed.

It would be nice if we were all using the same version though and that is unlikely to happen until Raspbian get the "jessie" version of Raspbian sorted.

Paul

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

Unfortunately ... time is a tyran. If I had a little more time I would have gone the way of the fresh reinstall and adding openhab etc on top.

I am pretty sure it is something stupid may be due to an unproper shutdown or more probably froma stupid thing done by me at late hour....

but I can work at this things just after work at night + in the long run I prefer to have the two stuffs separated so I went down the easy way...

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

Infact I am sure OpenHab and EmonPi can run along without trouble.

They ran for one month.

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

I finally have time to unmount the emonpi from it's location.

Q: is there no way to reset to factory defaults (fresh cleam image) without opening the case?

I mean via telnet .

Just realized (after unmounting doh) that I need to access the microsd inside (doh doh) and I miss a special screwdriver (doh doh doh)

 

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

ok unmounted and putting on latest

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

I am still having some trouble :-(

namely I do not have any feeds written.

If I check the status of feedwriter it is stating that it is stopped.

pi@emonpi ~ $ sudo service feedwriter status
Log is turned off
stopped

 

If i restart it:

pi@emonpi ~ $ sudo service feedwriter start
Log is turned off
Starting RPI
pi@emonpi ~ $ sudo service feedwriter status
Log is turned off
stopped

 

It does not restart!

Now this was after a clean install and not changing anything at all (just the timezone and log to emoncms server)

 

What is wrong??? getting mad.

Love OpenSource and open platforms but sometimes I regret it.

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

Hello 

I bump the trhread u p since I have done a brand new installation I suppose it should work :-(

My feedwriter process is still not working

 

pi@emonpi ~ $ sudo service feedwriter start
Log is turned off
Starting RPI
pi@emonpi ~ $ sudo service feedwriter status
Log is turned off
stopped

Can someone of the team advice ?

 

TY in advance

pb66's picture

Re: Mosquitto / EmoncmsNode not running

I'm not overly familiar with that code but you could do a couple of checks like what does typing

ps -ef | grep feedwriter

​at the command line give you?

Will the feedwriter script run manually from the command line? (may need sudo) using

php /var/www/emoncms/scripts/feedwriter.php

What exactly is your "fresh" "brand new" "clean" installation? if it is a pre-built image, which one? are you following a guide? if self-built what versions have you installed?

Paul

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

no process running:

pi@emonpi ~ $ ps -ef | grep feedwriter
pi        2288  2056  0 22:39 pts/0    00:00:00 grep --color=auto feedwriter

pi@emonpi ~ $ sudo php /var/www/emoncms/scripts/feedwriter.php
Could not open input file: /var/www/emoncms/scripts/feedwriter.php

 

!!

ls gives:

pi@emonpi /var/www/emoncms $ ls
COPYRIGHT.txt  default.settings.php  index.php  LICENSE.txt  logconfig.xml  process_settings.php  route.php  scripts       Theme
core.php       docs                  Lib        locale.php   Modules        readme.md             run        settings.php

 

no php script!

 

I installed the image called emonSD-17Jun2015 on the SD that shipped with EmonPi.

I am surprised. because I have been really careful with shutdowns (always holding the button) so no abrupt endings...

What do you suggest?

 

Thank for your help once again

 

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

I hope not rewriting the sd as I would need to unmount the whole stuff again :-(

 

pb66's picture

Re: Mosquitto / EmoncmsNode not running

"pi@emonpi /var/www/emoncms $ ls
COPYRIGHT.txt  default.settings.php  index.php  LICENSE.txt  logconfig.xml  process_settings.php  route.php  scripts       Theme
core.php       docs                  Lib        locale.php   Modules        readme.md             run        settings.php

 

no php script!"

No but there was a "scripts" folder which is where I had expected it to be, however I just checked the repo for the emoncms included in that image and it should be in /var/www/emoncms/run for v8.5 low-write

so try sudo php /var/www/emoncms/run/feedwriter.php at the command line

and/or ls -la /var/www/emoncms/run to check it's permissions etc

Paul

 

Paul Reed's picture

Re: Mosquitto / EmoncmsNode not running

I haven't explored emonpi, but have found a bug with the feedwriter init file (as used in v9 and borrowed from emonpi) as follows;

Feedwriter does not restart on a reboot, because both feedwriter and mysql are given the same start priority - S03 in /etc/rc*.d and as feedwriter (alphabetically) comes before mysql, feedwriter starts first, resulting in the error;

2015-09-28 17:33:24.481|ERROR|feedwriter.php|Can't connect to database:Can't connect to local
 MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

...which stops feedwriter starting.

To rectify this issue, add 'mysql' to the dependency of the feedwriter init file, which you can see on this git patch, which will be offered for merge shortly.

The status of feedwriter can be checked by;

sudo service feedwriter status

Paul

 

Dvbit's picture

Re: Mosquitto / EmoncmsNode not running

Ok feedwriter is there in the scrips folder.

and... yep!

changing the script as in the patch did the trick!

feedwriter is now running

by the way visualizations (that did not work) are now working too

great

Thanks to all.

I suggest merging the change updating the img asap

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.