Skip to content

Commit ad6fc7a

Browse files
author
Stephan Lammel
committed
add column with value outside downtime for SAM and Readiness
1 parent bb258a5 commit ad6fc7a

File tree

1 file changed

+76
-29
lines changed

1 file changed

+76
-29
lines changed

cmssst/www/cgi-bin/log_fetcher.py

Lines changed: 76 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# /etf15min / 1550923650 / T0_CH_CERN / site / 0+0
1414
# down15min / 201902231200 / ce07.pic.es / CE /
1515
# sam15min / 20190223120730 / all / SE-xrootd-read /
16-
# sam1hour /
17-
# sam6hour /
18-
# sam1day / debug
19-
# hc15min "HammerCloud"
16+
# sam1hour / srgroup /
17+
# sam6hour rrgroup /
18+
# sam1day argroup / debug
19+
# hc15min "HammerCloud" vrgroup
2020
# hc1hour
2121
# hc6hour
2222
# hc1day
@@ -617,10 +617,17 @@ def lftch_monit_fetch(cfg):
617617
myCntrbt = myJson['data']['quality']
618618
else:
619619
myCntrbt = myJson['data']['value']
620+
myDowntime = False
621+
if (( cfg['metric'][:3] == "sam" ) or
622+
( cfg['metric'][:2] == "sr" )):
623+
if ( myStatus == "downtime" ):
624+
myDowntime = True
620625
except KeyError:
621626
myCntrbt = 0
627+
myDowntime = False
622628
lftch_monitdocs[tbin].append( { 'name': myName,
623-
'vrsn': version, 'cntrbt': myCntrbt } )
629+
'vrsn': version, 'cntrbt': myCntrbt,
630+
'dwnflg': myDowntime } )
624631
else:
625632
lftch_monitdocs[tbin].append( myJson['data'] )
626633
#
@@ -3478,13 +3485,19 @@ def lftch_maindvi_rank(cfg, docs):
34783485
#
34793486
for mySite in myDict:
34803487
if ( mySite not in rankingDict ):
3481-
rankingDict[ mySite ] = myDict[ mySite ]['cntrbt']
3482-
else:
3483-
rankingDict[ mySite ] += myDict[ mySite ]['cntrbt']
3488+
rankingDict[ mySite ] = [ 0.000, 0.000, 0.000 ]
3489+
rankingDict[ mySite ][0] += myDict[ mySite ]['cntrbt']
3490+
#
3491+
if ( myDict[ mySite ]['dwnflg'] == False ):
3492+
rankingDict[ mySite ][1] += myDict[ mySite ]['cntrbt']
3493+
rankingDict[ mySite ][2] += 1.000
34843494
#
34853495
if ( normalizer > 0.000 ):
34863496
for mySite in rankingDict:
3487-
rankingDict[ mySite ] = rankingDict[ mySite ] / normalizer
3497+
rankingDict[ mySite ][0] = rankingDict[ mySite ][0] / normalizer
3498+
if ( rankingDict[ mySite ][2] > 0.000 ):
3499+
rankingDict[ mySite ][1] = rankingDict[ mySite ][1] / \
3500+
rankingDict[ mySite ][2]
34883501

34893502

34903503
# write mainDVI ETF HTML section:
@@ -3507,33 +3520,67 @@ def lftch_maindvi_rank(cfg, docs):
35073520
valueStrng = "Avg. Quality"
35083521
else:
35093522
valueStrng = "Avg. Value"
3510-
myFile.write((" <TH STYLE=\"font-size: large; font-weight: bol" +
3511-
"d;\"><B>Site:</B>\n <TH STYLE=\"font-size: larg" +
3512-
"e; font-weight: bold;\">Bar Graph:\n <TH STYLE=" +
3513-
"\"font-size: large; font-weight: bold;\">%s:\n<TR" +
3514-
" HEIGHT=\"3\">\n <TD COLSPAN=\"3\" STYLE=\"back" +
3515-
"ground-color: black\">\n") % valueStrng)
3523+
if (( cfg['metric'][:3] == "sam" ) or
3524+
( cfg['metric'][:2] == "sr" )):
3525+
myFile.write((" <TH STYLE=\"font-size: large; font-weight:" +
3526+
" bold;\"><B>Site:</B>\n <TH STYLE=\"font-si" +
3527+
"ze: large; font-weight: bold;\">Bar Graph:\n " +
3528+
" <TH STYLE=\"font-size: large; font-weight: " +
3529+
"bold;\">%s:\n <TH STYLE=\"font-size: large;" +
3530+
"font-weight: normal;\">outside downtime:\n<TR" +
3531+
" HEIGHT=\"3\">\n <TD COLSPAN=\"4\" STYLE=\"" +
3532+
"background-color: black\">\n") % valueStrng)
3533+
else:
3534+
myFile.write((" <TH STYLE=\"font-size: large; font-weight:" +
3535+
" bold;\"><B>Site:</B>\n <TH STYLE=\"font-si" +
3536+
"ze: large; font-weight: bold;\">Bar Graph:\n " +
3537+
" <TH STYLE=\"font-size: large; font-weight: " +
3538+
"bold;\">%s:\n<TR HEIGHT=\"3\">\n <TD COLSPA" +
3539+
"N=\"3\" STYLE=\"background-color: black\">\n") %
3540+
valueStrng)
35163541
#
3517-
for mySite in sorted(rankingDict, key=rankingDict.get,
3542+
for mySite in sorted(rankingDict.keys(),
3543+
key=lambda k: rankingDict[k][0],
35183544
reverse=True):
3519-
myPercnt = int( 500.0 * (rankingDict[mySite] + 0.001) ) / 5.0
3520-
if ( rankingDict[mySite] >= 0.900 ):
3545+
myPercnt = int( 500.0 * (rankingDict[mySite][0] + 0.001) )/5.0
3546+
if ( rankingDict[mySite][0] >= 0.900 ):
35213547
myColour = "#80FF80"
3522-
elif ( rankingDict[mySite] < 0.800 ):
3548+
elif ( rankingDict[mySite][0] < 0.800 ):
35233549
myColour = "#FF0000"
35243550
else:
35253551
myColour = "#FFFF00"
3526-
myFile.write(("<TR>\n <TD STYLE=\"text-align: right; font-" +
3527-
"weight: bold; white-space: nowrap;\">%s\n <" +
3528-
"TD STYLE=\"width: 500px; text-align: left; ba" +
3529-
"ckground-color: #F4F4F4; white-space: nowrap;" +
3530-
"\"><DIV STYLE=\"width: %.1f%%; background-col" +
3531-
"or: %s;\">&nbsp;</DIV>\n <TD STYLE=\"text-a" +
3532-
"lign: center; white-space: nowrap;\">%.3f\n") %
3533-
(mySite, myPercnt, myColour, rankingDict[mySite]))
3552+
if (( cfg['metric'][:3] == "sam" ) or
3553+
( cfg['metric'][:2] == "sr" )):
3554+
myFile.write(("<TR>\n <TD STYLE=\"text-align: right; f" +
3555+
"ont-weight: bold; white-space: nowrap;\">" +
3556+
"%s\n <TD STYLE=\"width: 500px; text-ali" +
3557+
"gn: left; background-color: #F4F4F4; whit" +
3558+
"e-space: nowrap;\"><DIV STYLE=\"width: " +
3559+
"%.1f%%; background-color: %s;\">&nbsp;</D" +
3560+
"IV>\n <TD STYLE=\"text-align: center; f" +
3561+
"ont-weight: bold; white-space: nowrap;\">" +
3562+
"%.3f\n <TD STYLE=\"text-align: center; " +
3563+
"white-space: nowrap;\">%.3f\n") % (mySite,
3564+
myPercnt, myColour, rankingDict[mySite][0],
3565+
rankingDict[mySite][1]))
3566+
else:
3567+
myFile.write(("<TR>\n <TD STYLE=\"text-align: right; f" +
3568+
"ont-weight: bold; white-space: nowrap;\">" +
3569+
"%s\n <TD STYLE=\"width: 500px; text-ali" +
3570+
"gn: left; background-color: #F4F4F4; whit" +
3571+
"e-space: nowrap;\"><DIV STYLE=\"width: " +
3572+
"%.1f%%; background-color: %s;\">&nbsp;</D" +
3573+
"IV>\n <TD STYLE=\"text-align: center; w" +
3574+
"hite-space: nowrap;\">%.3f\n") % (mySite,
3575+
myPercnt, myColour, rankingDict[mySite][0]))
35343576
#
3535-
myFile.write("<TR HEIGHT=\"3\">\n <TD COLSPAN=\"3\" STYLE=\"ba" +
3536-
"ckground-color: black\">\n</TABLE>\n")
3577+
if (( cfg['metric'][:3] == "sam" ) or
3578+
( cfg['metric'][:2] == "sr" )):
3579+
myFile.write("<TR HEIGHT=\"3\">\n <TD COLSPAN=\"4\" STYLE=" +
3580+
"\"background-color: black\">\n</TABLE>\n")
3581+
else:
3582+
myFile.write("<TR HEIGHT=\"3\">\n <TD COLSPAN=\"3\" STYLE=" +
3583+
"\"background-color: black\">\n</TABLE>\n")
35373584
#
35383585
try:
35393586
os.chmod(myHTML, 0o644)

0 commit comments

Comments
 (0)