Zum Inhalt springen
  • Von: DOAG online
  • RedStack Zeitschriften Business News
  • 26.06.2020

Die Red Stack 04/2020 ist online: "DevOps"

Die Ausgabe 04/2020 des Red Stack Magazin inklusive Business News steht nun zum Download bereit!

Die Schwerpunkte der aktuellen Red Stack inklusive Business News sind das spannende Thema DevOps und smarte Applikationen der Industrie 4.0. Erfahren Sie beispielsweise im Artikel von Dennis Hoffmann, wie CI/CD mit Flexibilität und Agilität im Zusammenhang stehen.

Viel Spaß beim Lesen.

Zum Download!

 

  • „Der primäre Treiber der Umsetzung der definierten Vision sind dann vor allem die Menschen, erst danach kommen die zu definierenden Prozesse und anschließend die Technologie.“, Interview mit Markus Peppler
  • Culture First – Relevanz der DevOps-Kultur und ein Ansatz für eine nachhaltige Einführung,
    Carsten Wiesbaum & Kevin Steinhagen
  • CI/CD: Theorie meets Praxis, Dennis Hoffmann
  • Monitoring mit Prometheus, Markus Bente & Michael Mühlbeyer
  • DevOps in Open Source, Wolfgang Nast
  • DevSecOps aber sicher! Kontinuierlich sicherer entwickeln, Frank Pientka
  • Cyber-Defense mit und in der Oracle Cloud, Michael Fischer
  • Oracle Database Indexing Best Practices – Teil 1, Randolf Geist
  • Systematisches Oracle Performance Tuning mit kostenlosen 3rd Party Tools, Stefan Koehler
  • Analyse von ortsbezogenen Daten in der Oracle DB, Karin Patenge
  • Hybrid Data Guard mit der OCI, Thomas Rein
  • Benchmarking Oracle Cloud Services, Manfred Drozd
  • Schnittstellenbündelung mit GraphQL, Philipp Hartenfeller
  • Benachteiligung von Bestandskunden beim Support, DOAG-Redaktion
  • Björn Bröhl ist neuer Vorstandsvorsitzender der DOAG, DOAG-Redaktion
  • Smarte Technologien in der Social Networked Industry, Dietmar Ebel & Lorenz Kiebler
  • Die Bedeutung von Plattformen im IoT-Umfeld, Norbert Gronau & Benedict Bender
  • "Vorpreschen und neue Dinge ausprobieren.", Christian Luda sprach mit Dr. Matthias Peissner
  • Smarte Anlagenüberwachung für die Industrie 4.0, Daniel Silter
  • Vom Sensor zum Prozess, Falk Wolsky

 

Hier finden Sie im Magazin erwähnte Listings:

Markus Bente und Michael Mühlbeyer 
"Monitoring mit Prometheus"

 

global:

    smtp_smarthost: 'yoursmtp.yourdomain:25';

    smtp_from: 'info@yourdomain'

    smtp_require_tls: true

    smtp_auth_username: 'xxx'

    smtp_auth_password: 'zzz'

route:

    group_by: [job, instance]

    group_wait: 10s

    group_interval: 10s

    receiver: 'mymon'

receivers:

    - name: 'mymon'

      email_configs:

       - to: 'monitor@byom.de'

          html: null

Listing 1: Alertmanager Empfänger-Konfiguration
---

drwxr-xr-x. 2 3434 3434 38 Feb 14 02:52 console_libraries

drwxr-xr-x. 2 3434 3434 173 Feb 14 02:52 consoles

-rw-r--r--. 1 3434 3434 11357 Feb 14 02:52 LICENSE

-rw-r--r--. 1 3434 3434 3184 Feb 14 02:52 NOTICE

-rwxr-xr-x. 1 3434 3434 82329106 Feb 14 00:52 prometheus

-rw-r--r--. 1 3434 3434 926 Feb 14 02:52 prometheus.yml

-rwxr-xr-x. 1 3434 3434 48417809 Feb 14 00:54 promtool

-rwxr-xr-x. 1 3434 3434 13595766 Feb 14 00:54 tsdbINDENTIFIED

Listing 2: Prometheus Home
---

global:

   scrape_interval:   10s  

   evaluation_interval:   10s  

rule_files:

   - alert.rules.yml

alerting:

   alertmanagers:

   - static_configs:

     - targets:

        - alertmanager:9093

scrape_configs:

      - job_name: 'prometheus'

        static_configs:

         - targets: ['localhost:9090']

       - job_name: 'blackbox'

        metrics_path: /probe

        params:

         module: [http_2xx] # Look for a HTTP 200 response.

        static_configs:

      - targets:

       ; - google.de

        relabel_configs:

          - source_labels: [__address__]

            target_label: __param_target

          - source_labels: [__param_target]

            target_label: instance

          - target_label: __address__

            replacement: blackbox:9115 #blackbox exporter's real

hostname:port<hostname:port<></hostname:port<>

Listing 3: prometheus.yml
---

./prometheus –help

[…]

--config.file="prometheus.yml"

--web.listen-address="0.0.0.0:9090"

--storage.tsdb.path="data/"

[…]

Listing 4: Prometheus-Executable-Hilfe
---

networks:

   monitor-net:

      driver: bridge

 

services:

 

   prometheus:

      build:

           context: .

           dockerfile: prometheus

      restart: unless-stopped

      expose:

         - 9090

      networks:

         - monitor-net

      ports:

         - "9090:9090"

   alertmanager:

         build:

             context: .

             dockerfile: alert_manager

         restart: unless-stopped

         expose:

          - 9093

         ports:

         - "9093:9093"

         networks:

         - monitor-net

   blackboxexporter:

      build:

          context: .

          dockerfile: blackbox_exporter

      expose:

      - 9115

      networks:

      - monitor-net

      ports:

      - "9115:9115"

Listing 5: Prometheus und Docker
---

FROM prom/prometheus

ADD prometheus.yml /etc/prometheus/prometheus.yml

ADD alert.rules.yml /etc/prometheus/alert.rules.yml;

Listing 6: Dockerfile
---

Environment=KAFKA_OPTS=-

javaagent:/apps/jmx_prometheus_javaagent-

0.12.0.jar=9096:/apps/kafkamon/jmx_config_zookeeper.yml

Listing 7: Systemd-Anpassung
---

lowercaseOutputName: true

 

rules:

- pattern: java.lang<type=(garbagecollector),<> </type=(garbagecollector),<>

name=(.+)><LastGcInfo>duration

   name: java_zookeeper_$1_duration

   labels:

      GCType: "$2"

 

- pattern:

"org.apache.ZooKeeperService<name0=replicatedserver_id(\\d+),<> </name0=replicatedserver_id(\\d+),<>

name1=replica.(\\d+), name2=(\\w+)><>(\\w+)"

   name: "zookeeper_$4"

   labels:

      replicaId: "$2"

      memberType: "$3"

Listing 8: jmx_config_zookeeper.yml
---

/apps/confluent-5.2.2/bin/kafka-consumer-groups --bootstrap-

server $bootstrap --group $consumergruppe --describe >

/apps/tmp_rep.txt

 

input="/apps/tmp_rep.txt"

 

while IFS= read -r line; do

    awk -v inf='-Inf' '{ if ($5 == "LAG") done; else if ($5 ==

"-") print

"MirorMaker_Consumer_Lag{consumer_id=\""$6"\",topic=\""$1"\",

partiton=\""$2"\"} " inf; else print

"MirorMaker_Consumer_Lag{consumer_id=\""$6"\",topic=\""$1"\",

partiton=\""$2"\"} " $5}'> /apps/kafkamon/node_exporter_textfile/Replication_Lag.prom;

done < "$input"

Listing 9: Offset-Replication-Skript
---

- alert: InternalReplication

    expr: sum(kafka_server_replicafetchermanager_maxlag) by

(job) > 50

     for: 1m

     labels:

       severity: "critical"

     annotations:

       summary: "Internal Replication for Cluster {{

$labels.cluster }} is to high"

 

- alert: under_min_isr

     expr: kafka_cluster_partition_underminisr > 0

     labels:

       severity: "critical"

     annotations:

       summary: "Following Topic {{ $labels.topic }} at

partition {{ $labels.partition }} on {{ $labels.cluster }} is

under min insync replicas"

Listing 10: Beispiel Alert Rules
---

create or replace NONEDITIONABLE procedure prometheus_metrics

IS

--

 

==============================================================

 

-- Procedure prometheus_metrics

--

[…]

   cursor c_version is

        select 'Oracle' as oracle, substr(version_full,

1,2)||'.'|| substr(version_full, 4,1) as value from

v$instance;

   --

 

--

[…]

end;

/

Listing 11: Procedure Prometheus Teil 1
---

[…]

begin

owa.num_cgi_vars := 0;

htp.init();

--

-- Oracle Version

--

      htp.print('# HELP oracle_version Oracle DB Version

Number');

      htp.print('# TYPE oracle_version counter');

      for rec_version in c_version loop

           htp.print('oracle_version ' || rec_version.value);

      end loop;

[…]

Listing 12: Procedure Prometheus Teil 2
---

[oracle@prometheus ords-19.4]$ java -jar ords.war setup --

database prometheus_metrics

Specify the database connection type to use.

# Choose Option 1 for a Basic Connection String

Enter number for [1] Basic [2] TNS [3] Custom URL [1]:1

# Provide the Servername of your Database Server Host

Enter the name of the database server [localhost]:prometheus

# Provide the Listener Port or confirm the default value with

1521

Enter the database listen port [1521]:

# If you are using Database Service Names, choose Option 1

Enter 1 to specify the database service name, or 2 to specify

the database SID [1]:

# Provide the Database Service Name

Enter the database service name:DB193

# Choose Option 2

Enter 1 if you want to verify/install Oracle REST Data

Services schema or 2 to skip this step [1]:2

# Confirm the default Option 1

Enter 1 if you want to use PL/SQL Gateway or 2 to skip this

step.

If using Oracle Application Express or migrating from

mod_plsql then you must enter 1 [1]:

# Provide the Database User, in my case dbsnmp

Enter the PL/SQL Gateway database user name

[APEX_PUBLIC_USER]:dbsnmp

# Provide 2 times the password of the above provided Database

User

Enter the database password for dbsnmp:

Confirm password:

# Choose Option 3

Enter a number to select a feature to enable [1] SQL Developer

Web [2] REST Enabled SQL [3] None [1]:3

2020-03-02T08:37:46.632Z INFO reloaded pools: [|apex||,

prometheus_metrics||]

Listing 13: ORDS Datenbank-Konfiguration
---

[...]

scrape_configs:

[...]

    - job_name: 'oracle_db'

       scrape_interval: 10s

       scrape_timeout: 5s

       metrics_path: /ords/prometheus_metrics/PROMETHEUS_METRICS

       static_configs:

         - targets: ['172.17.0.1:7778']

[...]

Listing 14: Oracle DB scrape-Konfiguration
---