It is currently April 19th, 2024, 2:20 am
Get help with creating, editing & fixing problems with skins
Craash
Posts: 27 Joined: October 17th, 2017, 4:37 pm
Post
by Craash » January 14th, 2018, 6:31 pm
After getting RunCommand working with NUT so that I now have a meter for my network UPS, I want to move forward with using it on SNMP.
I'm successfully displaying the data from my pfSense router with:
Plugin=RunCommand
Parameter=SnmpGet -q -r:gw -t:10 -c:"kaacee" -o:.1.3.6.1.2.1.2.2.1.10.3
This value is an overall counter that increases with traffic. What I need to do is read this every x seconds, subtract the current reading from the previous, and then divide by x seconds.
So (CurrentReading - Previous Reading)/ xseconds
I'm having difficulity in what is the correct/best method to store/update the readings. Anyone care to help? For simplicity sake, lets say I want to update every 5 second.
My current skin
Code: Select all
[Rainmeter]
Update=10000
AccurateText=1
SkinWidth=171
SkinHeight=190
BackgroundMode=2
SolidColor=255,0,0,0
OnRefreshAction=[!SnapEdges "0" "#CURRENTCONFIG#"]
[Variables]
@Include1="#@#GeneralVariables.inc"
Rep=2
PreviousIncomingTraffic=0
[MeterAllBackground]
Meter=Shape
Shape=Rectangle 1,1,169,180,12 | Fill Color #BackgroundColor# | StrokeWidth 1 | Stroke Color #LabelColor#
W=170
H=124
UpdateDivider=-1
[MeasureTimer]
Measure=Calc
Formula=( COUNTER % #Rep# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!CommandMeasure "MeasurepfSenseIncomingTraffic" "Run"]
[MeasureBandwidth]
Measure=Calc
Formula=( MeasurepfSenseIncomingTraffic - PreviousIncomingTraffic )
DynamicVariables=1
[MeasurepfSenseIncomingTraffic]
Measure=Plugin
Plugin=RunCommand
!SetVariable PreviousIncomingTraffic=#MeasurepfSenseIncomingTraffic
Parameter=SnmpGet -q -r:gw -t:10 -c:"kaacee" -o:.1.3.6.1.2.1.2.2.1.10.3
OutputType=ANSI
State=Hide
StartInFolder=C:\Program Files\Common Files\mine\SNMP
FinishAction=[!UpdateMeter MeterpfSenseIncomingTraffic][!Redraw]
RegExpSubstitute=1
Substitute="#CRLF#":""
DynamicVariables=1
UpdateDivider=1
[MeterpfSenseIncomingTraffic]
MeasureName=MeasurepfSenseIncomingTraffic
Meter=String
X=15
Y=10
StringAlign=Left
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #LabelColor#
AntiAlias=1
Text=%1
[MeterpfSenseBandwidth]
MeasureName=MeasureBandwidth
Meter=String
X=15
Y=5R
StringAlign=Left
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #LabelColor#
AntiAlias=1
Text=%1
[
Skin with network UPS data:
Last edited by Craash on April 10th, 2018, 5:53 pm, edited 1 time in total.
zxcslo
Posts: 9 Joined: February 23rd, 2016, 6:36 pm
Post
by zxcslo » April 10th, 2018, 4:42 pm
This is what I'm using...
https://snmpsoft.com/shell-tools/snmp-get/
Code: Select all
[Rainmeter]
Update=2000
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,100
....................................................................................................................................................
[Variables]
CurrTime=0
LastTime=0
;PrevRec=0
;CurrRec=0
;PrevSent=0
;CurrSent=0
....................................................................................................................................................
[MeasureTimer]
Measure=Uptime
OnUpdateAction=[!SetVariable LastTime #CurrTime#][!SetVariable CurrTime [MeasureTimer:]][!CommandMeasure MeasureRouterSend Run][!CommandMeasure MeasureRouterRec Run]
UpdateDivider=2
DynamicVariables=1
[MeasureRouterSend]
Measure=Plugin
Plugin=RunCommand
Parameter=SnmpGet -q -r:192.168.123.1 -t:10 -c:"public" -o:.1.3.6.1.2.1.2.2.1.10.5
OutputType=ANSI
State=Hide
StartInFolder=C:\SnmpGet
FinishAction=[!UpdateMeasure "MeasureBytesSent"]
DynamicVariables=1
UpdateDivider=-1
[MeasureRouterRec]
Measure=Plugin
Plugin=RunCommand
Parameter=SnmpGet -q -r:192.168.123.1 -t:10 -c:"public" -o:.1.3.6.1.2.1.2.2.1.16.5
OutputType=ANSI
State=Hide
StartInFolder=C:\SnmpGet
FinishAction=[!UpdateMeasure "MeasureBytesReceived"]
DynamicVariables=1
UpdateDivider=-1
[MeasureTimePassed]
Measure=Calc
Formula=(#CurrTime# - #LastTime#)
DynamicVariables=1
[MeasureBytesReceived]
Measure=String
String=[MeasureRouterRec]
DynamicVariables=1
RegExpSubstitute=1
Substitute="#CRLF#":""
OnUpdateAction=[!SetVariable PrevRec #CurrRec#][!SetVariable CurrRec [MeasureBytesReceived]]
UpdateDivider=-1
[MeasureBytesSent]
Measure=String
String=[MeasureRouterSend]
DynamicVariables=1
RegExpSubstitute=1
Substitute="#CRLF#":""
OnUpdateAction=[!SetVariable PrevSent #CurrSent#][!SetVariable CurrSent [MeasureBytesSent]]
UpdateDivider=-1
[MeasureRouterReceived]
Measure=Calc
Formula=(#CurrRec# - #PrevRec#) / [MeasureTimePassed]
;MaxValue=220000000
DynamicVariables=1
[MeasureRouterSent]
Measure=Calc
Formula=(#CurrSent# - #PrevSent#) / [MeasureTimePassed]
;MaxValue=6000000
DynamicVariables=1
[string]
Meter=STRING
MeasureName=string
X=5
Y=5
StringStyle=bold
StringAlign=left
FontColor=225,225,225,100
FontSize=35
FontFace=comfortaa
AntiAlias=1
Text=Router
[MeterLineSend]
Meter=Line
MeasureName=MeasureRouterSent
MeasureName2=MeasureRouterReceived
X=0
Y=5
W=450
H=50
LineCount=2
LineColor=255,255,0,255
LineColor2=0,255,0,255
AntiAlias=1
AutoScale=1
[MeterSizeRec]
Meter=String
MeasureName=MeasureRouterReceived
X=5
Y=50r
W=150
H=15
FontSize=8
FontColor=0,255,0,255
AutoScale=1
Text=ROUTER IN: %1B
NumOfDecimals=2
[MeterSizeSent]
Meter=String
MeasureName=MeasureRouterSent
X=150r
Y=r
W=150
;H=20
FontSize=8
FontColor=255,255,0,255
AutoScale=1
Text=ROUTER OUT: %1B
NumOfDecimals=2
Craash
Posts: 27 Joined: October 17th, 2017, 4:37 pm
Post
by Craash » April 10th, 2018, 5:34 pm
Wow! Almost 4 months, but the community comes through!
Can't wait to give it a try, could you put up a picture of your gauge?
zxcslo
Posts: 9 Joined: February 23rd, 2016, 6:36 pm
Post
by zxcslo » April 10th, 2018, 5:39 pm
I was looking for over a year to the solution with Rainmeter...
Your post was the right 'inspiration'...
RouterSNMPmeter.PNG
You do not have the required permissions to view the files attached to this post.
Craash
Posts: 27 Joined: October 17th, 2017, 4:37 pm
Post
by Craash » April 10th, 2018, 5:41 pm
Beautiful. Thank you so very much! I was looking for a way to "thumbs up" or "like" or "thanks" the post someway . . .but, I guess we can't do that here.
Craash
Posts: 27 Joined: October 17th, 2017, 4:37 pm
Post
by Craash » April 10th, 2018, 5:45 pm
zxcslo wrote: I was looking for over a year to the solution with Rainmeter...
Your post was the right 'inspiration'...
RouterSNMPmeter.PNG
So I helped too?
I LOVE the network UPS gauge I created. It is ridiculously cool. I figured if I could get SNMP going, I'd be set.
zxcslo
Posts: 9 Joined: February 23rd, 2016, 6:36 pm
Post
by zxcslo » April 10th, 2018, 5:49 pm
I would love to see/try your UPS meter.
Craash
Posts: 27 Joined: October 17th, 2017, 4:37 pm
Post
by Craash » April 10th, 2018, 5:54 pm
zxcslo wrote: I would love to see/try your UPS meter.
Fixed the link, you should see it now. I'm connecting to the UPS via TCP/IP, but USB would work too.
zxcslo
Posts: 9 Joined: February 23rd, 2016, 6:36 pm
Post
by zxcslo » April 10th, 2018, 5:58 pm
Beautiful.
Craash
Posts: 27 Joined: October 17th, 2017, 4:37 pm
Post
by Craash » April 10th, 2018, 6:00 pm
The code for it:
Code: Select all
[Rainmeter]
Update=10000
AccurateText=1
SkinWidth=171
SkinHeight=190
BackgroundMode=2
SolidColor=255,0,0,0
OnRefreshAction=[!SnapEdges "0" "#CURRENTCONFIG#"]
[Variables]
@Include1="#@#GeneralVariables.inc"
Rep=2
[MeterAllBackground]
Meter=Shape
Shape=Rectangle 1,1,169,180,12 | Fill Color #BackgroundColor# | StrokeWidth 1 | Stroke Color #LabelColor#
W=170
H=124
UpdateDivider=-1
[MeasureTimer]
Measure=Calc
Formula=( COUNTER % #Rep# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!CommandMeasure "MeasureUPSLoad" "Run"][!CommandMeasure "MeasureUPSTemp" "Run"][!CommandMeasure "MeasureUPSCharge" "Run"][!CommandMeasure "MeasureUPSAmps" "Run"][!CommandMeasure "MeasureUPSRunTime" "Run"][!CommandMeasure "MeasureUPSModel" "Run"]
[MeasureUPSModel]
Measure=Plugin
Plugin=RunCommand
Parameter=upsc SMT2200RM2U@pfsense device.model
OutputType=ANSI
State=Hide
StartInFolder=C:\Program Files (x86)\NUT\bin
FinishAction=[!UpdateMeter MeterUPSModel][!Redraw]
RegExpSubstitute=1
Substitute="#CRLF#":""
DynamicVariables=1
UpdateDivider=1
[MeasureUPSAmps]
Measure=Plugin
Plugin=RunCommand
Parameter=upsc SMT2200RM2U@pfsense output.current
OutputType=ANSI
State=Hide
StartInFolder=C:\Program Files (x86)\NUT\bin
FinishAction=[!UpdateMeter MeterUPSWatts][!Redraw]
DynamicVariables=1
UpdateDivider=1
[MeasureUPSAmpsBar]
Measure=Calc
Formula=[MeasureUPSAmps]
DynamicVariables=1
MinValue=0
MaxValue=20
[MeasureUPSWattsBar]
Measure=Calc
Formula=(MeasureUPSAmpsBar*120)
DynamicVariables=1
MinValue=0
MaxValue=2400
[MeasureUPSRunTime]
Measure=Plugin
Plugin=RunCommand
Parameter=upsc SMT2200RM2U@pfsense battery.runtime
OutputType=ANSI
State=Hide
StartInFolder=C:\Program Files (x86)\NUT\bin
FinishAction=[!UpdateMeter MeterUPSRunTime][!Redraw]
DynamicVariables=1
UpdateDivider=1
[MeasureUPSRunTimeBar]
Measure=Calc
Formula=([MeasureUPSRunTime]/60)
DynamicVariables=1
MinValue=0
MaxValue=20
[MeasureUPSLoad]
Measure=Plugin
Plugin=RunCommand
Parameter=upsc SMT2200RM2U@pfsense ups.load
OutputType=ANSI
State=Hide
StartInFolder=C:\Program Files (x86)\NUT\bin
FinishAction=[!UpdateMeter MeterUPSLoad][!Redraw]
DynamicVariables=1
UpdateDivider=1
[MeasureUPSLoadBar]
Measure=Calc
Formula=[MeasureUPSLoad]
DynamicVariables=1
MinValue=0
MaxValue=100
[MeasureUPSCharge]
Measure=Plugin
Plugin=RunCommand
Parameter=upsc SMT2200RM2U@pfsense battery.charge
OutputType=ANSI
State=Hide
StartInFolder=C:\Program Files (x86)\NUT\bin
FinishAction=[!UpdateMeter MeterUPSCharge][!Redraw]
DynamicVariables=1
UpdateDivider=1
[MeasureUPSChargeBar]
Measure=Calc
Formula=[MeasureUPSCharge]
DynamicVariables=1
MinValue=0
MaxValue=100
[MeasureUPSTemp]
Measure=Plugin
Plugin=RunCommand
Parameter=upsc SMT2200RM2U@pfsense battery.temperature
OutputType=ANSI
State=Hide
StartInFolder=C:\Program Files (x86)\NUT\bin
FinishAction=[!UpdateMeter MeterUPSTemp][!Redraw]
DynamicVariables=1
UpdateDivider=1
[MeasureUPSTempBar]
Measure=Calc
Formula=(([MeasureUPSTemp]*1.8)+32)
DynamicVariables=1
MinValue=0
MaxValue=150
[MeterUPSModelText]
MeasureName=MeasureUPSModel
Meter=String
X=15
Y=10
StringAlign=Left
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #LabelColor#
AntiAlias=1
Text=%1
[MeterUPSLoadText]
Meter=String
X=15
Y=5R
StringAlign=Left
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #LabelColor#
AntiAlias=1
Text=UPS Load
[MeterUPSLoad]
MeasureName=MeasureUPSLoadBar
Meter=String
X=154
Y=0r
StringAlign=Right
NumOfDecimals=0
;Percentual=1
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #ValueColor#
AntiAlias=1
Text="%1%"
[MeterUPSLoadBar]
Meter=Bar
MeasureName=MeasureUPSLoadBar
BarOrientation=Horizontal
BarImage=#ImagePath#138x2Bar.jpg
SolidColor=#BarBackColor#
X=15
Y=2R
W=127
H=2
[MeterUPSWattsText]
Meter=String
X=15
Y=5r
StringAlign=Left
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #LabelColor#
AntiAlias=1
Text=UPS Watts
[MeterUPSWatts]
MeasureName=MeasureUPSWattsBar
Meter=String
X=154
Y=0r
StringAlign=Right
NumOfDecimals=0
;Percentual=1
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #ValueColor#
AntiAlias=1
Text="%1W"
[MeterUPSAmpsBar]
Meter=Bar
MeasureName=MeasureUPSWattsBar
BarOrientation=Horizontal
BarImage=#ImagePath#138x2Bar.jpg
SolidColor=#BarBackColor#
X=15
Y=2R
W=127
H=2
[MeterUPSTempText]
Meter=String
X=15
Y=5R
StringAlign=Left
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #LabelColor#
AntiAlias=1
Text=UPS Temp
[MeterUPSTemp]
MeasureName=MeasureUPSTempBar
Meter=String
X=154
Y=0r
StringAlign=Right
NumOfDecimals=0
;Percentual=0
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #ValueColor#
AntiAlias=1
Text=%1 #TempUnit#
[MeterUPSTempBar]
Meter=Bar
MeasureName=MeasureUPSTempBar
BarOrientation=Horizontal
BarImage=#ImagePath#138x2Bar.jpg
SolidColor=#BarBackColor#
X=15
Y=2R
W=127
H=2
[MeterUPSChargeText]
Meter=String
X=15
Y=5R
StringAlign=Left
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #LabelColor#
AntiAlias=1
Text=UPS Charge
[MeterUPSCharge]
MeasureName=MeasureUPSChargeBar
Meter=String
X=154
Y=0r
StringAlign=Right
NumOfDecimals=0
Percentual=1
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #ValueColor#
AntiAlias=1
Text="%1%"
[MeterUPSChargeBar]
Meter=Bar
MeasureName=MeasureUPSChargeBar
BarOrientation=Horizontal
BarImage=#ImagePath#138x2BarB.jpg
SolidColor=#BarBackColor#
X=15
Y=2R
W=127
H=2
[MeterUPSRunTimeText]
Meter=String
X=15
Y=5R
StringAlign=Left
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #LabelColor#
AntiAlias=1
Text=RunTime
[MeterUPSRunTime]
MeasureName=MeasureUPSRunTimeBar
Meter=String
X=154
Y=0r
StringAlign=Right
NumOfDecimals=0
;Percentual=1
InlineSetting=Face | #TextFont#
InlineSetting2=Size | 11
InlineSetting3=Color | #ValueColor#
AntiAlias=1
Text="%1m"
[MeterUPSRunTimeBar]
Meter=Bar
MeasureName=MeasureUPSRunTimeBar
BarOrientation=Horizontal
BarImage=#ImagePath#138x2BarB.jpg
SolidColor=#BarBackColor#
X=15
Y=2R
W=127
H=2