Upptid för Raspberry Pi
-
- Posts: 57
- Joined: Fri Mar 17, 2023 9:45 am
Upptid för Raspberry Pi
Är det möjligt att se vilken upptid min Raspberry Pi har sedan sista omstart?
/misterleffe
/misterleffe
-
- Posts: 57
- Joined: Fri Mar 17, 2023 9:45 am
Re: Re:
Låter som jag också kunde bidra med bonuspoäng till "projektet". Näpet att kunna se det i Remote!KHolm wrote:Bonuspoäng till den som klurar ut ett Regex för att plocka resultat från /usr/bin/uptime till en användbar datafetchermagnus07 wrote:Prova med kommandot: uptime
/Marcus
Tack magnus07 för kommandot! Ingen fena på Linux -ännu!
/misterleffe
Re: Upptid för Raspberry Pi
To be used in a datafetcher:
Results in the following signal:
This gives you days, hours, minutes and seconds that can be transformed into a single string or multiple integers using a Signal Transform - based on what you need.
Instead of using the very hard to parse /usr/sbin/uptime I use what is reported on /proc/uptime where the first argument is number of seconds the system has been up.
E.g.
References:
http://en.wikipedia.org/wiki/Uptime#Usi ... c.2Fuptime
http://unix.stackexchange.com/questions ... ormat-date
/Marcus
Code: Select all
FetchType: Execute
ParserType: Line,Scanf
Executable: awk '{printf("%d:%02d:%02d:%02d",($1/60/60/24),($1/60/60%24),($1/60%60),($1%60))}' /proc/uptime
Scanf: %s
Code: Select all
datafetcher,3,Uptime,fetched:3:00:57:23
Instead of using the very hard to parse /usr/sbin/uptime I use what is reported on /proc/uptime where the first argument is number of seconds the system has been up.
E.g.
Code: Select all
Pattern to match: datafetcher,3,Uptime,fetched:%i:%i:%i:%i
Parsed variable to store: 2
Variable to uptate: UptimeHours (integer)
Pattern to match: datafetcher,3,Uptime,fetched:%s
Parsed variable to store: 1
Variable to uptate: Uptime (String)
http://en.wikipedia.org/wiki/Uptime#Usi ... c.2Fuptime
http://unix.stackexchange.com/questions ... ormat-date
/Marcus
-
- Posts: 57
- Joined: Fri Mar 17, 2023 9:45 am
Re: Upptid för Raspberry Pi
Works like a charm! Think you got the bonuspoints Marcus!
Is it possible, maybe in the same way, to collect data from tempsensors and put it on the Web for showing graphs? I wanna collect data for statistics over time and present it monthly, weekly or daily. Yes I know there is plot function in Autmagically and it's fine if you only want to know the last 24 hours. Is it possible to do this in Automagically? Could it be possible to FTP the collected data and have the database "outside" the Raspberry? Otherwise the SD card will be filled up very soon?
I'm not so good in Linux, so therefore I ask the "Brains" in this Forum, kindly ...
/misterleffe
Is it possible, maybe in the same way, to collect data from tempsensors and put it on the Web for showing graphs? I wanna collect data for statistics over time and present it monthly, weekly or daily. Yes I know there is plot function in Autmagically and it's fine if you only want to know the last 24 hours. Is it possible to do this in Automagically? Could it be possible to FTP the collected data and have the database "outside" the Raspberry? Otherwise the SD card will be filled up very soon?
I'm not so good in Linux, so therefore I ask the "Brains" in this Forum, kindly ...
/misterleffe
Re: Upptid för Raspberry Pi
Since Automagically now reports sensors to live, I guess tellmon.net may do what you want. Check out this post and try it out.
http://www.telldus.com/forum/viewtopic.php?f=11&t=4173
Or, a cron job usling tdtool -l with sed/awk will collect data for you to fetch/parse...
/Marcus
http://www.telldus.com/forum/viewtopic.php?f=11&t=4173
Or, a cron job usling tdtool -l with sed/awk will collect data for you to fetch/parse...
/Marcus
-
- Posts: 57
- Joined: Fri Mar 17, 2023 9:45 am
Re: Upptid för Raspberry Pi
I will have a look at tellmon.net and test it. In fact, I want to store and make graphs locally, but my skills in Linux is to poor for doing that kind of stuff. I've heard about the tdtool, but honestly, I don't know how to use it and for sure, not to fetch data and put it into a graph ... Is tdtool a plugin which works together with Automagically? Do I have to get it and install it "in to" Automagically?KHolm wrote:Since Automagically now reports sensors to live, I guess tellmon.net may do what you want. Check out this post and try it out.
http://www.telldus.com/forum/viewtopic.php?f=11&t=4173
Or, a cron job usling tdtool -l with sed/awk will collect data for you to fetch/parse...
/Marcus
/misterleffe
Re: Upptid för Raspberry Pi
tdtool is a command line tool from Telldus. It is installed in the Automagically image so nothing is needed to be done to get it up and running.misterleffe wrote:Is tdtool a plugin which works together with Automagically? Do I have to get it and install it "in to" Automagically?
Login to your pi and run the command:
Code: Select all
$ tdtool -l
To turn on a device (id=45):
Code: Select all
$ tdtool --on 45
Code: Select all
$ while sleep 60; do tdtool -l | grep fineoffset | grep 254 | awk '{print $4}';done
Code: Select all
$ while sleep 60; do tdtool -l | grep fineoffset | grep 254 | awk '{print $4}' >> ~/temp.log;done
http://www.cyberciti.biz/tips/linux-wri ... rvice.html
/Marcus
Re: Upptid för Raspberry Pi
Now/Soon there is, see my recent post:misterleffe wrote: Is it possible, maybe in the same way, to collect data from tempsensors and put it on the Web for showing graphs?
http://www.telldus.com/forum/viewtopic.php?f=25&t=4220
/Marcus