You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@edgent.apache.org by Felipe Gutierrez <fe...@gmail.com> on 2018/11/18 10:48:53 UTC

How do I monitor properties of my RaspberryPi and send it to an IoT Gateway?

Hi,

On the Edgent documentations is mentioned:

 "You can send data from an Edgent application to your back-end system when
you need to perform analysis that cannot be performed on the edge device,
such as:

Running a complex analytic algorithm that requires more resources, such as
CPU or memory, than are available on the edge device." (
https://edgent.apache.org/docs/overview)

I understood that the Edgent daemon on the device is constantly monitoring
its properties (CPU and memory) and this daemon decides to not perform the
analytics on the RPi when it has lack of resource but perform on a layer
above. Is it right?

How can I implement a program using Edgent to send this type of metadata to
a layer above? Let's say I want to sent metadata regarding CPU, memory and
storage usage from the RPi to an IoT gateway.

Thanks,
Felipe
*--*
*-- Felipe Gutierrez*

*-- skype: felipe.o.gutierrez*
*--* *https://felipeogutierrez.blogspot.com
<https://felipeogutierrez.blogspot.com>*

Re: How do I monitor properties of my RaspberryPi and send it to an IoT Gateway?

Posted by Nuwan Jayawardene <ns...@gmail.com>.
Hi Felipe,

I'm not quite sure if this is possible, but have you considered a portable
stream processor that could be run on Edgent?
Perhaps it can maintain certain threshold parameters for resource
utilization in the device and trigger a call to the backend if those are
exceeded.

Thanks and best regards.

On Sun, Nov 18, 2018 at 5:21 PM Christofer Dutz <ch...@c-ware.de>
wrote:

> Hi Felipe,
>
> If you want to access CPU, Memory and Disk usage, you could have a look at
> this library:
>         <dependency>
>             <groupId>org.fusesource</groupId>
>             <artifactId>sigar</artifactId>
>             <version>1.6.4</version>
>         </dependency>
>
> I am using this in another project and it's working nicely. I'm using is
> in a Scala Akka Actor, but it shouldn't be difficult to see how to use it
> in Java:
>
> https://github.com/chrisdutz/RAPIRO/blob/master/server/telemetry/src/main/scala/de/codecentric/iot/rapiro/telemetry/actors/TelemetryActor.scala
> ... but thinking about it ... I think it would be a great option to add a
> Edgent Source providing such data.
> Because with this, you could eventually create data-streams that adapt to
> the load on the Edge device ...
>
> It shouldn't be hard to implement ... and as I posted in my reply on the
> other thread, I don't think Edgent currently has something like that. I
> just did a quick full-text-search and couldn't find anything?
>
> Feel tempted to implement such a connector? We're currently trying to
> re-initiate the committer-base of Edgent and contributions like this would
> be highly valued :-)
>
> Chris
>
>
>
> Am 18.11.18, 12:44 schrieb "Felipe Gutierrez" <
> felipe.o.gutierrez@gmail.com>:
>
>     Hi,
>
>     On the Edgent documentations is mentioned:
>
>      "You can send data from an Edgent application to your back-end system
> when
>     you need to perform analysis that cannot be performed on the edge
> device,
>     such as:
>
>     Running a complex analytic algorithm that requires more resources,
> such as
>     CPU or memory, than are available on the edge device." (
>     https://edgent.apache.org/docs/overview)
>
>     I understood that the Edgent daemon on the device is constantly
> monitoring
>     its properties (CPU and memory) and this daemon decides to not perform
> the
>     analytics on the RPi when it has lack of resource but perform on a
> layer
>     above. Is it right?
>
>     How can I implement a program using Edgent to send this type of
> metadata to
>     a layer above? Let's say I want to sent metadata regarding CPU, memory
> and
>     storage usage from the RPi to an IoT gateway.
>
>     Thanks,
>     Felipe
>     *--*
>     *-- Felipe Gutierrez*
>
>     *-- skype: felipe.o.gutierrez*
>     *--* *https://felipeogutierrez.blogspot.com
>     <https://felipeogutierrez.blogspot.com>*
>
>
>

-- 

*Nuwan Jayawardene*
Computer Science Undergraduate at Informatics Institute of Technology(IIT),
Colombo
Tel - +94 71 181 3299
https://www.linkedin.com/in/nuwanjaya/
https://medium.com/@nuwanjaya

Re: How do I monitor properties of my RaspberryPi and send it to an IoT Gateway?

Posted by Julian Feinauer <j....@pragmaticminds.de>.
Hey Felipe,

a big +1 for you!
If you face any problems or have questions, just come back to the list and we'll figure it out together.

Julian

Am 19.11.18, 13:27 schrieb "Felipe Gutierrez" <fe...@gmail.com>:

    Hi,
    
    thanks for the quick responses.
    I do feel tempted to implement it =). I am planning to get my hands dirty
    with Apache Edgent and RPi's and the feature that I described is the first
    that I will need. By now I am listing all the features that I will need in
    my small project and if my supervisor agrees with my idea I will go towards
    this way.
    
    Best Regards,
    Felipe
    *--*
    *-- Felipe Gutierrez*
    
    *-- skype: felipe.o.gutierrez*
    *--* *https://felipeogutierrez.blogspot.com
    <https://felipeogutierrez.blogspot.com>*
    
    
    On Mon, Nov 19, 2018 at 2:15 AM Gayashan Amarasinghe <
    gayashan.amarasinghe@gmail.com> wrote:
    
    > Hi Felipe,
    >
    > I had this simple source below that I had implemented before for some
    > testing. It might be of some use to you. The library I used is:
    >         <dependency>
    >             <groupId>com.github.oshi</groupId>
    >             <artifactId>oshi-core</artifactId>
    >             <version>3.4.2</version>
    >         </dependency>
    >
    > You can read from the source and send it to an upper layer via MQTT
    > connector or some other method as Chris and Julian has mentioned.
    >
    > import org.apache.edgent.function.Supplier;
    >
    > import oshi.hardware.Sensors;
    > import oshi.hardware.platform.linux.LinuxSensors;
    > /**
    >  * Read current CPU temperature
    >  */
    > public class CPUTempSensor implements Supplier<Double> {
    >     @Override
    >     public Double get() {
    >         Sensors sensors = new LinuxSensors();
    >         return sensors.getCpuTemperature();
    >     }
    > }
    >
    > Best,
    > Gayashan
    >
    >
    > On Mon, Nov 19, 2018 at 5:58 AM Julian Feinauer <
    > j.feinauer@pragmaticminds.de> wrote:
    >
    > > Hi,
    > >
    > > I'm a bit late tot he party.
    > > Thinking about it, it's a pretty obvious requirement, to have some
    > > statistics about the jvm reported regularly.
    > > I think it should be pretty easy to spin up a Source Component for that,
    > > e.g., using the library noted by chris.
    > > This source could the be polled repeatedly with whatever frequency you
    > > want.
    > >
    > > If you like to do so, chris or I can give you some further hints about
    > > that as we both already implemented sources for edgent.
    > >
    > > Best
    > > Julian
    > >
    > > Am 18.11.18, 12:51 schrieb "Christofer Dutz" <christofer.dutz@c-ware.de
    > >:
    > >
    > >     Hi Felipe,
    > >
    > >     If you want to access CPU, Memory and Disk usage, you could have a
    > > look at this library:
    > >             <dependency>
    > >                 <groupId>org.fusesource</groupId>
    > >                 <artifactId>sigar</artifactId>
    > >                 <version>1.6.4</version>
    > >             </dependency>
    > >
    > >     I am using this in another project and it's working nicely. I'm using
    > > is in a Scala Akka Actor, but it shouldn't be difficult to see how to use
    > > it in Java:
    > >
    > >
    > https://github.com/chrisdutz/RAPIRO/blob/master/server/telemetry/src/main/scala/de/codecentric/iot/rapiro/telemetry/actors/TelemetryActor.scala
    > >     ... but thinking about it ... I think it would be a great option to
    > > add a Edgent Source providing such data.
    > >     Because with this, you could eventually create data-streams that
    > adapt
    > > to the load on the Edge device ...
    > >
    > >     It shouldn't be hard to implement ... and as I posted in my reply on
    > > the other thread, I don't think Edgent currently has something like
    > that. I
    > > just did a quick full-text-search and couldn't find anything?
    > >
    > >     Feel tempted to implement such a connector? We're currently trying to
    > > re-initiate the committer-base of Edgent and contributions like this
    > would
    > > be highly valued :-)
    > >
    > >     Chris
    > >
    > >
    > >
    > >     Am 18.11.18, 12:44 schrieb "Felipe Gutierrez" <
    > > felipe.o.gutierrez@gmail.com>:
    > >
    > >         Hi,
    > >
    > >         On the Edgent documentations is mentioned:
    > >
    > >          "You can send data from an Edgent application to your back-end
    > > system when
    > >         you need to perform analysis that cannot be performed on the edge
    > > device,
    > >         such as:
    > >
    > >         Running a complex analytic algorithm that requires more
    > resources,
    > > such as
    > >         CPU or memory, than are available on the edge device." (
    > >         https://edgent.apache.org/docs/overview)
    > >
    > >         I understood that the Edgent daemon on the device is constantly
    > > monitoring
    > >         its properties (CPU and memory) and this daemon decides to not
    > > perform the
    > >         analytics on the RPi when it has lack of resource but perform on
    > a
    > > layer
    > >         above. Is it right?
    > >
    > >         How can I implement a program using Edgent to send this type of
    > > metadata to
    > >         a layer above? Let's say I want to sent metadata regarding CPU,
    > > memory and
    > >         storage usage from the RPi to an IoT gateway.
    > >
    > >         Thanks,
    > >         Felipe
    > >         *--*
    > >         *-- Felipe Gutierrez*
    > >
    > >         *-- skype: felipe.o.gutierrez*
    > >         *--* *https://felipeogutierrez.blogspot.com
    > >         <https://felipeogutierrez.blogspot.com>*
    > >
    > >
    > >
    > >
    > >
    >
    


Re: How do I monitor properties of my RaspberryPi and send it to an IoT Gateway?

Posted by Felipe Gutierrez <fe...@gmail.com>.
Hi,

thanks for the quick responses.
I do feel tempted to implement it =). I am planning to get my hands dirty
with Apache Edgent and RPi's and the feature that I described is the first
that I will need. By now I am listing all the features that I will need in
my small project and if my supervisor agrees with my idea I will go towards
this way.

Best Regards,
Felipe
*--*
*-- Felipe Gutierrez*

*-- skype: felipe.o.gutierrez*
*--* *https://felipeogutierrez.blogspot.com
<https://felipeogutierrez.blogspot.com>*


On Mon, Nov 19, 2018 at 2:15 AM Gayashan Amarasinghe <
gayashan.amarasinghe@gmail.com> wrote:

> Hi Felipe,
>
> I had this simple source below that I had implemented before for some
> testing. It might be of some use to you. The library I used is:
>         <dependency>
>             <groupId>com.github.oshi</groupId>
>             <artifactId>oshi-core</artifactId>
>             <version>3.4.2</version>
>         </dependency>
>
> You can read from the source and send it to an upper layer via MQTT
> connector or some other method as Chris and Julian has mentioned.
>
> import org.apache.edgent.function.Supplier;
>
> import oshi.hardware.Sensors;
> import oshi.hardware.platform.linux.LinuxSensors;
> /**
>  * Read current CPU temperature
>  */
> public class CPUTempSensor implements Supplier<Double> {
>     @Override
>     public Double get() {
>         Sensors sensors = new LinuxSensors();
>         return sensors.getCpuTemperature();
>     }
> }
>
> Best,
> Gayashan
>
>
> On Mon, Nov 19, 2018 at 5:58 AM Julian Feinauer <
> j.feinauer@pragmaticminds.de> wrote:
>
> > Hi,
> >
> > I'm a bit late tot he party.
> > Thinking about it, it's a pretty obvious requirement, to have some
> > statistics about the jvm reported regularly.
> > I think it should be pretty easy to spin up a Source Component for that,
> > e.g., using the library noted by chris.
> > This source could the be polled repeatedly with whatever frequency you
> > want.
> >
> > If you like to do so, chris or I can give you some further hints about
> > that as we both already implemented sources for edgent.
> >
> > Best
> > Julian
> >
> > Am 18.11.18, 12:51 schrieb "Christofer Dutz" <christofer.dutz@c-ware.de
> >:
> >
> >     Hi Felipe,
> >
> >     If you want to access CPU, Memory and Disk usage, you could have a
> > look at this library:
> >             <dependency>
> >                 <groupId>org.fusesource</groupId>
> >                 <artifactId>sigar</artifactId>
> >                 <version>1.6.4</version>
> >             </dependency>
> >
> >     I am using this in another project and it's working nicely. I'm using
> > is in a Scala Akka Actor, but it shouldn't be difficult to see how to use
> > it in Java:
> >
> >
> https://github.com/chrisdutz/RAPIRO/blob/master/server/telemetry/src/main/scala/de/codecentric/iot/rapiro/telemetry/actors/TelemetryActor.scala
> >     ... but thinking about it ... I think it would be a great option to
> > add a Edgent Source providing such data.
> >     Because with this, you could eventually create data-streams that
> adapt
> > to the load on the Edge device ...
> >
> >     It shouldn't be hard to implement ... and as I posted in my reply on
> > the other thread, I don't think Edgent currently has something like
> that. I
> > just did a quick full-text-search and couldn't find anything?
> >
> >     Feel tempted to implement such a connector? We're currently trying to
> > re-initiate the committer-base of Edgent and contributions like this
> would
> > be highly valued :-)
> >
> >     Chris
> >
> >
> >
> >     Am 18.11.18, 12:44 schrieb "Felipe Gutierrez" <
> > felipe.o.gutierrez@gmail.com>:
> >
> >         Hi,
> >
> >         On the Edgent documentations is mentioned:
> >
> >          "You can send data from an Edgent application to your back-end
> > system when
> >         you need to perform analysis that cannot be performed on the edge
> > device,
> >         such as:
> >
> >         Running a complex analytic algorithm that requires more
> resources,
> > such as
> >         CPU or memory, than are available on the edge device." (
> >         https://edgent.apache.org/docs/overview)
> >
> >         I understood that the Edgent daemon on the device is constantly
> > monitoring
> >         its properties (CPU and memory) and this daemon decides to not
> > perform the
> >         analytics on the RPi when it has lack of resource but perform on
> a
> > layer
> >         above. Is it right?
> >
> >         How can I implement a program using Edgent to send this type of
> > metadata to
> >         a layer above? Let's say I want to sent metadata regarding CPU,
> > memory and
> >         storage usage from the RPi to an IoT gateway.
> >
> >         Thanks,
> >         Felipe
> >         *--*
> >         *-- Felipe Gutierrez*
> >
> >         *-- skype: felipe.o.gutierrez*
> >         *--* *https://felipeogutierrez.blogspot.com
> >         <https://felipeogutierrez.blogspot.com>*
> >
> >
> >
> >
> >
>

Re: How do I monitor properties of my RaspberryPi and send it to an IoT Gateway?

Posted by Gayashan Amarasinghe <ga...@gmail.com>.
Hi Felipe,

I had this simple source below that I had implemented before for some
testing. It might be of some use to you. The library I used is:
        <dependency>
            <groupId>com.github.oshi</groupId>
            <artifactId>oshi-core</artifactId>
            <version>3.4.2</version>
        </dependency>

You can read from the source and send it to an upper layer via MQTT
connector or some other method as Chris and Julian has mentioned.

import org.apache.edgent.function.Supplier;

import oshi.hardware.Sensors;
import oshi.hardware.platform.linux.LinuxSensors;
/**
 * Read current CPU temperature
 */
public class CPUTempSensor implements Supplier<Double> {
    @Override
    public Double get() {
        Sensors sensors = new LinuxSensors();
        return sensors.getCpuTemperature();
    }
}

Best,
Gayashan


On Mon, Nov 19, 2018 at 5:58 AM Julian Feinauer <
j.feinauer@pragmaticminds.de> wrote:

> Hi,
>
> I'm a bit late tot he party.
> Thinking about it, it's a pretty obvious requirement, to have some
> statistics about the jvm reported regularly.
> I think it should be pretty easy to spin up a Source Component for that,
> e.g., using the library noted by chris.
> This source could the be polled repeatedly with whatever frequency you
> want.
>
> If you like to do so, chris or I can give you some further hints about
> that as we both already implemented sources for edgent.
>
> Best
> Julian
>
> Am 18.11.18, 12:51 schrieb "Christofer Dutz" <ch...@c-ware.de>:
>
>     Hi Felipe,
>
>     If you want to access CPU, Memory and Disk usage, you could have a
> look at this library:
>             <dependency>
>                 <groupId>org.fusesource</groupId>
>                 <artifactId>sigar</artifactId>
>                 <version>1.6.4</version>
>             </dependency>
>
>     I am using this in another project and it's working nicely. I'm using
> is in a Scala Akka Actor, but it shouldn't be difficult to see how to use
> it in Java:
>
> https://github.com/chrisdutz/RAPIRO/blob/master/server/telemetry/src/main/scala/de/codecentric/iot/rapiro/telemetry/actors/TelemetryActor.scala
>     ... but thinking about it ... I think it would be a great option to
> add a Edgent Source providing such data.
>     Because with this, you could eventually create data-streams that adapt
> to the load on the Edge device ...
>
>     It shouldn't be hard to implement ... and as I posted in my reply on
> the other thread, I don't think Edgent currently has something like that. I
> just did a quick full-text-search and couldn't find anything?
>
>     Feel tempted to implement such a connector? We're currently trying to
> re-initiate the committer-base of Edgent and contributions like this would
> be highly valued :-)
>
>     Chris
>
>
>
>     Am 18.11.18, 12:44 schrieb "Felipe Gutierrez" <
> felipe.o.gutierrez@gmail.com>:
>
>         Hi,
>
>         On the Edgent documentations is mentioned:
>
>          "You can send data from an Edgent application to your back-end
> system when
>         you need to perform analysis that cannot be performed on the edge
> device,
>         such as:
>
>         Running a complex analytic algorithm that requires more resources,
> such as
>         CPU or memory, than are available on the edge device." (
>         https://edgent.apache.org/docs/overview)
>
>         I understood that the Edgent daemon on the device is constantly
> monitoring
>         its properties (CPU and memory) and this daemon decides to not
> perform the
>         analytics on the RPi when it has lack of resource but perform on a
> layer
>         above. Is it right?
>
>         How can I implement a program using Edgent to send this type of
> metadata to
>         a layer above? Let's say I want to sent metadata regarding CPU,
> memory and
>         storage usage from the RPi to an IoT gateway.
>
>         Thanks,
>         Felipe
>         *--*
>         *-- Felipe Gutierrez*
>
>         *-- skype: felipe.o.gutierrez*
>         *--* *https://felipeogutierrez.blogspot.com
>         <https://felipeogutierrez.blogspot.com>*
>
>
>
>
>

Re: How do I monitor properties of my RaspberryPi and send it to an IoT Gateway?

Posted by Julian Feinauer <j....@pragmaticminds.de>.
Hi,

I'm a bit late tot he party.
Thinking about it, it's a pretty obvious requirement, to have some statistics about the jvm reported regularly.
I think it should be pretty easy to spin up a Source Component for that, e.g., using the library noted by chris.
This source could the be polled repeatedly with whatever frequency you want.

If you like to do so, chris or I can give you some further hints about that as we both already implemented sources for edgent.

Best
Julian

Am 18.11.18, 12:51 schrieb "Christofer Dutz" <ch...@c-ware.de>:

    Hi Felipe,
    
    If you want to access CPU, Memory and Disk usage, you could have a look at this library:
            <dependency>
                <groupId>org.fusesource</groupId>
                <artifactId>sigar</artifactId>
                <version>1.6.4</version>
            </dependency>
    
    I am using this in another project and it's working nicely. I'm using is in a Scala Akka Actor, but it shouldn't be difficult to see how to use it in Java:
    https://github.com/chrisdutz/RAPIRO/blob/master/server/telemetry/src/main/scala/de/codecentric/iot/rapiro/telemetry/actors/TelemetryActor.scala
    ... but thinking about it ... I think it would be a great option to add a Edgent Source providing such data.
    Because with this, you could eventually create data-streams that adapt to the load on the Edge device ... 
    
    It shouldn't be hard to implement ... and as I posted in my reply on the other thread, I don't think Edgent currently has something like that. I just did a quick full-text-search and couldn't find anything?
    
    Feel tempted to implement such a connector? We're currently trying to re-initiate the committer-base of Edgent and contributions like this would be highly valued :-)
    
    Chris
    
    
    
    Am 18.11.18, 12:44 schrieb "Felipe Gutierrez" <fe...@gmail.com>:
    
        Hi,
        
        On the Edgent documentations is mentioned:
        
         "You can send data from an Edgent application to your back-end system when
        you need to perform analysis that cannot be performed on the edge device,
        such as:
        
        Running a complex analytic algorithm that requires more resources, such as
        CPU or memory, than are available on the edge device." (
        https://edgent.apache.org/docs/overview)
        
        I understood that the Edgent daemon on the device is constantly monitoring
        its properties (CPU and memory) and this daemon decides to not perform the
        analytics on the RPi when it has lack of resource but perform on a layer
        above. Is it right?
        
        How can I implement a program using Edgent to send this type of metadata to
        a layer above? Let's say I want to sent metadata regarding CPU, memory and
        storage usage from the RPi to an IoT gateway.
        
        Thanks,
        Felipe
        *--*
        *-- Felipe Gutierrez*
        
        *-- skype: felipe.o.gutierrez*
        *--* *https://felipeogutierrez.blogspot.com
        <https://felipeogutierrez.blogspot.com>*
        
    
    


AW: How do I monitor properties of my RaspberryPi and send it to an IoT Gateway?

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Felipe,

If you want to access CPU, Memory and Disk usage, you could have a look at this library:
        <dependency>
            <groupId>org.fusesource</groupId>
            <artifactId>sigar</artifactId>
            <version>1.6.4</version>
        </dependency>

I am using this in another project and it's working nicely. I'm using is in a Scala Akka Actor, but it shouldn't be difficult to see how to use it in Java:
https://github.com/chrisdutz/RAPIRO/blob/master/server/telemetry/src/main/scala/de/codecentric/iot/rapiro/telemetry/actors/TelemetryActor.scala
... but thinking about it ... I think it would be a great option to add a Edgent Source providing such data.
Because with this, you could eventually create data-streams that adapt to the load on the Edge device ... 

It shouldn't be hard to implement ... and as I posted in my reply on the other thread, I don't think Edgent currently has something like that. I just did a quick full-text-search and couldn't find anything?

Feel tempted to implement such a connector? We're currently trying to re-initiate the committer-base of Edgent and contributions like this would be highly valued :-)

Chris



Am 18.11.18, 12:44 schrieb "Felipe Gutierrez" <fe...@gmail.com>:

    Hi,
    
    On the Edgent documentations is mentioned:
    
     "You can send data from an Edgent application to your back-end system when
    you need to perform analysis that cannot be performed on the edge device,
    such as:
    
    Running a complex analytic algorithm that requires more resources, such as
    CPU or memory, than are available on the edge device." (
    https://edgent.apache.org/docs/overview)
    
    I understood that the Edgent daemon on the device is constantly monitoring
    its properties (CPU and memory) and this daemon decides to not perform the
    analytics on the RPi when it has lack of resource but perform on a layer
    above. Is it right?
    
    How can I implement a program using Edgent to send this type of metadata to
    a layer above? Let's say I want to sent metadata regarding CPU, memory and
    storage usage from the RPi to an IoT gateway.
    
    Thanks,
    Felipe
    *--*
    *-- Felipe Gutierrez*
    
    *-- skype: felipe.o.gutierrez*
    *--* *https://felipeogutierrez.blogspot.com
    <https://felipeogutierrez.blogspot.com>*