Changeset 1855

Show
Ignore:
Timestamp:
01/19/12 11:26:12 (4 months ago)
Author:
Dylan
Message:

unxsVZ added uNode filter for tDatacenter left panel mini reports.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tdatacenterfunc.h

    r1736 r1855  
    1111static unsigned uClone=0; 
    1212static unsigned uOldDatacenter=0; 
     13static unsigned uTargetNode=0; 
     14static char cuTargetNodePullDown[256]={""}; 
     15 
    1316//ModuleFunctionProtos() 
    1417void tDatacenterNavList(void); 
     
    4144                        strcpy(cForClientPullDown,entries[i].val); 
    4245                        uForClient=ReadPullDown(TCLIENT,"cLabel",cForClientPullDown); 
     46                } 
     47                else if(!strcmp(entries[i].name,"cuTargetNodePullDown")) 
     48                { 
     49                        sprintf(cuTargetNodePullDown,"%.255s",entries[i].val); 
     50                        uTargetNode=ReadPullDown("tNode","cLabel",cuTargetNodePullDown); 
    4351                } 
    4452        } 
     
    435443 
    436444 
     445        printf("<p>Select uNode<br>"); 
     446        tTablePullDownDatacenter("tNode;cuTargetNodePullDown","cLabel","cLabel",uTargetNode,1, 
     447                        "",0,uDatacenter);//0 does not use tProperty, uses uDatacenter 
     448 
    437449        //1-. Disk space usage/soft limit ratio 
    438450        //1a-. Create temp table 
     
    449461 
    450462        //1b-. Populate with data per container 
    451         sprintf(gcQuery,"SELECT tProperty.uKey,tProperty.cValue,tContainer.cLabel FROM tProperty,tContainer" 
     463        if(uTargetNode) 
     464                sprintf(gcQuery,"SELECT tProperty.uKey,tProperty.cValue,tContainer.cLabel FROM tProperty,tContainer" 
     465                        " WHERE tProperty.uKey=tContainer.uContainer AND tProperty.uType=3 AND" 
     466                        " tProperty.cName='1k-blocks.luUsage' AND tContainer.uDatacenter=%u" 
     467                        " AND tContainer.uNode=%u" 
     468                        " AND tContainer.uStatus=1",uDatacenter,uTargetNode); 
     469        else 
     470                sprintf(gcQuery,"SELECT tProperty.uKey,tProperty.cValue,tContainer.cLabel FROM tProperty,tContainer" 
    452471                        " WHERE tProperty.uKey=tContainer.uContainer AND tProperty.uType=3 AND" 
    453472                        " tProperty.cName='1k-blocks.luUsage' AND tContainer.uDatacenter=%u" 
     
    475494        mysql_free_result(res); 
    476495 
    477         sprintf(gcQuery,"SELECT tProperty.uKey,tProperty.cValue FROM tProperty,tContainer" 
     496        if(uTargetNode) 
     497                sprintf(gcQuery,"SELECT tProperty.uKey,tProperty.cValue FROM tProperty,tContainer" 
     498                        " WHERE tProperty.uKey=tContainer.uContainer AND tProperty.uType=3 AND" 
     499                        " tProperty.cName='1k-blocks.luSoftLimit' AND tContainer.uDatacenter=%u" 
     500                        " AND tContainer.uNode=%u" 
     501                        " AND tContainer.uStatus=1",uDatacenter,uTargetNode); 
     502        else 
     503                sprintf(gcQuery,"SELECT tProperty.uKey,tProperty.cValue FROM tProperty,tContainer" 
    478504                        " WHERE tProperty.uKey=tContainer.uContainer AND tProperty.uType=3 AND" 
    479505                        " tProperty.cName='1k-blocks.luSoftLimit' AND tContainer.uDatacenter=%u" 
     
    539565 
    540566        //2-. None zero historic fail counters 
    541         sprintf(gcQuery,"SELECT cValue,uKey,cLabel,cName FROM tProperty,tContainer WHERE" 
     567        if(uTargetNode) 
     568                sprintf(gcQuery,"SELECT cValue,uKey,cLabel,cName FROM tProperty,tContainer WHERE" 
     569                        " tProperty.uKey=tContainer.uContainer AND" 
     570                        " tContainer.uDatacenter=%u AND" 
     571                        " tContainer.uNode=%u AND" 
     572                        " cValue!='0' AND uType=3 AND cName LIKE '%%.luFailcnt'" 
     573                        " ORDER BY CONVERT(cValue,UNSIGNED) DESC LIMIT 10",uDatacenter,uTargetNode); 
     574        else 
     575                sprintf(gcQuery,"SELECT cValue,uKey,cLabel,cName FROM tProperty,tContainer WHERE" 
    542576                        " tProperty.uKey=tContainer.uContainer AND" 
    543577                        " tContainer.uDatacenter=%u AND" 
     
    564598 
    565599        //3a-. Todays top in 
    566         sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/1000),2),uKey,cHostname,TIME(FROM_UNIXTIME(tProperty.uModDate)) FROM" 
     600        if(uTargetNode) 
     601                sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/1000),2),uKey,cHostname,TIME(FROM_UNIXTIME(tProperty.uModDate)) FROM" 
    567602                        " tProperty,tContainer WHERE" 
    568603                        " tProperty.uKey=tContainer.uContainer AND cValue!='0' AND uType=3 AND" 
    569604                        " tContainer.uStatus=%u AND" 
    570605                        " tContainer.uDatacenter=%u AND" 
     606                        " tContainer.uNode=%u AND" 
     607                        " cName='Venet0.luMaxDailyInDelta'" 
     608                        " GROUP BY uKey ORDER BY CONVERT(cValue,UNSIGNED) DESC LIMIT 10",uACTIVE,uDatacenter,uTargetNode); 
     609        else 
     610                sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/1000),2),uKey,cHostname,TIME(FROM_UNIXTIME(tProperty.uModDate)) FROM" 
     611                        " tProperty,tContainer WHERE" 
     612                        " tProperty.uKey=tContainer.uContainer AND cValue!='0' AND uType=3 AND" 
     613                        " tContainer.uStatus=%u AND" 
     614                        " tContainer.uDatacenter=%u AND" 
    571615                        " cName='Venet0.luMaxDailyInDelta'" 
    572616                        " GROUP BY uKey ORDER BY CONVERT(cValue,UNSIGNED) DESC LIMIT 10",uACTIVE,uDatacenter); 
     
    590634 
    591635        //3b-. Todays top out 
    592         sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/1000),2),uKey,cHostname,TIME(FROM_UNIXTIME(tProperty.uModDate)) FROM" 
     636        if(uTargetNode) 
     637                sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/1000),2),uKey,cHostname,TIME(FROM_UNIXTIME(tProperty.uModDate)) FROM" 
    593638                        " tProperty,tContainer WHERE" 
    594639                        " tProperty.uKey=tContainer.uContainer AND cValue!='0' AND uType=3 AND" 
    595640                        " tContainer.uStatus=%u AND" 
    596641                        " tContainer.uDatacenter=%u AND" 
     642                        " tContainer.uNode=%u AND" 
     643                        " cName='Venet0.luMaxDailyOutDelta'" 
     644                        " GROUP BY uKey ORDER BY CONVERT(cValue,UNSIGNED) DESC LIMIT 10",uACTIVE,uDatacenter,uTargetNode); 
     645        else 
     646                sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/1000),2),uKey,cHostname,TIME(FROM_UNIXTIME(tProperty.uModDate)) FROM" 
     647                        " tProperty,tContainer WHERE" 
     648                        " tProperty.uKey=tContainer.uContainer AND cValue!='0' AND uType=3 AND" 
     649                        " tContainer.uStatus=%u AND" 
     650                        " tContainer.uDatacenter=%u AND" 
    597651                        " cName='Venet0.luMaxDailyOutDelta'" 
    598652                        " GROUP BY uKey ORDER BY CONVERT(cValue,UNSIGNED) DESC LIMIT 10",uACTIVE,uDatacenter); 
     
    616670 
    617671        //4-. Last 5 min top talkers 
    618         sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/2000),2),uKey,cHostname FROM" 
     672        if(uTargetNode) 
     673                sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/2000),2),uKey,cHostname FROM" 
    619674                        " tProperty,tContainer WHERE" 
    620675                        " tProperty.uKey=tContainer.uContainer AND cValue!='0' AND uType=3 AND" 
    621676                        " tContainer.uStatus=%u AND" 
    622677                        " tContainer.uDatacenter=%u AND" 
     678                        " tContainer.uNode=%u AND" 
     679                        " (cName='Venet0.luInDelta' OR cName='Venet0.luOutDelta')" 
     680                        " GROUP BY uKey ORDER BY CONVERT(cValue,UNSIGNED) DESC LIMIT 10",uACTIVE,uDatacenter,uTargetNode); 
     681        else 
     682                sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/2000),2),uKey,cHostname FROM" 
     683                        " tProperty,tContainer WHERE" 
     684                        " tProperty.uKey=tContainer.uContainer AND cValue!='0' AND uType=3 AND" 
     685                        " tContainer.uStatus=%u AND" 
     686                        " tContainer.uDatacenter=%u AND" 
    623687                        " (cName='Venet0.luInDelta' OR cName='Venet0.luOutDelta')" 
    624688                        " GROUP BY uKey ORDER BY CONVERT(cValue,UNSIGNED) DESC LIMIT 10",uACTIVE,uDatacenter); 
     
    642706 
    643707        //4-. Top talkers 
    644         sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/1000000000),2),uKey,cHostname FROM" 
     708        if(uTargetNode) 
     709                sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/1000000000),2),uKey,cHostname FROM" 
     710                        " tProperty,tContainer WHERE" 
     711                        " tContainer.uStatus=%u AND" 
     712                        " tContainer.uDatacenter=%u AND" 
     713                        " tContainer.uNode=%u AND" 
     714                        " tProperty.uKey=tContainer.uContainer AND cValue!='0' AND uType=3 AND" 
     715                        " (cName='Venet0.luIn' OR cName='Venet0.luOut')" 
     716                        " GROUP BY uKey ORDER BY CONVERT(cValue,UNSIGNED) DESC LIMIT 10",uACTIVE,uDatacenter,uTargetNode); 
     717        else 
     718                sprintf(gcQuery,"SELECT FORMAT(SUM(cValue/1000000000),2),uKey,cHostname FROM" 
    645719                        " tProperty,tContainer WHERE" 
    646720                        " tContainer.uStatus=%u AND"