It is currently March 29th, 2024, 8:15 am

RunCommand with SNMP

Get help with creating, editing & fixing problems with skins
Craash
Posts: 27
Joined: October 17th, 2017, 4:37 pm

Re: RunCommand with SNMP

Post by Craash »

@zxcslo thanks for you help! :17good

I have a working meter now!

Image

But, I'd like your input on an issue. I'm trying to pull the router CPU usage and Free RAM.

The parameters I'm using work from the command line: SnmpGet -q -r:gw -t:10 -c:"kaacee" -o:.1.3.6.1.4.1.2021.4.13.0

But, I can't get them to update the meter. There isn't any comparison to previous values, like in the bandwidth. Just displaying what snmpget returns. See anything in my code that is odd?

Note: I am currently only polling RAM, I just have CPU mocked up.

Code: Select all

[Rainmeter]
Update=2000
AccurateText=1
SkinWidth=171
SkinHeight=95
BackgroundMode=2
SolidColor=255,0,0,0
;https://snmpsoft.com/shell-tools/snmp-get/

[MeterBack]
Meter=Shape
Shape=Rectangle 1,1,169,90,12 | Fill Color #BackgroundColor# | StrokeWidth 1 | Stroke Color #LabelColor#
W=171
H=87
UpdateDivider=-1
[Variables]
CurrTime=0
LastTime=0
LabelColor=208,224,247
ValueColor=247,252,255,255
BarBackColor=#LabelColor#,75
BackgroundAlpha=200
BackgroundColor=0,0,0,#BackgroundAlpha#

[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:gw -t:10 -c:"kaacee" -o:.1.3.6.1.2.1.2.2.1.16.3
OutputType=ANSI
State=Hide
StartInFolder=C:\Storage\NextCloud Store\Tech\Documents\Rainmeter\Skins
FinishAction=[!UpdateMeasure "MeasureBytesSent"]
DynamicVariables=1
UpdateDivider=-1

[MeasureRouterRec]
Measure=Plugin
Plugin=RunCommand
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=[!UpdateMeasure "MeasureBytesReceived"]
DynamicVariables=1
UpdateDivider=-1

[MeasureRouterRAM]
Measure=Plugin
Plugin=RunCommand
Parameter=SnmpGet -q -r:gw -t:10 -c:"kaacee" -o:.1.3.6.1.4.1.2021.4.13.0
OutputType=ANSI
State=Hide
StartInFolder=C:\Program Files\Common Files\mine\SNMP
FinishAction=[!UpdateMeasure "MeasureRAM"]
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

[MeasureRAM]
Measure=String
String=[MeasureRAM]
DynamicVariables=1
RegExpSubstitute=1
Substitute="#CRLF#":""
;OnUpdateAction=[!SetVariable PrevSent #CurrSent#][!SetVariable CurrSent [MeasureRouterRAM]]
UpdateDivider=-1

[MeasureRouterReceived]
Measure=Calc
Formula=((#CurrRec# - #PrevRec#) / [MeasureTimePassed]) * 8
;MaxValue=220000000
DynamicVariables=1

[MeasureRouterSent]
Measure=Calc
Formula=((#CurrSent# - #PrevSent#) / [MeasureTimePassed]) * 8
;MaxValue=6000000
DynamicVariables=1

[string]
Meter=STRING
MeasureName=string
X=5
Y=4
StringStyle=bold
StringAlign=left
FontColor=225,225,225,100
FontSize=20
FontFace=comfortaa
AntiAlias=1
Text=pfSense
[MeterRouterRAM]
Meter=String
MeasureName=MeasureRouterRAM
X=105r
Y=4
W=40
;H=20
FontSize=8.5
FontColor=225,225,225,100
AutoScale=1
Text=RAM: %1
NumOfDecimals=1

[MeterRouterCPU]
Meter=String
MeasureName=MeasureRouterRAM
X=0r
Y=12r
W=40
;H=20
FontSize=8.5
FontColor=225,225,225,100
AutoScale=1
Text=CPU: %1
NumOfDecimals=1

[MeterLineSend]
Meter=Line
MeasureName=MeasureRouterSent
MeasureName2=MeasureRouterReceived
X=5
Y=2
W=162
H=75
LineCount=2
LineColor=255,255,0,255
LineColor2=0,255,0,255
AntiAlias=1
AutoScale=1

[MeterSizeRec]
Meter=String
MeasureName=MeasureRouterReceived
X=10
Y=75r
W=40
;H=15
FontSize=8.5
FontColor=0,255,0,255
AutoScale=1
Text=D: %1b/s
NumOfDecimals=1

[MeterSizeSent]
Meter=String
MeasureName=MeasureRouterSent
X=90r
Y=r
W=40
;H=20
FontSize=8.5
FontColor=255,255,0,255
AutoScale=1
Text=U: %1b/s
NumOfDecimals=1
zxcslo
Posts: 9
Joined: February 23rd, 2016, 6:36 pm

Re: RunCommand with SNMP

Post by zxcslo »

In [MeasureRam] replace String=[MeasureRAM] with String=[MeasureRouterRAM].
Craash
Posts: 27
Joined: October 17th, 2017, 4:37 pm

Re: RunCommand with SNMP

Post by Craash »

Done. But no love. I had swapped those around several different times trying to determine if I needed layered measures.

I also changed [MeterRouterRam] measure name to MeasureRAM, after the above change. No go, either.
zxcslo
Posts: 9
Joined: February 23rd, 2016, 6:36 pm

Re: RunCommand with SNMP

Post by zxcslo »

You must also add [!CommandMeasure MeasureRouterRam Run] at the end of the OnUpdateAction in [MeasureTimer].
And in [MeasureRouterRam] you don't need FinishAction=[!UpdateMeasure "MeasureRAM"]. Comment it out. And you don't need [MeasureRAM] also.

If you right-click on the Rainmeter taskbar icon and select About, you will see log with all errors...
Craash
Posts: 27
Joined: October 17th, 2017, 4:37 pm

Re: RunCommand with SNMP

Post by Craash »

Thanks!!!

It was the sill [!CommandMeasure MeasureRouterRam Run] that was killing me. Can't believe I overlooked that AGAIN, seemed every time I added a new measurement to my UPS monitor, I'd forget to update that.


Added a Calc measure to convert to MB (RAM), now just gotta strip off the "K"!
Thanks again for the wonderful help!
zxcslo
Posts: 9
Joined: February 23rd, 2016, 6:36 pm

Re: RunCommand with SNMP

Post by zxcslo »

In [string] set AutoScale=0 and Text=RAM: %1MB
Craash
Posts: 27
Joined: October 17th, 2017, 4:37 pm

Re: RunCommand with SNMP

Post by Craash »

Really good stuff.

Bandwidth meter, and RAM is pretty much finished. Just gotta run down CPU usage now.

Thanks again, you've been great.

Image