warnings when running import_full.php in Raspberry ???

 

I get the following warnings ???? being a complete n00b with linux dont understand what this means and if something needs to be fixed ???

pi@raspberrypi ~/usefulscripts/replication $ sudo php import_full.php
 

PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /home/pi/usefulscripts/replication/import_full.php on line 31
PHP Notice:  Trying to get property of non-object in /home/pi/usefulscripts/replication/import_full.php on line 32
create feed 3611
PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /home/pi/usefulscripts/replication/import_full.php on line 36
Downloading: r:3611 to l:3611 wL123_kwh
--layer: 0 472 bytes
--layer: 1 12 bytes
--layer: 2 0 bytes
--layer: 3 0 bytes
--layer: 4 0 bytes
--layer: 5 0 bytes
PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /home/pi/usefulscripts/replication/import_full.php on line 31
PHP Notice:  Trying to get property of non-object in /home/pi/usefulscripts/replication/import_full.php on line 32
create feed 3630
PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /home/pi/usefulscripts/replication/import_full.php on line 36
Downloading: r:3630 to l:3630 wOUThp
--layer: 0

-------------------------

To run import all feeds and data from emoncms.org to local emoncms installation here is what is needed to be done to my understanding.

1. log in to raspberry: pi, raspberry

2. change to directory pi/home/usefulscripts/replication

3. sudo nano import_full.php

- change APIkey to apikey from emoncms.org

- change ip address to current emoncms.org ip address

4. sudo php import_full.php

-------------------------

TrystanLea's picture

Re: warnings when running import_full.php in Raspberry ???

Hello Petrik, did you set your mysql database name, username and password at the top?

Petrik's picture

Re: warnings when running import_full.php in Raspberry ???

Thought those are defaults as I am using the ready to go raspberry image for usb hd... will try to find what those are then.

Found another challenge too - the linux partition on USB disc is only 2.7G and can not be extended with resize2fs so need to find a way how to use the rest of the 497G on the disc avail.

 

 

Petrik's picture

Re: warnings when running import_full.php in Raspberry ???

How do I resize the USD disc, with image written on it its only 2.7G and capacity is 500G ?

Raspi-config does not help as its not a SD card that needs to be extended...

---------------------------

To run import all feeds and data from emoncms.org to local emoncms installation here is what is needed to be done to my understanding.

This is how to get going with the USB hard drive and copying the data from emoncms.org server

1. log in to raspberry: pi, raspberry

2. change to directory pi/home/usefulscripts/replication

3. sudo nano import_full.php

- change APIkey to apikey from emoncms.org

- change ip address to current emoncms.org ip address

- change user admin and password raspberry
 

4. Before import extend the HD capacity to full, the image size is only 2.6G so most likely you run out of space before import is finished.

??????????????????

edit this does not work as ext2explore can not copy, there must be simplier and more neat methods ...

- shutdown raspi pi and move usb hd to your windows computer

- using windows tool mini partition wizard home edition add partition for remaining disc capacity

- using windows tool ext2explore copy sda2 partition contents to sda3

- change /dev/sda2 to /dev/sda3 in /etc/fstab

- sudo reboot

5. sudo php import_full.php

TrystanLea's picture

Re: warnings when running import_full.php in Raspberry ???

Yes sorry, I meant to add a note about resizing but had not done so yet, I just tried resizing my system here (2.6GB was still ok for me so far). I expected the step 1 that I described here to work http://emoncms.org/site/docs/fullstackpi but it wouldnt allow me to extend the disk beyond 8192 sectors which would have shrunk the partition. Not sure why that was.

So I did as you suggest but by connecting the harddrive to my ubuntu linux computer and using a tool called gparted which was nice and easy, just unmount and then drag to resize.

 

 

Robert Wall's picture

Re: warnings when running import_full.php in Raspberry ???

You can often find GPartEd on rescue discs - these are a self-contained Linux OS on a CD that will run on a Windows machine without installing Linux on the machine.

Jérôme's picture

Re: warnings when running import_full.php in Raspberry ???

Yes, examples of such disks are Knoppix, or even the Ubuntu install disk, which can be used either to install or to just run once. Those are also referred to as live-cd.

Petrik's picture

Re: warnings when running import_full.php in Raspberry ???

OK - managed to resize the HD.

I can run import_full.php, but only can see a few feeds on the list after running import_full. Whats it is that I am missing to get all feeds updated ?

 

When runnign import_full get some php warnings but most feeds do come clean and import_full claims the feed exists.

pi@raspberrypi ~/usefulscripts/replication $ sudo php import_full.php
feed exists 11245
Opening file http://213.138.100.101/emoncms/feed/export.json?apikey=XXXXXXXaece0a2f59...
feed exists 15161
PHP Warning:  unpack(): Type I: not enough input, need 4, have 0 in /home/pi/usefulscripts/replication/import_full.php on line 72
PHP Warning:  unpack(): Type I: not enough input, need 4, have 0 in /home/pi/usefulscripts/replication/import_full.php on line 74
local and remote meta data do not match
feed exists 15162
PHP Warning:  unpack(): Type I: not enough input, need 4, have 0 in /home/pi/usefulscripts/replication/import_full.php on line 72
PHP Warning:  unpack(): Type I: not enough input, need 4, have 0 in /home/pi/usefulscripts/replication/import_full.php on line 74
local and remote meta data do not match
feed exists 15164
Opening file http://213.138.100.101/emoncms/feed/export.json?apikey=XXXXXXXaece0a2f59...
feed exists 4141
PHP Warning:  unpack(): Type I: not enough input, need 4, have 0 in /home/pi/usefulscripts/replication/import_full.php on line 72
PHP Warning:  unpack(): Type I: not enough input, need 4, have 0 in /home/pi/usefulscripts/replication/import_full.php on line 74
local and remote meta data do not match
feed exists 3611
PHP Warning:  unpack(): Type I: not enough input, need 4, have 0 in /home/pi/usefulscripts/replication/import_full.php on line 72
PHP Warning:  unpack(): Type I: not enough input, need 4, have 0 in /home/pi/usefulscripts/replication/import_full.php on line 74
local and remote meta data do not match
feed exists 3613
Downloading: r:3613 to l:3613 T1C
--layer: 0 48 bytes
--layer: 1 4 bytes
--layer: 2 0 bytes
--layer: 3 0 bytes
--layer: 4 0 bytes
--layer: 5 0 bytes
feed exists 3614
Downloading: r:3614 to l:3614 wL123
--layer: 0 96 bytes

----------------

HD resizing required unmounting (basically setting up a clean raspberry installation SDcard without emoncms) and running gparted as root. Used Xming as terminal. I think it could be a good idea to include a note about first making a clean sdcard and running gparted to resize the disc and after that making the sdcard with boot.

Anyway - found a also a small problem. Looks like the import_inputs.php can not handle timestore ?

PHP Notice:  Undefined property: stdClass::$record in /home/pi/usefulscripts/rep                                                   lication/import_inputs.php on line 16
{"id":"113067","nodeid":"12","name":"20","description":"","processList":"","time                                                   ":false,"value":false}

Petrik's picture

Re: warnings when running import_full.php in Raspberry ???

OK - figured it out, when on feeds sheet there were some old non active "feeds" visible, after deleting those then all the newly imported feeds appeared  on the feeds page.

Now it looks like the feeds are not updating even though the inputs are updating... so this is the next challenge to figure out how to get feeds to update. Forwarding inputs to emoncms.org happens nicely though.

 

 

 

 

 

 

Petrik's picture

Re: warnings when running import_full.php in Raspberry ???

Now trying to get feeds to update and tried pulling new versions and this is what I get...

From https://github.com/emoncms/emoncms
   95c9dfa..32b586e  master     -> origin/master
From https://github.com/emoncms/emoncms
* [new tag]         v6.9       -> v6.9
* [new tag]         v7.0       -> v7.0
Your configuration specifies to merge with the ref 'redismetadata' from the remote, but no such ref was fetched.

This was initially a clean build from card image - Hmmm... ???

 

Petrik's picture

Re: warnings when running import_full.php in Raspberry ???

 

OK - now uderstood why feeds are not updating, input processes are not updated ? The import_inputs is not working as explained earlier. How is it supposed to work that input processes are copied ? There is quite a many of those in my case and there seems to be no way to see the current input process even when clicking the wrench with current emoncms.org. 

Ps this forum editor is really interesting - its typing on my behalf when editing a sentence in the middle of the text making editing impossible.

AllenConquest's picture

Re: warnings when running import_full.php in Raspberry ???

I am also getting the "Undefined property: stdClass::$record" error. This seems to be happening because the json feed does not have a value called "record".

Indeed the database table doesn't have a column called "record" either! So I just modified the code to remove the attempt to update a non-existent column with a non-existent value, and it work!

I'm not sure if there is meant to be a "record" column in the emoncms database or not. Maybe someone else can comment?

Comment viewing options

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