CumulusUtils

Revision as of 10:17, 26 January 2022 by HansR (talk | contribs)

Introduction

This is the first page of the CumulusUtils Wiki. From here you should be able to find everything you need to know for this tool.

Please be aware of the pre-requisites (see the category).

Output

The output of CumulusUtils consists of mainly of text files (extension: .txt) which are generated on demand. In Cutils idiom modules. These text files can be incorporated in a website the user has or is making. Ultimately when using the website generator feature, CumulusUtils generates a complete website, uploaded to the user domain and extendable through a user defined menu. When using the ChartsCompiler, the user can define his own charts and place the output where he wants just like other modules.

All output of CumulusUtils is written as UTF8 encoded text files.

Installation

  1. CumulusUtils is available in a distribution which can be downloaded from the forum. In the CumulusMX directory the user must create a directory utils (case dependent) and must copy the files of the distribution (including the subdirectories) to that directory.
  2. Then, on the domain for the website, the user needs to make two directories in the webroot: 'lib' and 'css'. In addition the distribution directory CUicons must be copied as a whole - with contents - to the webroot.
  3. Updating CumulusUtils is done by completely overwriting the contents of the installation directory utils as if it were an installation. If you want to save the old installation, make a copy of the utils directory.

When installed you are ready to run. The first run after an install or an update MUST be without Thrifty.

So after installing you have:

The directory structure for utils on the CumulusMX machine is:

 utils			(contents in the distribution)
   |--- bin		(in the distribution (from 4.7.0 and up))
   |--- utilslog	(Created by CumulusUtils)

The directory structure for utils on the Website is:

 WebRoot		(Content uploaded by CumulusUtils)
   |--- lib		(JavaScript libraries, uploaded by CumulusUtils during a run)
   |--- css		(css files, uploaded by CumulusUtils during a run)
   |--- CUicons        (required to be manually copied once)

Updating CumulusUtils

Updating CumulusUtils is done by completely overwriting the contents of the installation directory utils as if it were an installation. If you want to save the old installation, make a copy of the utils directory. The first run after an install or an update MUST be without Thrifty.

Informational files

In the distribution there are some files which are examples or defaults. When used, rename them (and possibly copy manually to the webroot). No automatic copying of these files is done by CumulusUtils.

Beside the libraries the distribution contains:

  1. CUserAbout-example.txt : as an example of the user about file - when used rename to CUserAbout.txt
  2. CUsermenu-example.txt : as an example of the menu structure
  3. CutilsCharts-default-for-use.def : when used rename to CutilsCharts.def
  4. CutilsCharts-examples.def : not intended for direct use, contains some more elaborate examples of the ChartsCompiler possibilities

To avoid confusion it is left to the user to edit and maintain the files for use either on the website or on the CumulusMX machine.

Manually installing without FTP

NOTE: Not using FTP is disadvised. Because CumulusUtils is datadriven it requires the JSON files and the realtime.txt and realtimegauges.txt from CMX. BEsides those, if you are using the UserAskedData feature of CumulusUtils there will be additional JSON files required for the server and without FTP your will need a way to get them there. There is no copy feature like CMX has as CumulusUtils is designed as a website tool and FTP is implicitely assumed present. However, manual handling can be done but is not supported.

All required installation and generated files are present in the utils directory and copied with FTP to the server during a run of CumulusUtils.

If you don't use FTP you will have to copy manually.

Files involved

The list of installation files required and their destination is below. The generated Javascript files are included in the table:

Distribution File Destination Remark
index.html <webroot>
gauges.js <webroot>/lib Despite the same name this file is very different from the one in CMX
language.js <webroot>/lib
HighchartsDefaults.js <webroot>/lib
suncalc.js <webroot>/lib
tween.min.js <webroot>/lib
steelseries.min.js <webroot>/lib
RGraph.rose.js <webroot>/lib
RGraph.common.core.js <webroot>/lib
gauges-ss.css <webroot>/css
Generated File Destination Remark
cumulusutils.js <webroot>/lib
HighchartsLanguage.js <webroot>/lib
*.txt <webroot>
airlinkdataIn2p5.json <webroot>
airlinkdataIn10.json <webroot>
airlinkdataOut2p5.json <webroot>
airlinkdataOut10.json <webroot>
extrasensorsdata.json <webroot>
CUserdataRECENT.json <webroot>
CUserdataDAILY.json <webroot>
CUserdataALL.json <webroot>
Realtime Files Destination Remark
realtime.txt <webroot> Served by CMX [1]
realtimegauges.txt <webroot> Served by CMX [1]
airlinkrealtime.txt <webroot> When the AirLink device is configured [2]
extrasensorsrealtime.txt <webroot> When Extra Sensor devices are configured [2]

[1] : These files may be served by CMX in another directory (just like the CMX JSON data files). In that case the relative location is specified in the inifile parameter CumulusRealTimeLocation.
[2] : these files are generated in the utils directory and need to be configured as Extra Webfiles in CMX with the ticks: Realtime, Process and FTP. Note that the generated file has the webtags and remains local, the processed files contains the values and must be send to the <webroot>.

Running CumulusUtils

CumulusUtils runs on any operating system CumulusMX runs on and it MUST run in the CumulusMX directory (as working directory). Running CumulusUtils is done from the commandline in a command window (under any OS).

CumulusUtils takes one or more commandline parameters (in short: commands) and must be like (square brackets means: optional):

               utils/bin/cumulusutils.exe [command]

If no commands are given the application responds with:

               CumulusUtils : No Arguments nothing to do. Exiting. See Manual.
               CumulusUtils Usage : utils/bin/cumulusutils.exe [args] (args case independent):
                 utils/bin/cumulusutils.exe
                     [ SysInfo ] [ Forecast ] [ StationMap ] [ UserReports ] [ MeteoCam ]
                     [ pwsFWI ][ Top10 ][ Graphs ][ Yadr ][ Records ]
                     [ NOAA ][ DayRecords ][ AirLink ][ UserAskedData ]
                     [ CompileOnly ] [ ExtraSensors ]
                     | [ Thrifty ] All
               OR (in case you use the website generator):
                  utils/bin/cumulusutils.exe [ Thrifty ] Website

All modules mentioned in the command will be described in their own pages here on the wiki and when available will be linked from here.

The commands represent the modules the user is asking for to be generated. The output is generated to the utils directory in the CumulusMX directory. When asking for the generation of the website, the user not only gets all modules available but also an index.html file accompanied with some javascript infrastructure. Everything together then is the website which, when copied to the webroot, is ready for use.

Commands to CumulusUtils - the module names - are case independent but the author prefers Upper Camel Case (or Pascal Case).

Copying to the webroot can also be done automatically through the FTP account of the user, much like CumulusMX itself copies e.g. the realtime.txt or the datafiles to the webroot. The FTP account and domain used are the same as present in the Cumulus.ini configuration.

Considerations with CMX configuration

Please note that CumulusUtils requires live data from CumulusMX to display what you expect. To accomplish that you need to configure CMX as follows:

The things it is looking for are realtime.txt and realtimegauges.txt. Those are sent by CMX to the directory you configure in Settings=>Web/FTP Site.

In Settings=>Web/FTP Settings=>Interval Settings: Tick both options to enable realtime FTP
In Settings=>Web/FTP Settings=>Interval Settings=>Standard File settings: Disable both options (for CumulusUtils, if you have websites which use those, leave it enabled)
In Settings=>Web/FTP Settings=>Interval Settings=>Graph File Settings: Enable all (both Generate and Transfer) except availabledata.json and airquality.json
In Settings=>Web/FTP Settings=>Realtime Settings: Tick all
In Settings=>Web/FTP Settings=>General Settings: Tick only UTF-8 encoding

And if you use the ChartsCompiler (or plan to use, you may be more selective later when understanding what and how):

In Settings=>Web/FTP Settings=>Interval Settings=>Daily Graph File Settings: Enable all options except alldailydegdaydata.json and alltempsum.json
otherwise, disable.

After selecting the required tables you need to select the variables they may contain:

In Settings=>Station Settings=>Graphs=>Data Series Visibility: Tick all

NOTE: You may disable some fields later when you are more acquainted with the system. Disabling tables and field can be especially useful when you are worried about size of transfer and provider limits.

If you start using the ChartsCompiler, you may need the UserAskedData command to CumulusUtils. See the ChartsCompiler.

You may want to read about and understand the CumulusRealTimeLocation

When and why to run

Running CumulusUtils results in output which represents a static view of the data in a table or graphic format for display on your website (it may even create a complete website). The fact that the output is a static view requires the output to be regenerated when new data is available. Rerunning CumulusUtils is also required when you change anything in the configuration and can't wait to see that change reflected on the site. In general: changes in data and configuration require a rerun.

Reruns for changes of data are typically once per day, just after rollover time. In that sense it is like running a new query.

There are some exceptions to the daily rule: Sysinfo and UserAskedData

  1. Sysinfo: a rerun with Sysinfo is required when you wish to update the system information which can be a requirement from every 10 minutes to once per day
  2. UserAskedData: provides data for charts which are otherwise not available. Again this is at a user desired frequency which is recommended to be the FTP frequency defined in Cumulus.ini (parameter UpdateInterval in section [FTP site])

RPi: Using crontab

Automating the run of CumulusUtils on the Raspberry Pi is typically done through crontab. Below is the crontab of the author of CumulusUtils to be used as an example!

 15 1 * * *  cd /home/CumulusMX; utils/bin/cumulusutils.exe thrifty website
 9-59/10 * * * *  cd /home/CumulusMX; utils/bin/cumulusutils.exe sysinfo UserAskedData  09 * * * *   cd /home/CumulusMX; utils/bin/cumulusutils.exe sysinfo UserAskedData
 0 9 * * *    /home/cumubackup.sh > cumubackup.log 2>&1

Windows: Using the scheduler

Additional remarks

  1. CumulusUtils is written in C#, HTML and javascript. All HTML and javascript is embedded in the C# code and generated on execution of CumulusUtils. The cumuluscharts.txt charts library was based on the cumuluscharts.js originally distributed with CumulusMX, probably the version a bit before April 2020 and has been modified since. With the appearance of the ChartsCompiler the name cumuluscharts.txt has been preserved but the technique of creating the charts has been changed.
  2. As CumulusUtils itself runs in the Cumulus directory, the data directory (data) is one level below. CumulusUtils currently uses - a copy of - dayfile.txt, the monthly logfiles and incidentally the alltime.ini file. It also takes information from Cumulus.ini. All output is written to the utils/ subdirectory. All logs are created in the utils/utilslog/ subdirectory. It also uses the AirLink.log and the ExtraLog files in a similar way when the user has such devices.
  3. The output of CumulusUtils consists of UTF8 encoded text files. They can be brought to your website manually through some ftp tool (e.g. WinSCP) or by using the Extra Web Files functionality in the setting of Cumulus (deprecated) or by using the FTP facility.
  4. CumulusUtils can output for many languages. See the specific page on language in CumulusUtils.
  5. Development of CumulusUtils started in 9th of August 2019 with an initial commit of the Top10 written in C. Development changed rapidly to C# with an initial commit of Top10 on November 19 2019 of version 0.7.0. The rest of the history can be read in the release notes.
  6. Users can present themselves on the CumulusUtils usermap. Although optional for modules users, the author sees it as payment for the usage of the tool, so please put yourself on the map. For website users it is automatic and obligatory.
  7. In case of problems there exists Errorlogging.
  8. CumulusUtils is © Hans Rottier and can be used under the Creative Commons Attribution License. At some point the code will be in the public domain under a different license.

NOTE: comments to this series of articles is welcome either by using the Talk feature of the Wiki for that page, direct edit of the article (request an account) or by contacting the author of CumulusUtils HansR on the forum or through PM.