So today I had a request that our execs wanted to see some data that we had been charting with a perfstack, but my supervisors didn't like that the labels were all "technical" with host names and interfaces and such. Since they wouldn't be expected to know how to correlate our naming conventions to actual locations I had to build them a key. Apparently some poor network engineer has spent the last 2 weeks screenshotting the data in Orion, dropping it into a word doc where he had manually created a label color legend and then sending that cleaned up version up the chain. Obviously that's no way to live, so I had to fix it.
Based on the information mentioned in this thread, https://thwack.solarwinds.com/t5/NPM-Documents/PerfStack-Custom-Colors/ta-p/526771, I built myself a table in the database where I listed off the top 15 perstack color codes. Then used SQL to join the nodes, ranked alphabetically, to the list of colors in a custom table widget. Had to edit one of my perstacks to make sure all the objects were added in alpha order, perfstack just orders them based on which objects you added first, so if you add things all randomly there might not be much you can do to match the colors to the labels.


You can see a cleaned up version of my query here to join the nodes,
select concat('<a href="/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N:',n.nodeid,'">', n.caption,'</a>') as caption
, n.city
, concat('<span style="color: ',c.color,'; background-color: ',c.color,'">______</span>') as Label
from (select caption,rank() OVER ( ORDER BY CAPTION ) as num
from nodes
where (caption like '%some of my captions%'))
) n2
join nodes n on n2.caption = n.caption
join cah_colors c on c.num = n2.num
order by n.captionFeel free to ask any questions if you need help with anything to try it out.