DEV Community

Nor
Nor

Posted on

monitor network, CPU, RAM, disk with persistent overlay using Rainmeter.

demo

demo

Note: You may need to install plugins and read the api docs. (I forgot how)

Note:
The disk read write speed is measured in different methods, so it wont be same as the TaskManager.
The disk read write speed is measured using the same method as PerformanceMonitor (perfmon.exe) (as the docs claim).

code

[Rainmeter]
Update=2500
AccurateText=1
; DynamicWindowSize=1
; SkinWidth=360
BackgroundMode=2
SolidColor=100,100,100,125
; ImageName=#@#Background.png

[Metadata]
; Contains basic information of the skin.
Name=usagemonitor
Author=unknown
Information=Displays basic system stats.
Version=1.0.0

[Variables]
Browser=chrome
RightStyleWidth=120r
ContainerWidth=120
ContainerHeight=40
ContainerPosY=2
ContainerPosX=4R
SmallContainerWidth=50
FontColor_MeterNetworkInValues=106,153,85

; [MeterBackground]
; Meter=Shape
; Shape=Rectangle 0,0,200,200,5
; FillColor=200,200,200,150  ; Gray color with semi-transparency

; ####################

; UsageMonitor plugin - Rainmeter Documentation
; https://docs.rainmeter.net/manual/plugins/usagemonitor/
[MeasureCPU]
Measure=Plugin
Plugin=UsageMonitor
Alias=CPU
Index=0

; CPU measure - Rainmeter Documentation
; https://docs.rainmeter.net/manual/measures/cpu/
; |>"
; First, Rainmeter's CPU measure and the UsageMonitor plugin with the CPU alias, 
; both pull the CPU usage from a source that uses a timed-based performance counter. 
; If you look are PerfMon, 
; this is the Processor > % Processor Time counter. 
; HWiNFO and Windows 7's task manager also used this as well.\
; \
; In Windows 8, Microsoft changed the way they measure "usage", because time-based monitoring doesn't mean as much when CPU's are automatically overclocking and underclocking. 
; For example, if a CPU is running overclocked at 100%, it is doing WAY more work than if it was running 100% at the base clock speed. 
; The time-based counters both report 100% in each mode, so Microsoft made a change.\
; \
; In Windows 8 and later, a new performance counter was added, 
; Processor Information > % Processor Utility. 
; This counter better works with dynamically clocked cores to report the amount of work being done. 
; Task Manager uses this new performance counter for "usage". 
; In this case overclocked cores report 100+% performance, while underclocked cores will never get to 100% even if they are fully occupied.
; <|
; https://forum.rainmeter.net/viewtopic.php?t=38126
; [MeasureCPU]
; Measure=CPU

[NetworkIn]
Measure=Plugin
Plugin=UsageMonitor
Category=Network Adapter
Counter=Bytes Received/sec
Index=1

; [NetworkInScaled]
; Measure=Calc
; Formula=NetworkIn
; ; IfAboveValue=0
; ; IfAboveAction=[!SetOption MeterNetworkName Text "[NetworkIn]"][!UpdateMeter *][!Redraw]
; ; 1024 = 1KB, 1048576 = 1MB, 409600 = 400KB
; IfAboveValue=409600
; IfAboveAction=[!SetOption MeterNetworkInValues FontColor "255,0,0"][!UpdateMeter *][!Redraw]
; IfBelowValue=409600
; IfBelowAction=[!SetOption MeterNetworkInValues FontColor #FontColor_MeterNetworkInValues#][!UpdateMeter *][!Redraw]

; [Solved] Multiple IfAboveActions/IfBelowActions - Rainmeter Forums
; https://forum.rainmeter.net/viewtopic.php?t=8599
; Formula=NetworkIn > 400 * 1024 ? "255,0,0" : (NetworkIn > 20 * 1024 ? "255,255,0" : #FontColor_MeterNetworkInValues#)

[NetworkInScaled]
Measure=Calc
Formula=NetworkIn
IfCondition=(NetworkIn < 20 * 1024)
IfTrueAction=[!SetOption MeterNetworkInValues FontColor #FontColor_MeterNetworkInValues#]
IfCondition2=((NetworkIn >= 20 * 1024) && (NetworkIn < 400 * 1024))
IfTrueAction2=[!SetOption MeterNetworkInValues FontColor "255,255,0"]
IfCondition3=((NetworkIn >= 400 * 1024) && (NetworkIn < 1000 * 1024))
IfTrueAction3=[!SetOption MeterNetworkInValues FontColor "255,165,0"]
IfCondition4=((NetworkIn >= 1000 * 1024) && (NetworkIn < 3000 * 1024))
IfTrueAction4=[!SetOption MeterNetworkInValues FontColor "255,0,0"]
IfCondition5=(NetworkIn >= 3000 * 1024)
IfTrueAction5=[!SetOption MeterNetworkInValues FontColor "180,0,180"]
; 1. evaluate all, not else; ... 1. no need false, though trigger is weird... 
OnUpdateAction=[!UpdateMeter MeterNetworkInValues][!Redraw]


[NetworkOut]
Measure=Plugin
Plugin=UsageMonitor
Category=Network Adapter
Counter=Bytes Sent/sec
Index=1

[NetworkOutScaled]
Measure=Calc
Formula=NetworkOut
; IfAboveValue=0
; IfAboveAction=[!SetOption MeterNetworkName Text "[NetworkOut]"][!UpdateMeter *][!Redraw]

; #################### Meters

[AllStyle]
; @config fontSize
FontSize=8
FontWeight=400
FontColor=255,255,255,255
FontFace=Consolas
; Padding=10,10,10,10
AntiAlias=1
DynamicVariables=1

[RightStyle]
; @config width
; X=120
; X=120r
X=#RightStyleWidth#
StringAlign=Right

[MeterCpuRamContainer]
Meter=Shape
; Shape=Rectangle 0,0,#ContainerWidth#,#ContainerHeight#
Shape=Rectangle 0,0,#SmallContainerWidth#,#ContainerHeight#
Y=#ContainerPosY#
X=#ContainerPosX#

[MeterCPULabel]
Meter=String
MeterStyle=AllStyle
Text=cpu
Container=MeterCpuRamContainer

[MeterCPUValues]
Meter=String
MeterStyle=AllStyle | RightStyle
X=#SmallContainerWidth#r
; X=#ContainerWidth#r
; Text=[MeasureCPU] : [MeasureCPU:1]%
Text=[MeasureCPU:1]%
Container=MeterCpuRamContainer

; ######## vvv

; [measureCPU2]
; ; This measure returns the average CPU load between all cores.
; Measure=CPU
; Processor=0
;
; [meterLabelCPU2]
; Meter=String
; MeterStyle=AllStyle
; Y=0R
; Text=cpu
;
; [meterValueCPU2]
; Meter=String
; MeterStyle=AllStyle | RightStyle
; MeasureName=measureCPU2
; Y=0r
; Text=%1%
; Percentual=1


[measureRAM]
; Returns the amount of RAM used in bytes.
Measure=PhysicalMemory
UpdateDivider=10
; UpdateDivider=20
; UpdateDivider sets the rate at which the value of the measure is updated. It is
; calculated as follows: UpdateDivider x Update. In this case, Update is set to
; 1000 milliseconds (in the [Rainmeter] section). 1000 x 20 = 20000 ms or 20 seconds.

[meterLabelRAM]
Meter=String
MeterStyle=AllStyle
Y=0R
Text=ram
Container=MeterCpuRamContainer

[meterValueRAM]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=measureRAM
Y=0r
X=#SmallContainerWidth#r
Text=%1%
Percentual=1
; Percentual=1 needs to be added her because measureRAM returns the amount
; of RAM used in bytes. Using Percentual=1 will convert that into a percentual value.
Container=MeterCpuRamContainer

; ######## ^^^

[MeterNetworkContainer]
Meter=Shape
Shape=Rectangle 0,0,#ContainerWidth#,#ContainerHeight#
Y=#ContainerPosY#
X=#ContainerPosX#

[MeterNetworkInLabel]
Meter=String
MeterStyle=AllStyle
Y=0R
Text=net in
Container=MeterNetworkContainer

[MeterNetworkInValues]
Meter=String
MeterStyle=AllStyle | RightStyle
FontColor=#FontColor_MeterNetworkInValues#
;x IfCondition=20 > 10
;x IfTrueAction=[!SetVariable "FontColor_MeterNetworkInValues" "255,0,0"]
;x IfTrueAction=[!SetOption "FontColor" "255,0,0"]
;x IfTrueAction=[!SetOption MeterNetworkInValues FontColor 255,0,0][!Redraw]
MeasureName=NetworkInScaled
AutoScale=1
NumOfDecimals=1
Y=0r
Text=%1B/s
Container=MeterNetworkContainer

[MeterNetworkOutLabel]
Meter=String
MeterStyle=AllStyle
Y=0R
Text=net out
Container=MeterNetworkContainer

[MeterNetworkOutValues]
Meter=String
MeterStyle=AllStyle | RightStyle
MeasureName=NetworkOutScaled
Y=0r
AutoScale=1
NumOfDecimals=1
Text=%1B/s
Container=MeterNetworkContainer


; ########

; [msCpu]
; Measure=Plugin
; Plugin=UsageMonitor
; Category=Process
; Counter=% Processor Time
; 
; [txCpu]
; Meter=String
; MeterStyle=AllStyle | RightStyle
; Y=0R
; Text=[msCpu]-msCpu : [msCpu:2]
; 
; [msRam]
; Measure=Plugin
; Plugin=UsageMonitor
; Category=Memory
; Counter=% Committed Bytes In Use
; 
; [txRam]
; Meter=String
; MeterStyle=AllStyle | RightStyle
; Y=0R
; Text=[msRam]-msRam : [msRam:2]

; |>"
; In fact, the very first thing Rainmeter will do is strip them off and throw them away. 
; <|
; https://forum.rainmeter.net/viewtopic.php?t=27870

[MeterDiskContainer]
Meter=Shape
Shape=Rectangle 0,0,#ContainerWidth#,#ContainerHeight#
Y=#ContainerPosY#
X=#ContainerPosX#

[msDiskTime]
Measure=Plugin
Plugin=UsageMonitor
Category=LogicalDisk
Counter=% Disk Time
Name=_Total
; Name=C:

[labelDiskTime]
Meter=String
MeterStyle=AllStyle
Y=0R
Text=disk time
Container=MeterDiskContainer

[txDiskTime]
Meter=String
MeterStyle=AllStyle | RightStyle
Y=0r
; Text=[msDiskTime]-msDiskTime : [msDiskTime:2]
Text=[msDiskTime:1]%
Container=MeterDiskContainer

; [msDiskPhysicalTime]
; Measure=Plugin
; Plugin=UsageMonitor
; Category=PhysicalDisk
; Counter=% Disk Time
; Name=_Total
; 
; [labelDiskPhysicalTime]
; Meter=String
; MeterStyle=AllStyle
; Y=0R
; Text=disk time
; 
; [txDiskPhysicalTime]
; Meter=String
; MeterStyle=AllStyle | RightStyle
; Y=0r
; ; Text=[msDiskPhysicalTime]-msDiskPhysicalTime : [msDiskPhysicalTime:2]%
; Text=[msDiskPhysicalTime:2]%

[msDiskRead]
Measure=Plugin
Plugin=UsageMonitor
; Category=PhysicalDisk
Category=LogicalDisk
Counter=Disk Read Bytes/sec
Name=_Total
; Name=0 C:

[msDiskReadVal]
Measure=Calc
Formula=msDiskRead

[labelDiskRead]
Meter=String
MeterStyle=AllStyle
Y=0R
Text=disk read
Container=MeterDiskContainer

[txDiskRead]
Meter=String
MeterStyle=AllStyle | RightStyle
Y=0r
; Text=[msDiskRead]-msDiskRead : [msDiskRead:2]
MeasureName=msDiskRead
MeasureName2=msDiskReadVal
AutoScale=1
NumOfDecimals=1
DynamicVariables=1
Text=%2B/s
Container=MeterDiskContainer

[msDiskWrite]
Measure=Plugin
Plugin=UsageMonitor
; Category=PhysicalDisk
Category=LogicalDisk
Counter=Disk Write Bytes/sec
Name=_Total
; Name=0 C:

[msDiskWriteVal]
Measure=Calc
Formula=msDiskWrite

[labelDiskWrite]
Meter=String
MeterStyle=AllStyle
Y=0R
Text=disk write
Container=MeterDiskContainer

[txDiskWrite]
Meter=String
MeterStyle=AllStyle | RightStyle
Y=0r
; Text=[msDiskWrite]-msDiskWrite : [msDiskWrite:2]
MeasureName=msDiskWrite
MeasureName2=msDiskWriteVal
AutoScale=1
NumOfDecimals=1
DynamicVariables=1
Text=%2B/s
Container=MeterDiskContainer

; [msNetworkIn]
; Measure=Plugin
; Plugin=UsageMonitor
; Category=Network
; Counter=Bytes Received/sec
; Name=Killer[R] Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter [201NGW]
; 
; [txNetworkIn]
; Meter=String
; MeterStyle=AllStyle | RightStyle
; Y=0R
; Text=wifi-msNetworkIn : [msNetworkIn:2]
; 
; [msNetworkOut]
; Measure=Plugin
; Plugin=UsageMonitor
; Category=Network
; Counter=Bytes Sent/sec
; Name=Killer[R] Wi-Fi 6 AX1650i 160MHz Wireless Network Adapter [201NGW]
; 
; [txNetworkOut]
; Meter=String
; MeterStyle=AllStyle | RightStyle
; Y=0R
; Text=wifi-msNetworkOut : [msNetworkOut:2]


; String meter - Rainmeter Documentation
; https://docs.rainmeter.net/manual/meters/string/
; //where i put the other comments for the old intro skin trials ?
; |>"
; [Rainmeter]
; Update=1000
; 
; [MeterString]
; Meter=String
; Text=Hello, world!
; <|
; https://docs.rainmeter.net/manual/getting-started/creating-skins/
; |>"
; [Variables]
; ; Variables declared here can be used later on between two # characters (e.g. #MyVariable#).
; fontName=Trebuchet MS
; textSize=8
; colorBar=235,170,0,255
; colorText=255,255,255,205
; <|
; https://docs.rainmeter.net/manual/getting-started/customizing/

Enter fullscreen mode Exit fullscreen mode

Top comments (0)