Feature #669

Add cron job to retrieve device state in monitor.

Added by Hammel almost 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:23 Aug 2018
Priority:ImmediateDue date:
Assignee:Hammel% Done:

100%

Category:Monitor
Target version:0.5.0
Severity:03 - Medium

Description

I need a tool that causes imrest to retrieve device state and update it's cache. This requires a cron job or C program that is authorized to make that request. That means the API must only allow local connections (loopback). The API just iterates over registered devices, calls their get state API and the updates their cached data.


Related issues

Related to Sensors - Bug #672: deviceGet() needs to validate request by decoding it Closed 02 Sep 2018

Associated revisions

Revision 92e86f91
Added by Hammel almost 2 years ago

RM #669: Add root crontab to Ironman. This just pokes the monitor to retrieve device status once a minute.

Revision 92e86f91
Added by Hammel almost 2 years ago

RM #669: Add root crontab to Ironman. This just pokes the monitor to retrieve device status once a minute.

History

#1 Updated by Hammel almost 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

/usr/sbin/crond is available in the core platform. However, it is not started at boot time. Also, there is no /var/spool/cron directory (there is no /var/spool, for that matter).

So:
  1. Find or create (likely) an init script for crond
    1. Add it to Ironman's www packaging
  2. Create /var/spool/cron in postinst.sh in core platform.

Then I'm ready to add a cron entry to poll the REST server, eg

0-59 * * * * wget http://127.0.0.1:8165/query/devices

This needs to go into a file for root so the postinst script for the www package will have to check for the root entry. If it's there, check if this entry exists. If it's not there or the entry doesn't exist append/create the entry.

#2 Updated by Hammel almost 2 years ago

  • % Done changed from 10 to 30

Added cron init script to core platform Buildroot skeleton tree and pushed upstream. Tested on hardware and it works fine. The init script takes care of creating the required directories if they aren't there.

#3 Updated by Hammel almost 2 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 30 to 100

I simplified this just to get it done quickly. I created a root crontab file and added it to the packaging. If I ever need to extend this from another package I'll have to be more clever about iwget http://127.0.0.1:8165/query/devicest but for now, this works.

Tested, committed and pushed.

Closing issue. Note that this is just the cron entry. The support for actually doing the state updates is tracked separately.

Also available in: Atom PDF