I am trying to create a script which uses text file as input, compares values against a threshold and create a html report. My data populates just fine, but it is not rendering colors as expected, need guidance on the same please, I mean how to use this variable in td ?
input file:
6 30 OK
5 30 OK
70 30 NOK
56 30 NOK
8 30 OK
52 30 NOK
22 30 OK
and below is my awk command:
awk 'BEGIN{
FS=" "
print "<TABLE border=1 cellspacing=0 cellpadding=3><TR><TH>HOST</TH><TH>APP_HOST1</TH><TH>APP_HOST2</TH><TH>APP_HOST3</TH><TH>APP_HOST4</TH><TH>APP_HOST5</TH><TH>DB_HOST1</TH><TH>DB_HOST2</TH></TR>"
print "<TR><TD>DISK_ROOT</TD>"
}
NR>=1{
bgcolor=" bgcolor=green"
if($3=="NOK"){ bgcolor=" bgcolor=red"}
printf "<TD $bgcolor>"$1"</TD>"
}
END{
print "</TABLE>"
}
' ${logdir}/Disk_Space.log >> $stat_dir/html/report_Disk.html
