Fórum Root.cz

Hlavní témata => Server => Téma založeno: czechsys 30. 06. 2022, 14:02:27

Název: Zabbix 6 preprocessing regulary
Přispěvatel: czechsys 30. 06. 2022, 14:02:27
Ahoj,

mam tenhle vystup z prometheus-postfix-exporter via web.page.get v zabbixu:
Kód: [Vybrat]
HTTP/1.1 200 OK

Connection: close

# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0.000197284
go_gc_duration_seconds{quantile="0.25"} 0.001007571
go_gc_duration_seconds{quantile="0.5"} 0.00133696
go_gc_duration_seconds{quantile="0.75"} 0.001480352
# HELP postfix_qmgr_messages_removed_total Total number of messages removed from mail queues.
# TYPE postfix_qmgr_messages_removed_total counter
postfix_qmgr_messages_removed_total 0
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 59
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0


0

Nelze bohuzel vzit pouze body odpovedi (volam to pres zabbix-agent2, ne pres HTTP agent), takze pro dalsi zpracovani se z toho snazim dostat 2 zpusoby, abych to pak mohl prevest do json:
1] "komplet" - vytahnuti body
1. regex - parametr: (\#[\s\S]*)   \1
2. regex - parametr ^[\s\S]*?(?=\n{2,})   \0
-> v preprocess testu to funguje, orizne to zacatek i konec, ale pri samotnem volani zabbixem to hlasi chybu pri 2. regexu
Kód: [Vybrat]
266951:20220630:135630.589 item "host.example.com:web.page.get[{$PROMETHEUS_EXPORTER_HOST},{$PROMETHEUS_EXPORTER_URL},{$PROMETHEUS_EXPORTER_PORT}]" became not supported: Preprocessing failed for: HTTP/1.1 200 OK..Connection: close..Transfer-Encoding: chunked..Content-Type: text/plain; version...
1. Result: # HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles..# TYP...
2. Failed: cannot perform regular expression "^[\s\S]*?(?=\n{2,})" match for value of type "string": pattern does not match
-> pokud odstranim druhy krok, chybuje to na prvnim prazdnem radku po metrikach

2] "postfix only" - vytahnuti vsech radku obsahujici postfix_:
1. regex - parametr: ^(.*postfix_.*)$   \1
-> tentokrat chyba jiz pri testovani:
Kód: [Vybrat]
cannot perform regular expression "^(.*postfix_.*)$" match for value of type "string": pattern does not match

Nejaky napad?
Diky
Název: Re:Zabbix 6 preprocessing regulary
Přispěvatel: ivoszz 01. 07. 2022, 13:00:48
 https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/prometheus (https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/prometheus)
Název: Re:Zabbix 6 preprocessing regulary
Přispěvatel: czechsys 01. 07. 2022, 13:52:03
https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/prometheus (https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/prometheus)

To je ale az nasledny krok, nejdrive potrebuju vycistit prijata data.