SSH Using Mac OSX ..................12 3 Managing MicroPMUs with upmu-adm Adding MicroPMUs with upmu-adm............13 Switching Between Base and Extended Mode ..........14 Removing MicroPMUs and MicroPMU Data ..........15 4 Importing Existing .dat Files Copying Data Files to The Server ..............17 4.1.1 Copy Data Files via SCP ..............................
Page 3
Example Database Restore ................23 6 Deleting Data and Starting Fresh with a New Instance 7 Setting a New Quickstart Server IP Address 8 Routing MicroPMU data to the Quickstart Server 9 Changing the Root User Password 10 Changing MicroPMU Domains for Access Control 11 Add User Accounts/Assign Them “Domain”...
Page 4
17.1.2.2.1 Checking Status ..............................45 17.1.2.2.2 Querying Data ..............................45 17.2 BTrDB Binary API Examples ................. 50 17.2.1 Binary API via Python ..............................50 17.2.2 Binary API via Go ............................... 52 Quickstart Kit – Administration Manual - Revision 15 Power Sensors Ltd. 980 Atlantic Ave, Alameda CA 94501, USA Tel ++1-510-522-4400 Fax ++1-510-522-4455 www.PowerSensorsLtd.com...
Preface Please take the time to read any bodies of text that begin with IMPORTANT: or NOTE: because they will contain either critical information to the task being explained or helpful information that may pertain to a particular situation or aid in troubleshooting. IMPORTANT: It is HIGHLY recommended that the Quickstart Kit (server, MicroPMUs, network switch) is backed up by and uninterruptable power supply (UPS) in the event of a power surge or failure.
II. List of Common Commands and Operations – Stands for “super user do”. Any command prepended with sudo sudo will be executed as the root sudo user. Do not execute a command with unless using a command from the manual that requires it. sudo manager When using...
Page 7
– The command will list the contents of the current working directory if no parameters are passed to the command. Otherwise, will list the contents of any valid file path passed to it. ls ↵ # lists contents of the current working directory ls /var/log ↵...
Page 8
sudo cp –r /ssd/srv /media/external ↵ Restore – If there is an external drive with a copy of the contents of the /ssd/data /ssd/srv /media/external directories, and it is mounted to the directory, a restore can be done with the following commands.
A recommended UPS model is the APC-SMT750. Before getting started with the MicroPMU setup, the Quickstart Server needs to be powered up. To power your server, first make sure it is plugged into a suitable power supply and then press the power button.
Type manager for the user and press the “Enter” key ↵ on the keyboard, then the prompt will display the following. Password: Company*2016! The default Quickstart Server password is: Type the password and press the “Enter” key ↵ on the keyboard. Upon a successful login the prompt will display the following.
2 Quickstart Server Remote Login Using SSH SSH allows logins to a remote computer/server over an encrypted connection. To SSH into the Quickstart Server, either an SSH client for Windows (we recommend PuTTY) is required, or the terminal can be used on a Mac or Linux computer. Finding Your Quickstart Server IP Before attempting to establish an SSH connection to your Quickstart Server, the server IP address must be noted.
This configuration can be saved by typing in a configuration name under “Saved Sessions” and click the save button. From there, just highlight the configuration name and click the load button then click the open button to start a connection. A prompt may ask if host to connect to is trusted.
Note that any name can be used for upmu alias. If the ext parameter is not included, .dat files will default to base mode. To add a MicroPMU in base mode, simply enter the add command without the ext parameter. Example: add 192.168.1.24 P3112233 uPMU1 ↵...
↵ # removes metadata or updates existing plotter metadata A message will print stating that metadata is being removed for the MicroPMU chosen to remove along with processing messages for any other MicroPMUs available. Quickstart Kit – Administration Manual - Revision 15 Power Sensors Ltd.
Page 16
Finally, restart services: sudo supervisorctl restart all ↵ # enter manager password when prompted Note the services will take up to 30 seconds or less to stop and start again. Any “spawn error” messages from this command may be ignored. Quickstart Kit –...
IMPORTANT: The MicroPMU that the .dat files belong to must be added to the plotter instance on the server the data will be imported to. For example, say data files will be imported for a MicroPMU with a serial number of P3001234. If a MicroPMU with this serial number has not been added by using the upmu-adm program, then it will need to be added first.
Before beginning the data import, all of the .dat files to import must be in the same directory. By default the MicroPMU structures its .dat files in a directory tree with its root directory labeled as “upmu_data”. Unless all of the .dat files have already been moved into one directory manually, it would be best to move the .dat files into one directory with the qss-get --data-import command.
Page 19
into the directory. The process is not recursive, so all files must be in the directory. For help, type importdat with no arguments for usage instructions or help to show all commands Example (if data is stored in a “upmu_data_import” folder on the external drive): importdat /media/external/upmu_data_import ↵...
5 Backing Up And Restoring MicroPMU Databases The /ssd/data/ and /ssd/srv/ directories may become quite large, and may be backed up periodically either remotely or by physically backing up the storage drive. Databases can be manually backed up by copying the entire /ssd/data/ and /ssd/srv/ directories to a safe location, but first, please read the tips and instructions below to ensure the backup will be done safely.
Page 21
df –h ↵ The output of this command will show a table of information on the different mount points found on the server. The far right column labeled “Mounted on” shows the path where a filesystem is mounted. Find the row with the mount point of /ssd, which is where the data drive is mounted to.
following command. sudo umount /mnt Example Database Backup The databases can be backed up by copying the contents of /ssd/data/ and /ssd/srv/ to an external drive mounted on the Quickstart Server. IMPORTANT: Remember to stop all services before performing a database backup or restore! sudo supervisorctl stop all ↵...
NOTE: If these files do not exist on the restore drive then this step may be skipped, but keep in mind that the microPMU units will need to be added again through the upmu-adm shell if restoring into a fresh database.
6 Deleting Data and Starting Fresh with a New Instance Take note before deleting database data: IMPORTANT: Remember to copy the entire /ssd/data/ and /ssd/srv/ directories and upmuconfig.ini to a safe location in case you need to restore it to an old state. Refer to Chapter 5 for more information on backing up and restoring data.
7 Setting a New Quickstart Server IP Address Open the network interfaces file for editing with the following command. sudo nano /etc/network/interfaces ↵ # Opens the file in the nano text editor. Alternatively, the vi/vim text editor may be used. Nano is recommend as a more user friendly text editor if it is unclear which one to use.
The default IP Address for the Quickstart Server is 172.16.1.100 If this has been changed, the MicroPMU setup.ini files will need to be updated with the new IP address. Change this variable in the setup.ini file of each MicroPMU that will send data to the Quickstart Server: ;----------------------------------------------------...
9 Changing the Root User Password By default, the username for the MicroPMU Quickstart Server is manager. You are also provided with a default manager/root user password, although it is recommended to change it for increased security. To change it, type: sudo passwd ↵...
10 Changing MicroPMU Domains for Access Control Edit /home/manager/upmuconfig.ini and change the domain of the MicroPMUs to a separate domain (for example from upmu to lbnl). In upmuconfig.ini, find the Path fields for the MicroPMUs to assign to new domain(s). Each Path field for each unit will need to be changed.
Page 29
Two domains should be seen on the Quickstart Server's "Select Streams" when you access its IP address in a browser. The next section explains how to add user accounts and assign domain tags to them. Quickstart Kit – Administration Manual - Revision 15 Power Sensors Ltd.
The tags are the same domain tags that were updated in upmuconfig.ini (in the previous section), so “upmu”, "lbnl" or "psl" for instance. Next, edit tagconfig.json to add the tag that is assigned to the user and remove the access-controlled streams from public domain. Public can be an empty array if no MicroPMUs are to be made public.
Page 31
1. Change the path domains for unit “uPMU_1” to /lbnl (from /upmu) in upmuconfig.ini 2. Run python accounts.py from /home/manager/mr-plotter/tools directory and adduser command. 3. Update tagconfig.json domains to reflect new “domain tags” and remove tags from public domain 4. Run manager2lite.ipy and restart services with sudo supervisorctl restart all. 5.
12 Clear Up Space by Deleting Synchronized Data Delete files that have been synchronized to free up disk space using: ↵ clean_synced ↵ Run this file, which will tell you how many files can be deleted. Type delete to verify data removal. Quickstart Kit –...
13 BTrDB Firewall (Shorewall) Reference This guide covers step-by-step procedures for securing an Ubuntu 16.04 server running BTrDB using Shorewall following the BTrDB Firewall Reference. Shorewall comes installed on PSL Quickstart Server, so installation instructions are for reference. Double check that Shorewall is installed with the following command.
13.3 Rules The default policy (deny all) and zones files are acceptable. It is necessary to modify the rules file to permit traffic to the BTrDB server. Add the following lines to /etc/shorewall/rules # Allow access to the plotter ACCEPT 80,443 # Allow uPMU data ACCEPT...
Page 35
NOTE: If any key service updates were installed in the dist-upgrade step earlier, or a kernel update was installed, it is best to reboot the server so that these take effect. sudo reboot ↵ If there were no key updates, simply start the firewall without rebooting the server with the following command.
Because of this, installations and updates for the Quickstart Server dependencies must be done with a local install or update archive downloaded from the PSL website. Install archive names have a prefix of “qss-install” followed by its version number and the file extension, e.g.
Page 37
working directory if path to qss-update ARCHIVE is not given. -p --packages [archive_path] packages... [-a] Install or update package dependencies for the Quickstart Server. Defaults to present working directory if path to qss-packages ARCHIVE is not given. It is required to pass at least one valid package name from the package list below in a list...
Page 38
Deletes current instance of the Quickstart Server database via confirmation prompt. --data-import [path-to-upmu-data] Prepares .dat files from a MicroPMU for import by moving all .dat files under a ‘upmu-data’ directory into a new ‘upmu-data-import’ directory. Pass the path the the ‘upmu-data- import’...
Required to build the Quickstart Server binaries. mongodb – Mongo database server used to store raw data streaming from the MicroPMU as well as account and permalink data for MR-Plotter. python – programming language needed to run several utility scripts on the Quickstart Server.
will begin. Once the installation is finished, a prompt will appear to press any key to initiate a system reboot in order to finalize the installation. 14.2 Quickstart Server Update The most common use for the qss-get script is to update the Quickstart Server packages and repositories.
15 Using a UPS Backup IMPORTANT: It is HIGHLY recommended that the Quickstart Kit (server, MicroPMUs, network switch) is backed up by and uninterruptable power supply (UPS) in the event of a power surge or failure. This will greatly reduce the likelihood of damage caused to any of the hardware or potential data corruption as a result of a power outage or fluctuation.
The transfer agent may have stopped running due to prolonged server outage. It can be restarted by restarting the MicroPMU. Also make sure the MicroPMUs are sending data to the Quick Start server. Refer to “Routing MicroPMU data to the Quickstart Server” for data routing instructions.
17 Appendices 17.1 BTrDB REST API Examples BTrDB includes a REST api that can be used from any language supporting HTTP. This guide will explain how to do some common operations using curl which is a command line program, usually available by default on MacOSX (unless using a very old version of OSX), but can also be installed on Windows.
sudo chmod +x /path-to-jq-binary ↵ If any permission errors are raised, prepend the commands with sudo and enter the administrator password (password used to log on to the Mac). 17.1.2 Using Curl 17.1.2.1 Windows Install Curl can be installed on Windows by downloading the source from http://curl.haxx.se/download.html. Get either the generic win32 or win64 package depending on whether the Windows OS being used is a 32-bit or 64-bit OS.
Now curl can be run from the Windows command line. Note that variables can be set and accessed in the Windows command line like so. set foo=bar ↵ # set value of “bar” to variable “foo” echo %foo% ↵ # prints value of variable “foo” set “foo=”...
Page 46
set UUID=f0896731-0e43-4ed5-a97f-19266d8e732c ↵ curl –X POST %SERVER%/q/bracket –d “{\”UUIDS”: [\”%UUID%\”]}” | jq ↵ The server will return data in JSON format if it recognizes the request as a valid request. “Brackets”: [ 1477100329040881700, 1477186729034743600 “Merged”: [ 1477100329040881700, 1477186729034743600 The data in brackets is the start and end time of the stream’s current recording period in Unix time (measured in nanoseconds).
Page 47
1 month (26 days) 2,251,799,813,685,248 1 year (208 days) 18,014,398,509,481,984 BTrDB does support exact windowing, although not through the REST API. Point widths are useful because they allow for significantly faster query responses than exact windowing through the binary interface. A statistical query of the example stream will be structured as follows.
Page 48
167360, 95915605781875420, 95915929807604350, 95916253833333300, 1197648 1477110309033, 345024, 95916253833874380, 95918538533067200, 95920823232259970, 8444587 “version”: 2 Since there are only two recordings, this indicates the total recording period for the stream is roughly two days since our point width interval was about one day. Each recording contains the following six fields.
Page 49
Which will return only the sixth field for every reading (in this case, the number of values). Statistical queries can also return results in CSV format. The endpoint for the CSV response accepts JSON parameters rather than URL parameters. Below is an example. SERVER=http://127.0.0.1:9000 ↵...
ETIME=1474326345591810000 ↵ # 9/19/16 4:05:46 PM PARAMS=”starttime=$STIME&endtime=$ETIME&unitoftime=ns” ↵ UUID=f0896731-0e43-4ed5-a97f-19266d8e732c ↵ curl –X GET “$SERVER/data/uuid/$UUID?$PARAMS” > data.json ↵ Note that even for this small time period (~1 hour), the file is quite large (10MB). Take care not to perform raw queries over too much data. Example of file information output via ls command. $ ls –hal data.json $ -rw-rw-r-- 1 userA userA 10M Oct 23 13:05 data.json Windows Example:...
Page 51
>>> import btrdbcapnp ↵ >>> >>> # This is the UUID of the stream we are going to interact with >>> u = uuid.UUID('6390e9df-dfcb-4084-8080-8c719ce751ed') ↵ >>> >>> # Set up the BTrDB Connection and Context >>> connection = btrdbcapnp.BTrDBConnection('localhost', 4410) ↵ >>>...
17.2.2 Binary API via Go NOTE: It is assumed that users of the Go interface to the binary API are familiar with the Go programming language. Otherwise it is recommended to use the REST API instead. The Go interface to the binary API can be installed with the following command. go get github.com/go-btrdb/btrdb ↵...
Page 54
version = <- versionchan For technical assistance or the latest version of this document, please call 1-510-522-4455 or support@powersensorsltd.com email us at: if you have any further questions. Quickstart Kit – Administration Manual - Revision 15 Power Sensors Ltd. 980 Atlantic Ave, Alameda CA 94501, USA Tel ++1-510-522-4400 Fax ++1-510-522-4455 www.PowerSensorsLtd.com...
Need help?
Do you have a question about the MicroPMU and is the answer not in the manual?
Questions and answers