Ad Widget

Collapse

Regular Expression gesucht: Temperatur mit . als numeric value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whisky17
    Junior Member
    • Dec 2017
    • 14

    #1

    Regular Expression gesucht: Temperatur mit . als numeric value

    Hallo,
    ich stehe gerade total auf dem Schlauch und brauche mal eure Hilfe:
    ich bekomme für ein Item eine Temperatur übergeben mit Vorzeichen (+/-) und Wert (dezimal, getrennt mit Punkt ".")
    Nun möchte ich diesen Wert in Zabbix gerne als Numeric führen. Ich dachte mir: ich verwandele einfach den Punkt in ein Komma mit Preprocessing und RegEx. Hab ich zwar noch nie gemacht, kann ja aber nicht so schwer sein. Dachte ich...

    Als Input:
    Code:
    (s/.+/,/\.)
    Und als Output:
    Code:
    \1
    Ich bekomme aber die Fehlermeldung zurück:
    cannot perform regular expression "(s/.+/,/\.)" match for value of type "string": pattern does not match
    Peinlich, ich scheitere hier an Standard-Szenarien. Was mache ich falsch?
    Viele Grüße
    whisky17
  • Zdenek_OMNISENSUIT
    Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Nov 2020
    • 55

    #2
    Hello

    At first your item type of information should be Numeric(float).
    Change of , and . you can make with Preprocessing (just use Replace instead of RegExpr) or with UserParameter on zabbix agent side befor sending to zabbix (for example cleaning/set the output ... | tr -d " \t\n\r" | tr ',' '.' ).

    -------------------------
    omnisensuit.com

    Comment

    • whisky17
      Junior Member
      • Dec 2017
      • 14

      #3
      Oh... You can't see the wood for the trees :-o
      It's a very good idea to just use the simple replacement. I didn't know the option adapting it in the agent itself, but I'll take a closer look at this setting.

      Thank you very much!

      Comment

      Working...