how to i access systemmonitor in python
i am trying to make a little monitoring program in python,
trying to access the systemmonitor to get data like wifi data transfer
speed, disk write rate and stuff like that.
can someone give me an example to access the systemmonitor?
example in javascript that i found in textmon's dataengine page
http://maikbeckmann.github.io/plasma-textmon/dataengines.html#sec-6-3-1 :
var sink = {
dataUpdated: function (name, data) {
if (!data["value"]) { return; }
print(data["value"] + data["units"]);
}
};
var engine = dataEngine("systemmonitor");
if ( engine.connectSource("network/interfaces/wlan0/receiver/data", sink,
1000) ) {
print("connection established");
} else {
print("connection attempt failed");
}
print("main.js ends here");
connection established
main.js ends here
124KB/s
97KB/s
131KB/s
No comments:
Post a Comment