Introducing : Remote Sensor Monitor - A RESTful Web Server

FriGiN

New Member
I have the remote viewing server installed with nssm. i can go to the http/port of the server but i can't get hwinfo remote portion of the skin to work
[HWiNFORemoteHost0Name]
Measure=Plugin
Plugin=HWiNFO.dll
HWiNFOHostId=#HWiNFO-RemoteHost0# IDK what to put here the ip/port? https://ip/port etc
HWiNFOSensorId=#HWiNFO-RemoteHost0-System-SensorId#
HWiNFOSensorInstance=#HWiNFO-RemoteHost0-System-SensorInstance#
HWiNFOType=SensorName
RegExpSubstitute=1
Substitute="\[(.*?)\].+$":"--- \1 ---"
UpdateDivider=30
 

FriGiN

New Member
nono the server is 100% working i see it in my browser on the other computer, that line is from the config for the rainmeter skin that you identify that host computer
 

MintyMods

Minty
If you are seeing a working server in your browser then have you tried using that IP and port (i.e. the server and port you are using when seeing in the browser)? I have not used Rainmeter myself yet so probably not the best person to give advice :)
 

ScoRe-Graffix

New Member
1st of all - nice work(!!!), Martin, for HWiNFO and nice work, Ganesh, for the JSON server!

To state the stats of where I am, what I experience and where I want to go:
I'm running a fully watercooled rig w/ W10 Pro (1903) & the latest HWiNFO (incl. Rainmeter/RTSS) - all fine/stable.
My monitoring server, where I wish to 'trap' measurement values is a Zabbix 4 LTS (on deb stretch).
This is all pers./private fun - I also deal w/ a Zabbix SRV on a medium 4c RHEL w/ a generous Maria DB piggy backed (conc. comm > 400/s) in an enterprise environment, handling nearly 13k items and avg 160 processes/s - I know a tiny bit about ZBX - but that's another 'business' ;-)

Noticing that the generic ZBX template for Win monitoring (agentd/poller) is not precise about the CPU load vs the number of cores, but HWiNFO delivering clean and consistent details AND looking into eliminating the poller aspect (the ZBX agentd runs a high queue trying to reach a client host that is naturally turned off when not in use), I was/am looking into creating the measurement values at the point of origin and e.g. using the zabbix_sender.exe to push them into a ZBX Trapper on the server (zabbix_sender also uses JSON internally and is capable of bulk/blob btw).

That is how I came about to experiment w/ Ganesh's Remote Sensor Monitor...
Got it fired up (port def opt is a bit missleading but easily figured out ;-) ) and had JSON data available on the local net via HTTP.
On ZBX I the created a (parent) item using http_agent to grab the JSON as a string and take it from there w/ a child item - starting w/ the CPU load - SWEET, I got a precise graph going in ZBX!

1574760275503.png

Unfortunatelly I stumble into two issues - the first being the biggest caveat:
  1. When I apply a synth. 100% load (Prime95) on all 4 cores / 8 threads ([email protected] stable), within seconds ZBX reports an http 500 - and extending timeouts/delays past 3s does not help (local GB LAN).
    I haven't investigated details, but I assume both priority and instability issues - both, removing the synth. load as well as waiting a period of time, don't help - the JSON SRV needs a restart :-(

  2. Possibly I don't know a damn thing about JSON/ZBX, but I find it hard to have ZBX 'look into' the JSON data provided by the Rem Serv Mon...
    Manually cutting down the origin tree to just one value (using Rem Serv Mon Conf) made it easy to figure out the makings of a child item in ZBX - but 'normalising' the complete tree is s/t I hadn't figured out yet (or ZBX 4 LTS can't do it)...
    ?
Example of the tree as it is and what I presume to be more helpful:
[
{
"SensorApp": "HWiNFO",
"SensorClass": "System",
"SensorName": "Virtual Memory Commited",
"SensorValue": "10431",
"SensorUnit": "MB",
"SensorUpdateTime": 1574756119
},
...

[
"SensorApp": "HWiNFO"
{
"SensorClass": "System"
{
"SensorName": "Virtual Memory Commited",
"SensorValue": "10431",
"SensorUnit": "MB",
"SensorUpdateTime": 1574756119
},
...
}
...


Ganesh/ALL - w/ all do respect - am I thinking in the wrong direction?

My other thought (primary actually) goes into the direction of using the native onboard zabbix_sender.exe - but cherry-picking the few needed 5, 6, 7 values - thus further reducing the overwhelming amount of values available (266 items of "SensorApp": "HWiNFO" !) and therefore furthurly reducing process time/load...
...but how to access individual values from HWiNFO (shared mem access I presume - Martin, I had recently written you an email ;-) ) and scripting a simple BAT or PS1 to address the zabbix_sender.exe or to to have the zabbix_sender.exe run through a list of objects?

However I get it running, I'll be glad to share it!

THX for your ideas, thoughts & insights!
 

MintyMods

Minty
Hi ScoRe-Graffix,

If I understand your question correctly I might be able to help you.
You just need to query HWiNFO stats via http/https running on a Windows machine, Correct?

I am currently implementing a REST server which will allow you to specify which sensor to query etc and return the results in JSON. It's still in early BETA but you can currently use it to query all the HWiNFO stats as JSON without any performance/delay issues

Take a look at my project and see if it helps you in anyway. I could make changes if required or prioritise any functionality you need? Either way if you provide more info I should be able to help you out.

For more info see the dependent projects listed in the following page:-

P.S. The demo uses pre-recorded data with internet latency so is not a true representation of updates (which when running locally are now synced to the HWiNFO internal polling interval)
 
Last edited:

ScoRe-Graffix

New Member
Hi Minty,

that looks quite interesting - & slick!

I have two possibilities to get data from a client host (PC) to my ZBX server (monitoring):
  1. ZBX Poller (mon server) push request -> ZBX agentd (host)
    Generate a JSON server on the PC w/ either all or selected values (would prefer only selected) to be then parsed by an http_agent on the ZBX server.
    Though this is an option, from enterprise environment experience it is NOT the prefered option, as the needed ZBX poller will run into timeouts (thus creating a queue) when the PC is not running.
    Each unanswered poller item generates a queue item - pollers are rather meant for 24/7 servers.

  2. zabbix_sender.exe (host) push -> ZBX Trapper (mon server)
    To feed the 'ZBX Trapper' w/ data I just call the EXE in a batch, followed by server address, hostname, key and value.
    This is pretty straight forward for single values.
    My goal is to do this w/ a list file, which for each value contains a line: <hostname> <key> <value>
    Internally the zabbix_sender.exe communicates a JSON string to the ZBX trapper listening for inbounds and the ZBX server takes care of writing in the values to the items for that host...
    Using the trapper on the ZBX server is more efficient because it will not queue easily and causes only minimal load if no values are sent (e.g. when a sending host is down, like my PC when I'm not using it).
The zabbix_sender.exe allows to use a file (and even a timestamp for each value if it were mission critical).
I would just run a simple for-to-next, to define the values in variables and then make the zabbix_sender.exe run through them...
I know using the zabbix_sender.exe to be more efficient/streamlined already than to write up s/t homebrew (from training and commercial use).

I've recently seen a prod. PowerShell script (simulating the zabbix_sender) being used on commercial Win servers - but I don't know yet how 'stable' this is - I would consider it though (nice on managed servers: have the ps1 registered as a scheduled task by your ITSP and place the config on a file share within the network -> scale or customise as needed w/o having to depend on your ITSP for costly mods).

So basically my need is to get the sensor values...
 

MintyMods

Minty
Hi ScoRe-Graffix,

So my project is basically 3 parts as follows:-

1) HTTP(S) Server - outputs realtime statistics via web sockets to a rendered html page (charts etc). It also has RESTful support so will eventually accept queries for specific sensor info.
2) JNI bridge to HWiNFO wrapper (Minty Sensor Monitor)
3) HWiNFO wrapper (reads the shared memory)

So it sounds like installing my complete server would be overkill as this is pretty much the part you want to run on your remote server. The server side has functionality such as recording history and sending alerts etc. which you don't seem to require.

Prior to using JNI for the monitor part I was simply using console System.IN <--> System.OUT to obtain all the sensor information as a JSON formatted string. You could use this to obtain all the sensor information from the PC and parse this or send as the complete packet. See following example of the JSON output. This would involve running a simple executable with a couple of dependencies (the source code is fully available apart from the HWiNFO part which is private in line with Martin's terms of usage).

You could basically kick off a call via script to obtain the sensor info MintySensorMonitor {'source':'MSM[JSON]HWiNFO','type':'info.mintymods.msm.MsmMonitorRequest','debug':false} and send the output to your zabbix_sender. You could use JQ to modify the JSON object as required to filter out any info you don't want.

Note: this is an old version prior to the JNI support and other functionality such as knowing when HWiiNFO is not running so it currently outputs the following when it cant communicate with HWiNFO

Code:
 ERROR MintyServiceHWiNFO.MsmServiceHWiNFO - System.IO.FileNotFoundException: Unable to find the specified file.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.MemoryMappedFiles.MemoryMappedFile.OpenCore(String mapName, HandleInheritability inheritability, Int32 desiredAccessRights, Boolean createOrOpen)
Which is a bit rubbish but I can update that if needed.

Does this give you what you need?

Minty

P.S. If you (or anyone) do download and test the executable I would be grateful if you could provide me with a sample output to allow me to investigate some features for the front end. e.g. how your hardware is described etc.

P.P.S. Do you know C#? If the full list of sensor results is a problem we could simply FORK the code and adjust to your requirements or implement a specific reponse type for Zabbix if there is such a format?
 
Last edited:
Top