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 <
[email protected]> 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" <[email protected]>:
>
> 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" <
> [email protected]>:
>
> 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>*
>
>
>
>
>