Host_Monitor/CPU_Monitor System
Castle Engineering Services, LLC
Page has been viewed : times

This code is licensed under GPL3

GPL3 Logo
Revision History - Last Rev: 08 Dec 2009

Program(s) and Purpose
This software package is designed to enable monitoring of remote headless machines. Running Boinc on numerous machines,
I have found that it is a pain to check the status and health of the remotes. With this system a small task (CPU_Monitor) runs on
each of the remotes, reads system status data from SpeedFan, and transmits it's status and health data via UPD to the monitoring
master (HostMonitor). Note from my tests the CPU_Monitor task uses about 50 mSec of CPU time once every 10 seconds
(gets data, sends it, goes back to sleep). The system has been tested on Windows 7 Pro X64, Windows XP Pro, and Centos
Linux x86_64- it should work on others, but ?

Quick Links: Screen Shots , Quick Install, Credits, Sensor Notes, Buid From Source

Downloads:
Project Source Code (HostMonitor and CPU_Monitor)

Link to SpeedFan Website

Host Monitor Install- Windows
CPU Monitor Install- Windows
CPU_Monitor Install- Linux x86_64

Note: Installer files are compressed with 7-Zip to avoid FireWall/AntiVirus hassles. It is released under the GNU LGPL license,
and may be obtained here: 7-Zip.org.

ScreenShots:

The Main Screen of the Host Monitor looks like this:
HostMonitor-Main

The items in red indicate things that are "not right", ie machines not doing anything, temps out of wack, etc.
Items in yellow indicate things that need to be watched (border-line).

You may look a a realtime plot of the data by clicking on a colunm:
HostMonitor-RT Plot

If you wish, you can toggle the display to include system voltages (on systems that have HW sensors on the motherboards):
HostMonitor-Volts

You may also plot historical data for each machine:
HostMonitor-History

I found that it was hard to tell when a machine had been off-line, so I added a Scatter Plot option, which shows when there was no data:
HostMonitor-History.SP

V 1.2 Changes- If you let the mouse "hover" over a cell in the grid, a ToolTip will pop up describing the data in that cell.
Notes on this pic:
1) ToolTip shown for CES-P4D, Temp 2 HW (Hard Drive 0 temp).
2) CES-PH9950 is off-line and has "timed-out". (Dead motherboard).
3) The Virtual Machines (Running under VMWare Fusion) on the Mac Pro return only CPU Loads (Cannot read HW).
4) The AMD machines (4200,5000,5600,6000) return only 1 Core Temp (Average of the Cores).
5) Software for the Linux machines (9500, 9600, 9600B) is partially broken. I am just returning CPU Loads right now. I need to add the code
to parse /etc/sensors.conf to read the tag names and scaling data for the HW sensors.
6) The Dell laptop (CES-Mobile) has no HW sensors. I just returns CPU Load, Temp 1 (HD 0 Temp) and Temp 2 (ACPI Temp).
ToolTip

V 1.3 Changes- Add option to display CPU and O/S info if desired.
CPUData

When the Cpu_Monitor program starts on a Windows machine, it minimizes and goes to a monitor icon in the SysTray.
Hovering over the icon will diplay the restore msg. Double-click on the icon to restore the window.
CPU_Monitor-Min

When you minimize the Host Monitor program it too goes to an icon.
Hovering over the icon will diplay the # of hosts being monitored.:
HostMonitor-Min

If you right-click on the icon, it will give you the menu options:
HostMonitor-Menu



Credits and Kudos:
A) Plotting: ZedGraph (Open Source): ZedGraph- A flexible charting library for .NET
B) Loads and Temps, Windows: SpeedFan- A program that monitors voltages, fan speeds and temperatures
C) Temps, and Voltages, Linux: Lm_sensors - Linux hardware monitoring
D) Inno Installer, create install packages: Inno Setup- free installer for Windows programs
E) CPU_Monitor, Mimimize to tray code (public domain): Copyright 2000 Matthew Ellis
F) Plus many more people that posted the pages I found on the web while scratching my head and saying "now how do I do this?".



Notes on Sensors and setups

1) SpeedFan (Windows)
A) Install onto C drive.
B) Start manually the first time.
C) Click on the Config button.
D) Select Temp, Fans, and Voltages you want to display. Note that not all motherboard/sensor combinations return proper values.
E) In the Options tab, select 'start minimized' and 'Minimize on close'.
F) This will produce a sensor config file that CPU_Monitor uses to select which sensors to read and transmit.

2) LM_Sensors (Linux)
A) Install lm-sensors (it comes pre-installed in most distribustions).
B) Run 'sensors-detect' if you have not already.
C) Run 'sensors -s' to set the sensors in use. Note which sensor devices are used.
D) Edit /etc/sensors3.conf (or /etc/sensors.conf for older versions).
E) Search for the def section for the sensor noted in step (C).
F) Verify compute statements are in the following format, if not correct them (I search for and parse only these 2 formats) :
// Compute statements generally come in 1 of 2 formats
// Positive EQ:
// ((6.8/10)+1)*@ , @/((6.8/10)+1)
// or Negative EQ:
// -(28/10)*@, @/(-28/10)
Note 1 : Doc: temperature-sensors and Sensors.Conf
Note 2 : When editing conf file, do not use tabs. C code's 'fgets' does not like them??
G) If you made changes, rerun 'sensors -s'
H) Run 'sensors' and see if the readings make sense. Some motherboard/sensor combinations may require more work to get
the correct readings.



Quick install

1) Install Sensor programs as above on all machines (including your "Master").
2) Install CPU_Monitor on on all machines (including your "Master").
* For Linux, set the daemon to start a whatever run level you are using.
* For Windows, copy the batch file (CPU_Monitor-Start.bat) installed on the desktop into your
User/Documents and Setting/Programs/Startup directory.
3) Install HostMonitor on your master machine. It will wait for and display any incoming data from your remote
hosts and also keep a 1 minute weighted average of the values which will be stored to disk.
4) If you wish to keep logging data for Historical Plots, simply minimize HostMonitor instead of quitting when
you are done with the current session.


 
Care and Feeding of CPU_Monitor & Host_Monitor (Long version, including building)

1) General : (All software is in HostMonitor/ HostMonitor.sln opens all 3 projects)

A) CPU_Monitor/ Runs in background and scans sensors, then sends data via UDP to the HostMonitor.
a) LinObj/ Temp files for Linux build.
b) LinRelease/ Files to create Linux release package.
c) WinDB/ Windoze junk.
d) WinObj/ Temp files for Windows build.
e) WinRelease/ Files to create Windows release package.
f) / Source files, etc.

B) Host_Monitor.Net/ Collect data from CPU_Monitors and displays it.
a) bin/ Windoze junk.
b) My Project/ More Windoze junk.
c) obj/ Temp files for Windows build.
d) Release/ Files to create Windows release package.

C) Images/ Images and Icons used by projects.

D) InstallFiles/Inno installer config files and <program>-Setup.exe files.
a) CPU_Monitor-Setup.exe (Install CPU_Monitor)
b) HostMonitor-Setup.exe (Install Host_Monitor)
c) CPU_Monitor.iss (CPU_Monitor installer config file)
d) HostMonitor.iss (Host_Monitor installer config file)
e) CPU_Monitor-x86_64.tar (CPU_Monitor for Linux, see install notes)

E) Support/
a) isetup-5.3.6.exe Inno Installer (MUCH nicer to use than Micro$oft's).

F) UDP_Scanner/ UDP_Scanner.Net.dll files
a) Temp/ Temp files for Windows build.
* Note the output of this compile/link goes to the Host_Monitor/Release directory where it is needed.

2) CPU_Monitor :
A) Compiled as x86 code for Windows, x86_64 for Linux
(I don't have a 32 bit Linux machine up right now).
B) WinRelease has additional files:
CPU_Monitor.conf
Do not lose these files!
C) CPU_Monitor.conf defines who/what.
Line 1= IP or HostName of recieving machine.
Line 2= Scantime (default of 10 seconds).
Line 3= Debug Flag: 0= none, 1 = a lot, 2= a lot lot lot.
D) CPU_Monitor.conf will be installed in C:\Program Files\* with the executables.
The user will have to edit the IP or HostName to the desired address.
E) LinRelease has additional files:
Support/ CPU_Monitor.conf (see notes above)
Support/lm_sensors.ini (defines sensors we understand)
cpu_monitor (executable)
cpu_monitorD (shell file to start daemon)
install.sh (install script)
readme.txt (explains locations used by Linux files)

3) UDP_Scanner :
A) Compiled as x86 dll for Windows.
B) Output to Host_Monitor/Release directory.
C) Entry Points:
a) Init_UDP(int DebugOn)
b) GetHostName(char *HostName)
c) GetHostIP(char *HostName, char *HostIP)
d) Connect_UDP(char *hostIP)
e) Read_UDP(char *UDP_Data)
f) Release_UDP(void)
g) Convert_UTC_Time( __time32_t UTC_Time, int UTC_mSec, char *vb_Date, char *vb_Time)
h) UDP_Scanner_Version(char *resp)
* Note: GetHostName & GetHostIP are here because System.DNS.<whatever> from VB.Net breaks
WinXP and Win2K machines (program crashes).

4) Host_Monitor.Net :
A) Compiled as x86 dll for Windows.
B) External: UDP_Scanner.Net.dll (see above).
C) External: ZedGraph.dll

5) Setup & Compile :
A) UnZip to some directory (should not care where, unlike somebody else's stuff).
B) Install Inno on dev. system: /Support/isetup-5.3.6.exe
C) Open HostMonitor.sln
D) Build All.

6) Create Install Files:
A) Go to /InstallFiles
B) Double click on CPU_Monitor.iss
C) Edit as needed. (Check the Inno Installer site- it only takes a few minutes to get the hang of it).
D) Click Build, the Compile. This will produce CPU_Monitor-Setup.exe
E) Double click on HostMonitor.iss
F) Edit as needed.
G) Click Build, the Compile. This will produce HostMonitor-Setup.exe

7) Install on machines
A) CPU_Monitor : Windows
a) Install SpeedFan on the remote machine. Start it and click on "Config". This will produce the tag file I need.
a) Copy CPU_Monitor-Setup.exe to remote machine
b) Execute it.
c) Edit /Program Files/CPU_Monitor.conf to point to the machine you want to send the
data to.
d) Move CPU_Monitor-Start.bat from the desktop to User/Documents and Setting/Programs/Startup
folder (auto-start on boot: Start SpeedFan, wait 15 seconds, then start CPU_Monitor).
B) CPU_Monitor : Linux
a) Copy CPU_Monitor-x86_64.tar to remote machine
b) untar- 'tar -xvf CPU_Monitor-x86_64.tar'
b) cd to newly created directory and execute install.sh.
c) Edit /etc/CPU_Monitor/CPU_Monitor.conf to point to the machine you want to send the
data to.
d) Set service cpu_monitorD to auto-start on boot.
C) Host_Monitor
a) Copy HostMonitor-Setup.exe to machine you want to use as master.
b) Execute it and watch the data flow in (I Hope!).

8) ToDo :

A) Cut and paste it into Boinc.Net.