Saving archine data CSV to USB



  • Hi There,

    What is the best way to save archive data to a USB stick via the HMI? I's like to be able to plug a USB stick in and press a button on the HMI to save the archive data to it in CSV format. This is good for remote systems that are not on a network.

    Cheers

    Mike



  • Hi Mike,
    I assume your RexCore is running on a Debian device. To export the archive to csv you need to have the rexarc package installed on your device. To install use following commands:

    sudo apt udpate
    sudo apt install rexarc
    

    After successful instalation, the documentation for RexArc can be shown with

    RexArc -h
    

    You have to solve mounting of USB stick on your device. Unfortunately, it is not solved in Rexygen. Look at some forums on internet (for example https://unix.stackexchange.com/questions/18925/how-to-mount-a-device-in-linux ). I used command:

    sudo mount /dev/sda1 /media/usb1 -o umask=000
    

    umask=000 gives write permissions to all users.

    The first way to save archive to CSV is to specify the RexArc command with options you want into the EPC block in Rexygen task and add Button into HMI which will execute the EPC block.

    The seccond way is to use the Device Web Management (DWM) tool, which is the Rex Controls product too. There is a graphic user interface for RexArc in DWM and you don't need to specify RexArc command manually. You can export archives into CSV, copy files, restart/power off your device, etc. with this tool. Unfortunately, we don't have documentation yet, but the use is quite intuitive. Please, note that DWM will make some changes of the network settings of your device!

    To install DWM simply add line:

    deb http://download.rexcontrols.com/repositories/rex-dwm/debian buster non-free
    

    to your repository list (replace buster with stretch if you are still running Debian Stretch. After saving the repository, update the package list

    sudo apt update
    

    and install DWM

    sudo apt install rex-dwm
    

    DWM is accessible in the same way as the HMI using a web browser at the address of your device with /dwm (for example 127.0.0.1/dwm).

    There is Archives item in DWM. After clicking it, select Explore available archives (compass icon on the right side) and select archive that you want to export. After that you can choose Load archive items (magnifier icon). Click Export archive to removable media, configure export and hit Export. If you have mounted your USB stick in /media folder, you can see this USB in the next menu. Remember that you need write permission to save the CSV.

    Please, let me know if anything goes wrong.

    Cheers
    Jan



  • Hi Jan,

    Thank you for the reply.

    I am trying to use the DWM tool, it sounds very useful, I'm using a Monarco HAT. What specific things does it change in the network settings?

    I am not able to connect anymore using web browser or putty after installing DWM.

    Cheers

    Mike



  • Hi Mike,
    sorry for the trouble. The main change is that the DWM turn on DHCP on your device. So if you had configured your network with static IP address, there will be a problem. Please check your network settings with

    sudo nano /etc/systemd/network/eth0.network
    

    Cheers
    Jan



  • Thanks Jan,

    Will changing it back or fixing it affect DWM?

    Cheers

    Mike



  • Hi Jan,

    I disable DHCP and was able to reconnect. I have the below error though, and I can't see any archives. I can see that I am connected to the Monarco, not all data seems to be available. Do I need a license for this? RexArc may also be missing some files. I am using stretch.

    f5d41e25-d189-49bf-972c-c8c18afd4f77-image.png
    db3f85a6-6a3f-432c-a855-72816785e396-image.png

    Cheers

    Mike



  • Hi Mike,
    you don't need any special license for DWM yet. It's look to me that you have a problem with DNS server. Is that possible? Please take a look at /etc/systemd/network/eth0.network once again and set Gateway and DNS if you didn't that before.
    https://wiki.archlinux.org/index.php/systemd-networkd#Wired_adapter_using_a_static_IP

    I've only tested DWM with Buster so far. I'll try it again with Stretch.



  • I've consulted your issue with DWM developers and they advised me on a few things you can try:

    • Please, send me the log after command
    sudo systemctl status systemd-resolved
    
    • Verify the correct installation of RexArc using:
    RexArc -h
    
    • The developers strongly recommend that you start using the Buster release. Currently, testing on Stretch is minimal. Do you have a special reason for using Stretch?

    Kind regards
    Jan



  • Hi Jan,

    Everything works well with Buster, no issues at all. The only reason I am still using Stretch is I haven't made it to this particular rpi to update it. I will make sure it is updated now. The log after running that command in stretch is below.

    pi@monarco:~ $ sudo systemctl status systemd-resolved
    â systemd-resolved.service - Network Name Resolution
    Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor
    Drop-In: /lib/systemd/system/systemd-resolved.service.d
    ââresolvconf.conf
    Active: active (running) since Fri 2020-11-06 14:13:46 NZDT; 3 days ago
    Docs: man:systemd-resolved.service(8)
    http://www.freedesktop.org/wiki/Software/systemd/resolved
    http://www.freedesktop.org/wiki/Software/systemd/writing-network-conf
    http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-cli
    Process: 383 ExecStartPost=/bin/sh -c [ ! -e /run/resolvconf/enable-updates ]
    Main PID: 349 (systemd-resolve)
    Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
    CGroup: /system.slice/systemd-resolved.service
    ââ349 /lib/systemd/systemd-resolved

    Nov 06 13:40:41 monarco systemd[1]: Starting Network Name Resolution...
    Nov 06 13:40:42 monarco systemd-resolved[349]: Positive Trust Anchors:
    Nov 06 13:40:42 monarco systemd-resolved[349]: . IN DS 19036 8 2 49aac11d7b6f644
    Nov 06 13:40:42 monarco systemd-resolved[349]: . IN DS 20326 8 2 e06d44b80b8f1d3
    Nov 06 13:40:42 monarco systemd-resolved[349]: Negative trust anchors: 10.in-add
    Nov 06 13:40:42 monarco systemd-resolved[349]: Using system hostname 'monarco'.
    Nov 06 14:13:46 monarco systemd[1]: Started Network Name Resolution.
    lines 1-23...skipping...
    â systemd-resolved.service - Network Name Resolution
    Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
    Drop-In: /lib/systemd/system/systemd-resolved.service.d
    ââresolvconf.conf
    Active: active (running) since Fri 2020-11-06 14:13:46 NZDT; 3 days ago
    Docs: man:systemd-resolved.service(8)
    http://www.freedesktop.org/wiki/Software/systemd/resolved
    http://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
    http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
    Process: 383 ExecStartPost=/bin/sh -c [ ! -e /run/resolvconf/enable-updates ] || echo "nameserver 127
    Main PID: 349 (systemd-resolve)
    Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
    CGroup: /system.slice/systemd-resolved.service
    ââ349 /lib/systemd/systemd-resolved

    Nov 06 13:40:41 monarco systemd[1]: Starting Network Name Resolution...
    Nov 06 13:40:42 monarco systemd-resolved[349]: Positive Trust Anchors:
    Nov 06 13:40:42 monarco systemd-resolved[349]: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41
    Nov 06 13:40:42 monarco systemd-resolved[349]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880
    Nov 06 13:40:42 monarco systemd-resolved[349]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.a
    Nov 06 13:40:42 monarco systemd-resolved[349]: Using system hostname 'monarco'.
    Nov 06 14:13:46 monarco systemd[1]: Started Network Name Resolution.
    Warning: systemd-resolved.service changed on disk. Run 'systemctl daemon-reload' to reload units.
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    lines 1-24/24 (END)...skipping...
    â systemd-resolved.service - Network Name Resolution
    Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
    Drop-In: /lib/systemd/system/systemd-resolved.service.d
    ââresolvconf.conf
    Active: active (running) since Fri 2020-11-06 14:13:46 NZDT; 3 days ago
    Docs: man:systemd-resolved.service(8)
    http://www.freedesktop.org/wiki/Software/systemd/resolved
    http://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
    http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
    Process: 383 ExecStartPost=/bin/sh -c [ ! -e /run/resolvconf/enable-updates ] || echo "nameserver 127
    Main PID: 349 (systemd-resolve)
    Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
    CGroup: /system.slice/systemd-resolved.service
    ââ349 /lib/systemd/systemd-resolved

    Nov 06 13:40:41 monarco systemd[1]: Starting Network Name Resolution...
    Nov 06 13:40:42 monarco systemd-resolved[349]: Positive Trust Anchors:
    Nov 06 13:40:42 monarco systemd-resolved[349]: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41
    Nov 06 13:40:42 monarco systemd-resolved[349]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880
    Nov 06 13:40:42 monarco systemd-resolved[349]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.a
    Nov 06 13:40:42 monarco systemd-resolved[349]: Using system hostname 'monarco'.
    Nov 06 14:13:46 monarco systemd[1]: Started Network Name Resolution.
    Warning: systemd-resolved.service changed on disk. Run 'systemctl daemon-reload' to reload units.

    Thank you for your help with this.

    Cheers

    Mike



  • Hi Mike,
    it looks everything is fine according to the log and the error is somewhere else. If you update Raspberry to Buster, we will not have to deal with the problems caused by the incompatibility with the Raspbian Stretch that is considered as unsupported.



  • Hi Jan,

    No problem, I will update all to Buster. Thank you for your help.

    Cheers

    Mike



  • You're welcome Mike. Good luck with your project.

    Cheers
    Jan


Log in to reply