[_CODE_] Time To Live - TTL V0.1

EOL, unsupported.

Displays uptime, memory and swap space total/used/free, load for last 1/5/15 minutes, TTL.
Provides events for swapping and EOL.

TTL is defined as:

( MemoryFree [KB] + SwapFree [KB] ) / LeakageRate [KB/s]

Event [tt]‘EOL Yes’[/tt] fires if [tt]TTL < TTLThreshold[/tt] (use as trigger for a scene with [tt]os.execute( ‘reboot’ )[/tt]).
Event [tt]‘SwappingEnabled No’[/tt] fires if swapping is deactivated (use as trigger for a scene with [tt]os.execute( ‘swapon /tmp/log/cmh/swapfile’ )[/tt]).

Service ID:
[tt]urn:upnp-ap15e-com:serviceId:TTL1[/tt]

[tt]TTL[/tt] provides the following [tt]UPnP[/tt] variables:
[tt]Uptime
Load1Min
Load5Min
Load15Min
MemoryTotal
MemoryUsed
MemoryFree
SwapTotal
SwapUsed
SwapFree
TTL
TTLThreshold
EOL
SwappingEnabled
LeakageRate
SamplingInterval
[/tt]
Use [tt]dataMine[/tt] to get an idea of your personal leakage rate.

[tt]TTL[/tt] provides the following [tt]UPnP[/tt] action:
[tt]Refresh[/tt]

[tt]D_TTL.json[/tt] courtesy of [tt]UGC[/tt]:

local UPNP_DEVICE_ID       = 0                 -- MiOS device id of UPnP device to be controlled
local COMPILED_DEVICE_NAME = 'TTL1'

local SID_TTL = 'urn:upnp-ap15e-com:serviceId:TTL1'

local GUI = {
              { { 0  , 0   }, {  10,  10 }, 'label'   , 'Uptime:'                                 }, 
              { { 0  , 1   }, {  10, 200 }, 'variable', SID_TTL    , '', '', 'Uptime'     , '', 2 },

              { { 1  , 0   }, {  60,  10 }, 'label'   , 'Memory'                                  },
              { { 1.5, 0   }, {  80,  10 }, 'label'   , 'Swap'                                    },

              { { 0.5, 1   }, {  40, 200 }, 'label'   , 'total'                                   },
              { { 1  , 1   }, {  60, 200 }, 'variable', SID_TTL    , '', '', 'MemoryTotal', '', 0 },
              { { 1.5, 1   }, {  80, 200 }, 'variable', SID_TTL    , '', '', 'SwapTotal'  , '', 0 },

              { { 0.5, 2   }, {  40, 300 }, 'label'   , 'used'                                    },
              { { 1  , 2   }, {  60, 300 }, 'variable', SID_TTL    , '', '', 'MemoryUsed' , '', 0 },
              { { 1.5, 2   }, {  80, 300 }, 'variable', SID_TTL    , '', '', 'SwapUsed'   , '', 0 },

              { { 0.5, 3   }, {  40, 400 }, 'label'   , 'free'                                    },
              { { 1  , 3   }, {  60, 400 }, 'variable', SID_TTL    , '', '', 'MemoryFree' , '', 0 },
              { { 1.5, 3   }, {  80, 400 }, 'variable', SID_TTL    , '', '', 'SwapFree'   , '', 0 },

              { { 2  , 1   }, { 110, 200 }, 'label'   , '1 min'                                   },
              { { 2  , 2   }, { 110, 300 }, 'label'   , '5 min'                                   },
              { { 2  , 3   }, { 110, 400 }, 'label'   , '15 min'                                  },

              { { 2.5, 0   }, { 130,  10 }, 'label'   , 'Load avg.'                               },
              { { 2.5, 1   }, { 130, 200 }, 'variable', SID_TTL    , '', '', 'Load1Min'   , '', 0 },
              { { 2.5, 2   }, { 130, 300 }, 'variable', SID_TTL    , '', '', 'Load5Min'   , '', 0 },
              { { 2.5, 3   }, { 130, 400 }, 'variable', SID_TTL    , '', '', 'Load15Min'  , '', 0 },

              { { 3, 0     }, { 160,  10 }, 'label'   , 'TTL (s)'                                 },
              { { 3, 1     }, { 160, 200 }, 'variable', SID_TTL    , '', '', 'TTL', '', 0         },

              { { 3, 2.5   }, { 190,  10 }, 'button'  , 'Refresh'  , SID_TTL, 'Refresh', ''       },
            }

Installation:
Set [tt]LeakageRate[/tt] [ KB/s ], [tt]TTLThreshold[/tt] [ s ], [tt]SamplingInterval[/tt] [ s ] and restart [tt]LuaUPnP[/tt].

Limitations:
UI5 only

Download:
[tt]https://docs.google.com/open?id=0Bz4omZm4gYcsYUZTcmt1TGFRNTA[/tt]