A project that demonstrates how to get environment information from a computing device.
This project has two components, a Dispatcher which gathers environment information and a MockServer to which the Dispatcher sends environment information for subsequent processing.
Be advised that this code needs to run directly on a host machine in order to access temperature data.
sudo npm install -g typescript && npm install -g ts-node
git clone https://github.com/reselbob/environmentsensor.git
cd environmentsensor
npm install
ts-node tests/mockServer.ts
Run the following command in a separate terminal window.
cd environmentsensor
ts-node src/dispatch_runner.ts
The dispatch_runner
can report cpu temperature when running on non-virtual, physical hardware. To configure the dispatch_runner
to report temperature, do the following in the root of the source code working directory:
Step 1: In a terminal window run the following command to open a file named .env
in the nano text editor:
nano .env
Step 2: Add copy and past the following line into the file .env
DEVICE_INFO_TYPE=TEMPERATURE
Step 3: Strike the ctrl+o
keys to save the file's content.
Step 4: Strike the ctrl+x
keys to exit nano.
Step 5: Start the dispatch_runner
to start emitting information about the cpu temperature on the host computer:
ts-node src/dispatch_runner.ts