K8s Applications mit MicroK8S auf Raspberry PI. Alfred Sabitzer. Читать онлайн. Newlib. NEWLIB.NET

Автор: Alfred Sabitzer
Издательство: Bookwire
Серия:
Жанр произведения: Математика
Год издания: 0
isbn: 9783742770134
Скачать книгу
File <filename> an, und ersetzt gewisse Schlüsselwörter durch konkreten Text. In unserem Beispiel habe ich das File hello.html mit OpenOffice vorbereitet.

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

      <html>

      <head>

       <meta http-equiv="content-type" content="text/html; charset=utf-8"/>

       <title></title>

       <meta name="generator" content="LibreOffice 7.1.6.2 (Linux)"/>

       <meta name="author" content="Alfred Sabitzer"/>

       <meta name="created" content="2021-10-07T16:33:50.696105947"/>

       <meta name="changedby" content="Alfred Sabitzer"/>

       <meta name="changed" content="2021-10-07T16:36:08.816466992"/>

       <style type="text/css">

       @page { size: 21cm 29.7cm; margin: 2cm }

       p { margin-bottom: 0.25cm; line-height: 115%; background: transparent }

       td p { orphans: 0; widows: 0; background: transparent }

       </style>

      </head>

      <body lang="de-AT" link="#000080" vlink="#800000" dir="ltr"><p style="margin-bottom: 0cm; line-height: 100%">

      <p style="margin-bottom: 0cm; line-height: 100%"><br/>

      </p>

      <table width="100%" cellpadding="4" cellspacing="0">

       <col width="64*"/>

       <col width="64*"/>

       <col width="64*"/>

       <col width="64*"/>

       <tr valign="top">

       <td width="25%" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p>

       OSENVIRONMENT</p>

       </td>

       <td width="25%" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p>

       DISKUSAGE</p>

       </td>

       <td width="25%" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p>

       HOSTINFO</p>

       </td>

       <td width="25%" style="border: 1px solid #000000; padding: 0.1cm"><p>

       MEMINFO</p>

       </td>

       </tr>

       <tr valign="top">

       <td width="25%" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p>

       %OSENVIRONMENT%

       </p>

       </td>

       <td width="25%" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p>

       %DISKUSAGE%

       </p>

       </td>

       <td width="25%" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p>

       %HOSTINFO%</p>

       </td>

       <td width="25%" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm"><p>

       %MEMINFO%</p>

       </td>

       </tr>

       </table>

      <p style="margin-bottom: 0cm; line-height: 100%"><br/>

      </p>

      <p style="margin-bottom: 0cm; line-height: 100%">Es ist <span style="background: #c0c0c0"><sdfield type=DATETIME sdval="44476,6908896088" sdnum="3079;3079;T. MMMM JJJJ">%SYSTIME%</sdfield></span></p>

      </body>

      </html>

      Nun kompilieren wir das File.

      alfred@monitoring:~/GetInfo$ go build GetInfo.go

      go: downloading github.com/shirou/gopsutil v3.21.9+incompatible

      go: extracting github.com/shirou/gopsutil v3.21.9+incompatible

      go: downloading golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac

      go: extracting golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac

      go: finding github.com/shirou/gopsutil v3.21.9+incompatible

      go: finding golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac

      alfred@monitoring:~/GetInfo$ ll

      total 7716

      drwxrwxr-x 2 alfred alfred 4096 Oct 15 20:30 ./

      drwxr-xr-x 22 alfred alfred 4096 Oct 11 07:30 ../

      -rwxrwxr-x 1 alfred alfred 8009715 Oct 15 20:30 GetInfo*

      -rw------- 1 alfred alfred 4473 Oct 10 21:34 GetInfo.go

      -rw------- 1 alfred alfred 81 Oct 10 21:48 dockerfile

      -rw------- 1 alfred alfred 1434 Oct 10 21:19 error.html

      -rw-rw-r-- 1 alfred alfred 0 Oct 11 07:28 getinfo.tar

      -rw------- 1 alfred alfred 263 Oct 10 10:04 go.mod

      -rw------- 1 alfred alfred 1314 Oct 10 10:04 go.sum

      -rw------- 1 alfred alfred 3180 Oct 10 21:32 hello.html

      alfred@monitoring:~/GetInfo$ ./GetInfo

      Ein kurzer Test auf http://monitoring:8080/view/hello ergibt

      OEBPS/images/image0022.jpg Abbildung 20: GetInfo Ausgabe

      Das heist das Programm funktioniert. Die Logausgabe sieht aus wie folgt:

      alfred@monitoring:~/GetInfo$ ./GetInfo

      2021/10/10 21:42:01 Main Started

      2021/10/10 21:42:16 hello.html

      ^C

      alfred@monitoring:~/GetInfo$

      Jetzt brauchen wir noch ein Docker-File

      alfred@monitoring:~/GetInfo$ cat dockerfile

      # syntax=docker/dockerfile:1

      #