Domoticz uptime on the dashboard. Topic is solved

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Domoticz uptime on the dashboard.

Post by EddyG »

It would be nice to have a Domoticz "uptime" on the dashboard.
If there is a problem with Domoticz I use monit to restart Domoticz.
By the "uptime" I could figure out if that happened recently and have to investigate why the restart took place.
SweetPants

Re: Domoticz uptime on the dashboard.

Post by SweetPants »

Uptime will only show you how long ago domoticz was restarted for the last time. What if this happend more times?
You can get more information from the monit log file /var/log/monit.log
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Domoticz uptime on the dashboard.

Post by EddyG »

I use the HTML interface daily and Domoticz is running fine for days or even weeks.
I would like to see on the interface if there was a restart.
If I see a recent restart then I could investigate monit.log and others for the reason of the restart.
Now I have to check monit.log every once in a while (or daily) and find out there there where a lot of restarts 5 days ago.
safi78
Posts: 204
Joined: Thursday 05 September 2013 15:39
Target OS: Linux
Domoticz version: LastBeta
Contact:

Re: Domoticz uptime on the dashboard.

Post by safi78 »

Or have monit send you a message with Pushover? There's a very easy script for that (just google monit and pushover).

Works like a charm for me :)
homebridge, rfxcom, zwave, nest, applamp, hue, debian, apple, mysensors, netatmo, fibaro, synology, foscam, otherz
jackslayter
Posts: 59
Joined: Tuesday 07 October 2014 11:00
Target OS: Raspberry Pi / ODroid
Domoticz version: stable
Location: France RA
Contact:

Re: Domoticz uptime on the dashboard.

Post by jackslayter »

hi, add a new text dummy and this script

Code: Select all

#!/bin/sh
#uptime.sh

pid=`ps -ef |grep 'domoticz -daemon' |grep -v grep |awk '{print $2}'`
updz=`ps -p $pid -o %t | tail -1 | sed -e 's/^[ \t]*//;s/[ \t]*$//' | awk 'sub( "...$", "" )'`

itime=`uptime | awk '{print $1}' | awk 'sub( "...$", "" )'`

min=$(uptime | grep -ci min)
day=$(uptime | grep -ci day)
if  [ $min -eq 1 ] ; then
uptime=`uptime | awk '{print $3}'`
uptime2=`uptime | awk '{print $4}'`
elif [ $day -eq 1 ] ; then
uptime=`uptime | awk '{print $3}'`
uptime3=`uptime | awk '{print $5}'`
else
uptime=`uptime | awk '{print $3}'`
fi

curl "http://IPADRESS:PORT/json.htm?type=command&param=udevice&idx=TEXTIDX&nvalue=0&svalue="$itime"%2c%20up%20"$uptime"%20"$uptime2"-"$uptime3"%20Dz%20"$updz""
and chmod +x uptime.sh
jhdhj.png
jhdhj.png (4.09 KiB) Viewed 5817 times
RPi2 + RFLink, Domoticz
Chacon - micromodule 200w, remote 3b, 2x module 1000w, remote 16b, smoke detector, door contact, 2x 3500w plug
Oregon - 3x Thgr122Nx / OWL - CM180 / TRC02_2 RGB / Cheap - PiR, door contact, Temp Hum / 4x REVOLT NC5461
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Domoticz uptime on the dashboard.

Post by EddyG »

I use telegram, and thats works perfectly. I know.
BUT. recently Domoticz was restarted frequently so I got a lot of alerts.
So thats why I suggest an "uptime" on the dashbord.

In my opinion it does not hurt anybody to add such a feature.

EDIT:
The above script is a good solution too (thanks), but takes up the place of a button on the dashboard.
pluggin
Posts: 45
Joined: Tuesday 26 May 2015 22:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Argentina
Contact:

Re: Domoticz uptime on the dashboard.

Post by pluggin »

this is my script for uptime

#!/bin/bash
pid=`ps -ef |grep "domoticz -daemon -www"|grep -v grep |awk '{print $2}'`
updz=`ps -p $pid -o %t | tail -1 | sed -e 's/^[ \t]*//;s/[ \t]*$//'`
val=$(echo ${updz/-/day(s)%20})
curl -s "http://IP:PORT/json.htm?type=command&param=udevice&idx=100&nvalue=3&svalue=$val" > /dev/null

I use a TEXT sensor for display the value
Razberry + 4 Eversrping HSM02 + 2 Aeotec Multi-Sensor + 1 Aeotec Micro Dimmer + 4 Aeotec Micro Smart Energy Switch, 2nd + 1 Remotec ZXT-120 + 1 Aeotec Smart Energy Monitor + 1 Everspring SE812 indoor Siren + 2 fibaro motion sensor + Aeotec water sensor
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Domoticz uptime on the dashboard.

Post by EddyG »

Hi,
Tnx, for the sensor script.
Found it in Setup -> About.
Thats good for me too.
Was it always there?
User avatar
gizmocuz
Posts: 2548
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Domoticz uptime on the dashboard.

Post by gizmocuz »

No, it was added a few days ago (did not know about this thread... so it was a coincidence ;)
Quality outlives Quantity!
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Domoticz uptime on the dashboard.

Post by EddyG »

Tnx. :D :D :D
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: Domoticz uptime on the dashboard.

Post by stlaha2007 »

The Setup/About is strange.
Running domotics for more dan 16000 days.. Started begin of July ;-)
Guess it reads a wrong value...

The script of Pluggin seems correctly reading current pid and runtime of it. As Domoticz will change pid when a restart accurred.


Sent from my D6503 using Tapatalk
stlaha2007
Posts: 370
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: Domoticz uptime on the dashboard.

Post by stlaha2007 »

gizmocuz wrote:No, it was added a few days ago (did not know about this thread... so it was a coincidence ;)
Found it and checked it... However this is what About says:

Code: Select all

 About Domoticz

Version: 2.3530
Build Hash: 9eef872
Compile Date: 2015-11-01 11:41:18

Uptime: 16755 Dagen, 19 Uren, 39 Minuten, 55 Seconden 
Last reboot was Nov 7, 2015.
Seems that the format isn't correct or using some other timecode/timesource.

According to uptime:
Time 20:48:40 up 9 days 7:29, 3 users...
9 days 7 hours 29 minutes comes close to restart around 14.00h.




Sent from my D6503 using Tapatalk
User avatar
proohu01
Posts: 95
Joined: Friday 17 October 2014 12:20
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Domoticz uptime on the dashboard.

Post by proohu01 »

Is there a way to use this uptime value into a LUA script variable?

I have a couple of switches that send me a picture using Telegram. I alway get a lot of messages when the system is rebooted or when I update (restart) Domoticz. I would like to be able to change my LUA scripts so it doesn't do anything if the uptime is less than a minute.
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra
Kjakan
Posts: 14
Joined: Wednesday 11 March 2015 14:03
Target OS: Linux
Domoticz version: 2024.2
Location: Norway
Contact:

Re: Domoticz uptime on the dashboard.

Post by Kjakan »

I want to know about this to.

UptimeInMinutes or similar would be a nice feature.
User avatar
proohu01
Posts: 95
Joined: Friday 17 October 2014 12:20
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Domoticz uptime on the dashboard.

Post by proohu01 »

A standard method would be a very nice addition indeed? Any chance of getting this into Domoticz as a feature? UptimeInMinutes sound good to me.

In the meantime, I cooked up some lua code that works for me now...

Code: Select all

commandArray = {}

	n = os.tmpname ()
	os.execute ("var=$(ps -eo pid,args |grep 'domoticz -daemon' | grep -v grep |awk '{print $1}') && echo $(($(cut -d '.' -f1 /proc/uptime) - $(($(cut -d ' ' -f22 /proc/$var/stat)/100)))) > " .. n)
	for line in io.lines (n) do
		UptimeInSeconds = line
	end
	os.remove (n)

	UptimeInSeconds = tonumber(UptimeInSeconds);
	-- print('Domoticz has been running for '.. UptimeInSeconds .. ' seconds')
	if UptimeInSeconds < 90 then
	    print('Domoticz uptime is less than 90 seconds')
	    commandArray['SendNotification']='Domoticz uptime is less than 90 seconds'
    end

return commandArray
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra
MacJL
Posts: 51
Joined: Tuesday 22 April 2014 22:17
Target OS: OS X
Domoticz version: Beta
Location: France
Contact:

Re: Domoticz uptime on the dashboard.

Post by MacJL »

Hello,

Why not adding a counter device for uptime in motherboard sensors?
It would be quite simple, can be used with blocky/scripts, and would have an history :D .
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest