Beispiel #1
0
if len(sys.argv) > 1:
    file = str(sys.argv[1])
else:
    file = "diagram"

with Diagram("Advanced Web Service with On-Premise", filename=file,
             show=False):
    ingress = Nginx("ingress")

    metrics = Prometheus("metric")
    metrics << Grafana("monitoring")

    with Cluster("Service Cluster"):
        grpcsvc = [Server("grpc1"), Server("grpc2"), Server("grpc3")]

    with Cluster("Sessions HA"):
        master = Redis("session")
        master - Redis("replica") << metrics
        grpcsvc >> master

    with Cluster("Database HA"):
        master = PostgreSQL("users")
        master - PostgreSQL("slave") << metrics
        grpcsvc >> master

    aggregator = Fluentd("logging")
    aggregator >> Kafka("stream") >> Spark("analytics")

    ingress >> grpcsvc >> aggregator
Beispiel #2
0
    with Cluster("Egress Router Namespace A"):
        haproxy_egressA = Ingress("haproxy")

    #with Cluster("Egress Router Namespace B"):
    #    haproxy_egressB= Ingress("haproxy")

    with Cluster("Namespace A"):
        #POD1 = Pod("frontend")
        PODF = [Pod("frontend"), Pod("frontend"), Pod("frontend")]
        PODB = [Pod("backend"), Pod("backend"), Pod("backend")]
        haproxy_ingressA >> Edge(color="brown") >> Service(
            "frontend") >> PODF >> Service("backend") >> PODB >> SQL(
                "Replica1") >> haproxy_egressA >> serverExtA

    with Cluster("Namespace Metrics"):
        metrics = Prometheus("metric")
        PODF >> metrics << Edge(color="firebrick",
                                style="dashed") << Grafana("monitoring")
    with Cluster("Namespace Logging"):
        PODF >> Fluentd("forwarder") >> Splunk("CentralLogging")

    #with Cluster("Namespace B"):
    #    masterB = Pod("POD 3")
    #    masterB - Pod("POD 4")  >> haproxy_egressB >>  SQL("Replica1") >> serverExtB
    #    haproxy_ingressB >> Edge(color="black") >> masterB

    #aggregator = Fluentd("logging")
    #aggregator >> Edge(label="parse") >> Kafka("stream") >> Edge(color="black", style="bold") >> Spark("analytics")

# haproxy_ingress  >> Edge(color="darkorange")
from diagrams import Cluster, Diagram, Edge
from diagrams.onprem.logging import Fluentd, Loki
from diagrams.elastic.elasticsearch import Logstash, Elasticsearch, Kibana
from diagrams.onprem.search import Solr
from diagrams.onprem.database import Influxdb, Mongodb
from diagrams.onprem.monitoring import Datadog, Grafana, Prometheus, Thanos, Splunk
from diagrams.azure.analytics import LogAnalyticsWorkspaces
from diagrams.aws.management import Cloudwatch

node_attr = {"fontsize": "20"}
graph_attr = {"fontsize": "28"}

with Diagram("", show=False, node_attr=node_attr):
    with Cluster("Logging", graph_attr=graph_attr):
        logstash = Logstash("\nLogstash")
        fluentd = Fluentd("\nFluentd")
        loki = Loki("\nLoki")
        logstash - [fluentd] - loki

    with Cluster("Monitoring", graph_attr=graph_attr):
        prometheus = Prometheus("\nPrometheus")
        thanos = Thanos("\nThanos")
        prometheus - thanos

    with Cluster("Storage", graph_attr=graph_attr):
        with Cluster("Logs", graph_attr=graph_attr):
            elasticsearch = Elasticsearch("\nElasticsearch")
            solr = Solr("\nSolr")
            mongodb = Mongodb("\nMongoDB")
            elasticsearch - solr - mongodb