Hallo zusammen,
irgendwie bin ich zu doof für regex. Habe mich jetzt schon durch die verschiedensten Seiten gewühlt aber ich blicke da einfach nicht durch. Vielleicht mag mit ja mal jemand helfend zur Seite stehen:
Ich möchte von dieser (http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=statistics&bo_show=station&bo_sid=1738&bo_station_id=49257&lang=de) Seite den Status der Station auslesen. httpmod ist angelegt und liest die Seite auch ein. Bei gesetzten showbody wird mit der Inhalt angezeigt. Die regex wird laut showmatched auch erkannt, liefert aber als Wert nur "1" ins Reading.
Diesen Teil möchte ich auswerten:
Station aktiv: </span><span class="bo_value"><strong>nein</strong>
und das ist die regex die aktuell verwende:
Station aktiv: </span><span class="bo_value"><strong>[A-Za-z]+</strong>
define Blitzortung_GPS HTTPMOD http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=statistics&bo_show=station&bo_sid=1738&bo_station_id=49257&lang=de 10
attr Blitzortung_GPS enforceGoodReadingNames 1
attr Blitzortung_GPS reading01Name Station_aktiv
attr Blitzortung_GPS reading01Regex Station aktiv: </span><span class="bo_value"><strong>[A-Za-z]+</strong>
attr Blitzortung_GPS showBody 0
attr Blitzortung_GPS showError 1
attr Blitzortung_GPS showMatched 1
attr Blitzortung_GPS verbose 5
# BUSY 0
# CFGFN
# DEF http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=statistics&bo_show=station&bo_sid=1738&bo_station_id=49257&lang=de 10
# FUUID 653ba012-f33f-47d8-20e7-a1b5cca5a908135d
# Interval 10
# MainURL http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=statistics&bo_show=station&bo_sid=1738&bo_station_id=49257&lang=de
# ModuleVersion 4.1.16 - 4.4.2023
# NAME Blitzortung_GPS
# NOTIFYDEV global
# NR 4357
# NTFY_ORDER 50-Blitzortung_GPS
# STATE ???
# TYPE HTTPMOD
# eventCount 2032
# value
# CompiledRegexes:
# HTTPCookieHash:
# bo_locale;/:
# Name bo_locale
# Options expires=Fri, 28-Oct-2033 12:03:42 GMT; Max-Age=315360000; path=/
# Path /
# Value de
# HttpUtils:
# NAME
# addr http://www.lightningmaps.org:80
# auth 0
# code 200
# compress 1
# conn
# data
# displayurl http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=statistics&bo_show=station&bo_sid=1738&bo_station_id=49257&lang=de
# header Cookie: bo_locale=de
# host www.lightningmaps.org
# httpheader HTTP/1.1 200 OK
#Server: nginx
#Date: Tue, 31 Oct 2023 13:57:02 GMT
#Content-Type: text/html; charset=UTF-8
#Connection: close
#Vary: Accept-Encoding
#Content-Language: de
#Cache-Control: public, max-age=1
#Pragma:
#Last-Modified: Tue, 31 Oct 2023 13:56:59 GMT
#Expires: Tue, 31 Oct 2023 13:57:01 GMT
#Strict-Transport-Security: max-age=15768000
#Content-Encoding: gzip
#Strict-Transport-Security: max-age=15768000
# httpversion 1.0
# hu_blocking 0
# hu_filecount 1
# hu_port 80
# hu_portSfx
# ignoreredirects 1
# loglevel 4
# path /blitzortung/europe/index.php?bo_page=statistics&bo_show=station&bo_sid=1738&bo_station_id=49257&lang=de
# protocol http
# redirects 0
# timeout 2
# url http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=statistics&bo_show=station&bo_sid=1738&bo_station_id=49257&lang=de
# sslargs:
# OLDREADINGS:
# QUEUE:
# READINGS:
# 2023-10-31 14:37:52 LAST_ERROR read from http://www.lightningmaps.org:80 timed out
# 2023-10-31 14:57:02 LAST_REQUEST update
# 2023-10-31 14:57:02 MATCHED_READINGS Station_aktiv
# 2023-10-31 14:57:02 Station_aktiv 1
# 2023-10-31 14:57:02 UNMATCHED_READINGS
# REQUEST:
# context reading
# data
# header
# ignoreredirects 0
# num unknown
# retryCount 0
# type update
# url http://www.lightningmaps.org/blitzortung/europe/index.php?bo_page=statistics&bo_show=station&bo_sid=1738&bo_station_id=49257&lang=de
# defptr:
# readingBase:
# GPS_Fehler reading
# GPS_Fehler-1 reading
# GPS_Fehler-2 reading
# Station_aktiv reading
# readingNum:
# GPS_Fehler 01
# GPS_Fehler-1 01
# GPS_Fehler-2 01
# Station_aktiv 01
# readingOutdated:
# readingSubNum:
# GPS_Fehler-1 -1
# GPS_Fehler-2 -2
# requestReadings:
# update:
# GPS_Fehler reading 01
# GPS_Fehler-1 reading 01-1
# GPS_Fehler-2 reading 01-2
# Station_aktiv reading 01
# hmccu:
#
setstate Blitzortung_GPS 2023-10-31 14:37:52 LAST_ERROR read from http://www.lightningmaps.org:80 timed out
setstate Blitzortung_GPS 2023-10-31 14:57:02 LAST_REQUEST update
setstate Blitzortung_GPS 2023-10-31 14:57:02 MATCHED_READINGS Station_aktiv
setstate Blitzortung_GPS 2023-10-31 14:57:02 Station_aktiv 1
setstate Blitzortung_GPS 2023-10-31 14:57:02 UNMATCHED_READINGS
Es wäre nett wenn mir da mal jemand hilfreich unter die Arme greifen könnte.
LG
Jörg
@Jörg
Die 1 bedeutet, dass dein regex etwas gefunden hat. Alles, was du in Klammern setzt, wird dir als Text zurückgegeben.
einfache Variante:
attr Blitzortung_GPS reading01Regex Station aktiv: </span><span class="bo_value"><strong>([A-Za-z]+)</strong>
Gruß Jens
@Jems
Besten Dank. Ich sag ja ich bin zu doof dafür. ;D