Skip to content
Carlos Paradis edited this page May 15, 2019 · 6 revisions

How to add Webctrl sensors to frog-uhm project

Modify webctrl-config.toml and value-remap.toml at

/var/local/scrape-util/projects/uhm-frog

Specifically:

  1. Start from webctrl-config.toml and copy and paste the template from the other sensors, modifying webctrl sensor path (i.e. the ABSPATH), and giving it a unique name and the proper unit.
  2. Then go to value-remap.toml and scroll to the bottom where a long list of sensor names is being assigned a purpose id. Here, you have to manually concatenate the building, sensor name you created and unit with the - symbol, as done with the others.

**Obs: The unit used has no impact on adding readings. In the reading table in the database, a unit column will be filled with whatever is typed, be it an existing unit or a new one. The scrape-util cares not to what is typed there. It is just a string and it is not used.

After this is done, you are all set.

Instead of waiting enough time for the cron-job to re-run scrape-utils, you can run it manually, just like the cron.job does:

sudo /usr/local/bin/scrape-util > scrape_util_error_log.txt

Note the output file is optional. Without it, a long output will appear on the console, which is hard to search.

Also, you will need sudo permissions (due to bad design) to execute the code. You can also check what is currently being executed, including the command above by typing the following:

vim /etc/crontab

Once this is done, the sensor ids that were added to value-remap.toml should be added to:

/var/local/scrape-util/projects/uhm-frog/state-files/webctrl.toml

With a default timestamp, dating to around 2017. This timestamp seems to originate from the file:

/var/local/scrape-util/projects/uhm-frog/webctrl.toml

For sensors being added to webctrl.

On the field at the top:

[settings]
init-time = 1495497600

Beware this timestamp of 2017 may end up not adding the data to scrape-utils (reason unknown). If that is the case, manually edit the:

/var/local/scrape-util/projects/uhm-frog/state-files

state file (e.g. webctrl.toml) on the sensor that has been added (should have the same name as value-remap.toml), and replace the unix timestamp for something closer, but before, the first reading timestamp of the sensor (e.g. the day before).

Doing so has solved the issue of no data being added.

Finally, check the reading table for the purpose ids you added, they should be there. No resets in the server are necessary.

If you are wondering what the other block of purpose ids are, they are likely some within logic of scrape-utils to perform average operations, etc from a collection of sensors. No one knows how to edit that, so please do not modify.

Lastly, note that the webctrl-config.toml is NOT versioned. This is because it unfortunately also includes the username and password of the API, which should NOT be versioned. Because of that, we gave up versioning the value-remap.toml, to avoid inconsistency of the files and confusion.

Clone this wiki locally