Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Boomtable Generics

16 Nov 2021 »

def gen_boomtable_generics(from_ms, to_ms):

    response = []
    row = []
    shield_warning = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAeVJREFUOE9jZKAQMML0Hz9z6TE2s1RVFI5jExcR4AsDicMN2Hv4+H+e7zcY2P68QVGvIPEShf+fS5nhn0QUg4gAP1gvigEqz9oZhD4fQdHwT+MvqgP+SDH8NjhBnAEzL2swMAj/Z0h1uoYwhBQDes7qMfwX/M9Q7HWBPANmXYG4IMWRTBcsv6nC8F/sL0OE5R3CLth/9OR/hWd9DCIfd8MVb30gx/Bf4i+Dl8EjhAF/lRm+ae9mkBQRRo2FIyfP/uV5s4tJ+Xk3XPGrb5wM/1X+MojyfYeL/edKZHjGn/9TS1mRAyUadx85eon5H4OuxuMKBt7vV8Ea5l7VYPgv8o8hyf46xIDfPAy/DS4xnL12Y7e7tbUbigFTVqxQ01NUvsH47QWj2pNGBq6f9xhef+dg+K/8l0GE7wcDw29Ohr+qaxjufRT8e/LcOY3s2FhwwMATEogzb+3aFFVZ+dl/vn9mkH2zkEH0w3YGBrWfDP8ZtBj+qC9mePj65/9z164mpIaGLoL5CcUAkODUJctDVOVkl7GzsrMy/XjBoKUqwPCNRY3h2q1b3+88fhSTHR29DjlpYhgANmT5cllWRuZ6BRnpxP+MDP8ePH4y9+ef3y15MTFP0DMWVgNgiiYtWSIDYmPTCFMDAGAV2BF54GIzAAAAAElFTkSuQmCC"/>'
    shield_ok = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAYlJREFUOE9jZKAQMML0z1u97jE2s+QlpI5jE3e2tQgDicMNmLp02X9JEVEGDnY2FPVP/ouh8HmZ/jCIMX1hcLa1BOtFMUBPVY3h18/fKBrKr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CLuxbqoRCE2gWocLGBv3Hs+LPtFreLxpRum1bjXdCAAAAAElFTkSuQmCC"/>'
    status_ok = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAndJREFUOE+lk11Ik1EYx39nH6GLaYpWIkyQgiCvnFiZEIKJ0U0JC7sogiJCMQhnFBUIEphmEPZ1E4TSTYIFsSIQiyBM16Jmhllqmw41TWcttb3b3jjvNrekuw6ci/f5+D0f5/8K/vOItfn7r2JVQjRHVMpVQAbodGDQ0SME5xx2XMk5fwEqW7mZsT6t5siek2zPK0BRAviXp5nxe3GPv8P5ZQhFCXc9tnMoDlkFVLbwIDczx3bjeCduXwfvPR2EIiAE6AWkGPMJLJt57h5k6XfklsNOrYRoANm2OcX05vqJTnqHa5kPTGtta85YCVUFeRf8mThH5lHCFMlxNHdFM71Hyw6Xbc72MzzzVKsoK0un3IPsJBiCM6Uqrb2C0QmYnOWFo4GyOEBtrD6Le7aFlWA02aADnYCwCisK1JdKFLS/FkxMwkcPOOxaKOxtRj1vO8Xg3B1OF0cD2/oERh0Ew2Avidrkue0SeD3gHoMnDTFAxRXUmn1VeIPd1FkTwZdfCS7sTnxf6xeYU2B8FN4nAypbUG0lu1DMfQSCUF+USIpXbnMKTEYw6uHzJ8GQR00aoYl+67aNxRZLEGHy80tCChOQNpcg1QjrDLA4Jxj9CmMT6sCzi+zQdlBYzcG8nXQXbkkn27II+ujWIzEdyKryhhUYGxGM+FS8Tqre3udhXEim8kvcS8vCtjVXR/amCOlZIPSxAcLgnxN8m4bRKZXFWbp6mjgGLCVL2VLRyF3TBspzMgRmU1SB8sin/LkEUwsqge9ash3wJuls9ZXyCw5QkmulzpBKsVSeFiQgtMyAz0X7h0e8jCf/CyBtJiAXSFvzp/4AfLLtZPsfEEzyES+XhMsAAAAASUVORK5CYII="/>'
    dummy = '<img src=""/>'

    shields = [shield_warning, shield_ok, shield_bad]
    status = [status_ok, status_warning, status_error]
    for i in range(10):
        row.append({
            "name": f"EC2{i:02d}",
            "ip": f"10.0.0.{i}",
            "cpu": f"{random.randint(10,100)}%",
            "status": random.choice(status),
            "alert compliance": random.choice(shields),
        })
    
    df = pd.DataFrame(row)    
    cols = [i for i in list(df.columns) if i != "_value_"]
    ___ = " ;;; "
    for idy, c in enumerate(cols):
        response.append({
            "target": f"row000{___}col{idy:03d}{___}{c}",
            "datapoints": [[1, to_ms]],
        })
    for idx,doc in enumerate(df.to_dict('records')):
        idxref = f"{idx+1:03d}"
        val = doc.get("_value_", 1)
        for idy, c in enumerate(cols):
            idyref = f"{idy:03d}"
            cval = doc.get(c, '')
            response.append({
                "target": f"row{idxref}{___}col{idyref}{___}{cval}",
                "datapoints": [[val, to_ms]],
            })
    return response

def gen_boomtable_generics2(from_ms, to_ms):

    response = []
    row = []
    shield_warning = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAeVJREFUOE9jZKAQMML0Hz9z6TE2s1RVFI5jExcR4AsDicMN2Hv4+H+e7zcY2P68QVGvIPEShf+fS5nhn0QUg4gAP1gvigEqz9oZhD4fQdHwT+MvqgP+SDH8NjhBnAEzL2swMAj/Z0h1uoYwhBQDes7qMfwX/M9Q7HWBPANmXYG4IMWRTBcsv6nC8F/sL0OE5R3CLth/9OR/hWd9DCIfd8MVb30gx/Bf4i+Dl8EjhAF/lRm+ae9mkBQRRo2FIyfP/uV5s4tJ+Xk3XPGrb5wM/1X+MojyfYeL/edKZHjGn/9TS1mRAyUadx85eon5H4OuxuMKBt7vV8Ea5l7VYPgv8o8hyf46xIDfPAy/DS4xnL12Y7e7tbUbigFTVqxQ01NUvsH47QWj2pNGBq6f9xhef+dg+K/8l0GE7wcDw29Ohr+qaxjufRT8e/LcOY3s2FhwwMATEogzb+3aFFVZ+dl/vn9mkH2zkEH0w3YGBrWfDP8ZtBj+qC9mePj65/9z164mpIaGLoL5CcUAkODUJctDVOVkl7GzsrMy/XjBoKUqwPCNRY3h2q1b3+88fhSTHR29DjlpYhgANmT5cllWRuZ6BRnpxP+MDP8ePH4y9+ef3y15MTFP0DMWVgNgiiYtWSIDYmPTCFMDAGAV2BF54GIzAAAAAElFTkSuQmCC"/>'
    shield_ok = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAYlJREFUOE9jZKAQMML0z1u97jE2s+QlpI5jE3e2tQgDicMNmLp02X9JEVEGDnY2FPVP/ouh8HmZ/jCIMX1hcLa1BOtFMUBPVY3h18/fKBrKr4qg8M0lmBmChF+OGoAtDKYtX/H/4k9phkMPvqEE2uECCxT+2/fvGR48fMzg7mCLGguzV67++5xBiGn59T94DXj4+AnDg0dPfgZ7u3OgROP0xUsv/WNm0t37QYrh+qsfcEOQXfD12zeGu3cfMNy6e293RkK0G4oBDb29atLSMje+M7Axbn8lxPDgHcQQmAHfv/9guP/gMcPjF8/+3r5/R6OhqOgOigEgTuuUKSniomKzf/xlYLjxR5Lh8MPvDHuyTRnevP/A8OLFK4bnr17+v/PwXkJdQcEimBPhKREm0NDTEyIqLrmMmZWZ9RcDO4OBggzDl6/fGB4+ffT95auXMQ0lJeuQAwnDAJBkdW+vLAcjS72oqGgiI8P/fy/evJr7/9evloby8ifoGQurAXDXdHbKgNjYNMLUAACYg8QR6A5liQAAAABJRU5ErkJggg=="/>'
    shield_bad = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAjFJREFUOE+lk11IU2EYx//vOfvwbHNunhlbbWtrbYZg0GVINxEFddFNBuGEgoRC7SKKkIjdmBcaVJLVMEfEakrobRcSQTrGIbdgpAyRMrdYeJgVuQ/3dWKLI51aMei9ep/nff4/eJ7n/xL85yGiPrQQjddiOffaQrXyBp32dCW/DXg5FxLIx/fAtw1J/Z5CRhLTZguYIydg0DV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l+67aNxRZLEGHy80tCChOQNpcg1QjrDLA4Jxj9CmMT6sCzi+zQdlBYzcG8nXQXbkkn27II+ujWIzEdyKryhhUYGxGM+FS8Tqre3udhXEim8kvcS8vCtjVXR/amCOlZIPSxAcLgnxN8m4bRKZXFWbp6mjgGLCVL2VLRyF3TBspzMgRmU1SB8sin/LkEUwsqge9ash3wJuls9ZXyCw5QkmulzpBKsVSeFiQgtMyAz0X7h0e8jCf/CyBtJiAXSFvzp/4AfLLtZPsfEEzyES+XhMsAAAAASUVORK5CYII="/>'
    dummy = '<img src=""/>'

    shields = [shield_warning, shield_ok, shield_bad]
    status = [status_ok, status_warning, status_error]
    for i in range(10):
        target_current = random.randint(1,10)
        target_size = max(target_current, random.randint(1,10))
        row.append({
            "name": f"LB{i:02d}",
            "type": random.choice(["elb", "alb", "nlb"]),
            "targets": f"{target_current}/{target_size}",
            "perc": f"{round((target_current/target_size)*100, 2)}%",
            "alert compliance": random.choice(shields),
        })
    
    df = pd.DataFrame(row)    
    cols = [i for i in list(df.columns) if i != "_value_"]
    ___ = " ;;; "
    for idy, c in enumerate(cols):
        response.append({
            "target": f"row000{___}col{idy:03d}{___}{c}",
            "datapoints": [[1, to_ms]],
        })
    for idx,doc in enumerate(df.to_dict('records')):
        idxref = f"{idx+1:03d}"
        val = doc.get("_value_", 1)
        for idy, c in enumerate(cols):
            idyref = f"{idy:03d}"
            cval = doc.get(c, '')
            response.append({
                "target": f"row{idxref}{___}col{idyref}{___}{cval}",
                "datapoints": [[val, to_ms]],
            })
    return response

def gen_boomtable_generics3(from_ms, to_ms):

    response = []
    row = []
    shield_warning = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAeVJREFUOE9jZKAQMML0Hz9z6TE2s1RVFI5jExcR4AsDicMN2Hv4+H+e7zcY2P68QVGvIPEShf+fS5nhn0QUg4gAP1gvigEqz9oZhD4fQdHwT+MvqgP+SDH8NjhB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/fGB4+ffT95auXMQ0lJeuQAwnDAJBkdW+vLAcjS72oqGgiI8P/fy/evJr7/9evloby8ifoGQurAXDXdHbKgNjYNMLUAACYg8QR6A5liQAAAABJRU5ErkJggg=="/>'
    shield_bad = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAjFJREFUOE+lk11IU2EYx//vOfvwbHNunhlbbWtrbYZg0GVINxEFddFNBuGEgoRC7SKKkIjdmBcaVJLVMEfEakrobRcSQTrGIbdgpAyRMrdYeJgVuQ/3dWKLI51aMei9ep/nff4/eJ7n/xL85yGiPrQQjddiOffaQrXyBp32dCW/DXg5FxLIx/fAtw1J/Z5CRhLTZguYIydg0DVVtRIA5X8IEl2QCFpZvSTOaXVovP/03wBCUaAYBqV0GlWASgVkc4BQRl0AY08/1O0HsDrQD2ezHtTAEMrv3kKYelwfQGE0wT78AIXUOpS0DALLIuW5iuYvfH2AStOMsxWOu75q/8krF2D4nKhO7K8tvApyAqYmQN4EQas1sN28AxnbUgVQXzcgDN+AkEkjazCCueWFycBKtzDPhUt5bo6iAuMwXbwM7cFD+HCtD2q5HDsGb0MIcyB+L/KHjyN98sxWm8PeIFnj7HwwSpfQTrwjoJNx0I1aFPh1uFg9+AYVFJkMGKUCmkfPEY7FZo91dByVAO5NTrr22x2xAs8T2jcKJH8aU/RBnpZB4RnBJ6WqxEUi+3q7u1ckgErgm54+77TsHs9/3wT1YgaEew1Xkwa5nVZorg8hvpkRIkuLZ3s6O5+I7tp2opgY8wdOOa2WZ0q5Ul5M8WgztqBotmJpeTm7El9z93Z1zfxqzT8AlcexQMAiJ7THZt51TiAor8YTE1vFwuAltzvx+8eqCRCLRv1+c+VeSyjW/ACFENoRri4lwgAAAABJRU5ErkJggg=="/>'
    status_error = '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAv9JREFUOE9d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XMk5fwEqW7mZsT6t5siek2zPK0BRAviXp5nxe3GPv8P5ZQhFCXc9tnMoDlkFVLbwIDczx3bjeCduXwfvPR2EIiAE6AWkGPMJLJt57h5k6XfklsNOrYRoANm2OcX05vqJTnqHa5kPTGtta85YCVUFeRf8mThH5lHCFMlxNHdFM71Hyw6Xbc72MzzzVKsoK0un3IPsJBiCM6Uqrb2C0QmYnOWFo4GyOEBtrD6Le7aFlWA02aADnYCwCisK1JdKFLS/FkxMwkcPOOxaKOxtRj1vO8Xg3B1OF0cD2/oERh0Ew2Avidrkue0SeD3gHoMnDTFAxRXUmn1VeIPd1FkTwZdfCS7sTnxf6xeYU2B8FN4nAypbUG0lu1DMfQSCUF+USIpXbnMKTEYw6uHzJ8GQR00aoYl+67aNxRZLEGHy80tCChOQNpcg1QjrDLA4Jxj9CmMT6sCzi+zQdlBYzcG8nXQXbkkn27II+ujWIzEdyKryhhUYGxGM+FS8Tqre3udhXEim8kvcS8vCtjVXR/amCOlZIPSxAcLgnxN8m4bRKZXFWbp6mjgGLCVL2VLRyF3TBspzMgRmU1SB8sin/LkEUwsqge9ash3wJuls9ZXyCw5QkmulzpBKsVSeFiQgtMyAz0X7h0e8jCf/CyBtJiAXSFvzp/4AfLLtZPsfEEzyES+XhMsAAAAASUVORK5CYII="/>'
    dummy = '<img src=""/>'

    shields = [shield_warning, shield_ok, shield_bad]
    status = [status_ok, status_warning, status_error]
    # vis accounts ec2, s3, elbs, nlbs, albs, ecs, fargate, lambda
    for i in range(10):
        doc = { "name": f"ACC{i:02d}", }
        for resource in ["ec2", "s3", "elb", "nlb", "alb", "ec2", "fargate", "lambda"]:
            ok = random.randint(0,3)
            warning = random.randint(0,3)
            fail = random.randint(0,3)
            total = ok+warning+fail
            summarize = "/".join([f"{i} {img}" for i,img in zip([ok, warning, fail], status) if i != 0])
            doc[resource] = "" if total == 0 else f"({ok+warning+fail}) {summarize}"
    
        doc["alert compliance"] = random.choice(shields)
        row.append(doc)
    df = pd.DataFrame(row)    
    cols = [i for i in list(df.columns) if i != "_value_"]
    ___ = " ;;; "
    for idy, c in enumerate(cols):
        response.append({
            "target": f"row000{___}col{idy:03d}{___}{c}",
            "datapoints": [[1, to_ms]],
        })
    for idx,doc in enumerate(df.to_dict('records')):
        idxref = f"{idx+1:03d}"
        val = doc.get("_value_", 1)
        for idy, c in enumerate(cols):
            idyref = f"{idy:03d}"
            cval = doc.get(c, '')
            response.append({
                "target": f"row{idxref}{___}col{idyref}{___}{cval}",
                "datapoints": [[val, to_ms]],
            })
    return response