Page 2 of 2

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 5:17 pm
by Craash
Ok, taking the min/max out, is odd.

Remember, with the min/max in there, the first pixel in the bar graph flashes on and off.

With the min/max removed, the bar flashes FULL on and off. To clarify, the bar graph flashes what would be 100%, then 0%, Then 100%.


I'm going to try the calcs, now.

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 5:20 pm
by balala
Craash wrote:I'm going to try the calcs, now.
Try them and let me know if it works.

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 5:23 pm
by Craash
Calc's fixed. it.

Anyway to incorporate that knowledge into my original meter, or am I just going to need to setup a 2nd meter (calc) for each item?

Thank you very much!

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 5:36 pm
by balala
Craash wrote:Anyway to incorporate that knowledge into my original meter, or am I just going to need to setup a 2nd meter (calc) for each item?
As I said, use the new Calc measures name into the MeasureName options of Bar meters.
However, be careful, because Calc meters don't exist, just measures exist.
I'm glad if you got it working well.

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 6:47 pm
by Craash
Thank you all for all your help!

The end results: Image

The cfg:

Code: Select all

[Rainmeter]
Update=1000
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#138x2Bar.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#138x2Bar.jpg
SolidColor=#BarBackColor#
X=15
Y=2R
W=127
H=2

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 7:25 pm
by balala
Glad to help.
I suppose this code works well now, right?
Just as I side note, although this is not a huge mistake, seems a good habit to leave an empty line between the consecutive sections of the code. Not a problem if you don't, the skin works well even so, but for the users (at least for me definitely) is much simpler to look through the code if those lines are there.
Again, this is just my opinion though...

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 7:30 pm
by Craash
It works as well as I hoped it would. This process gives me TONS of ideas for other network monitoring.

Yea, those spaces look bad posted here, not near as obvious in my editor that does syntax highlighting.

Thanks once again.

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 7:36 pm
by balala
Craash wrote:Is there a different bar meter that doesn't go from green to red? Specifically for the UPS charge meter I have? The one I'm using seems more like a temp thing.
On the Bar meters, instead of the BarImage option you can use BarColor option, to use some color for the bar. And this approach has the great advantage that you can easily change the color of the bar, according to the value of the measure, using some !SetOption bangs. Eg you can have green bar when the value of the measure is smaller then 50%, yellow, if it is between 50% and 80% and red if it's above 80%.

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 7:38 pm
by Craash
You are quick. I edited that out of my post, just took a little search on my end to realize the color thing, plus, I'm using a picture for my bar image.

I think I'm finished for today. Pretty happy with the results.

Re: NUT UPS Monitoring

Posted: October 18th, 2017, 7:42 pm
by balala
Craash wrote:I think I'm finished for today. Pretty happy with the results.
I'm glad. Feel free to come back if you have further questions.
Good night.