Ad Widget

Collapse

Item LLD / Auto-Discovery with Zabbix Trapper

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mitchie_moe
    Junior Member
    • Jul 2020
    • 4

    #1

    Item LLD / Auto-Discovery with Zabbix Trapper

    hi everyone,

    i'm using zabbix for monitoring a SIP-network.
    inputfiles (XML) are generated by the network elements every 5 minutes.
    they get parsed/preprocessed with a perl-script in order to generate an outputfile that /usr/bin/zabbix_sender can read.
    hosts and items are manually preconfigured.

    as an example, this is the way that the outputfile looks like:

    HostABC SipRejectCause400 1594911600 0
    HostABC SipRejectCause403 1594911600 14
    HostABC SipRejectCause404 1594911600 55
    HostABC SipRejectCause421 1594911600 0
    HostABC SipRejectCause500 1594911600 9
    HostABC SipRejectCause503 1594911600 19


    all those items are preconfiured, as mentioned before.
    i would like to add a "Discovery Rule" to my template to automatically add another item if the XML contains an item that is not preconfigured, like this:

    HostABC SipRejectCause499 1594911600 86

    the name and the key of the new item shall be "SipRejectCause499".
    what do i have to put into the name- and key- field of the discovery-rule? $_ ? $1 ?
    is it possible at all?

    thanks, michael
  • mitchie_moe
    Junior Member
    • Jul 2020
    • 4

    #2
    this is my setup at the moment:


    Click image for larger version

Name:	1.png
Views:	2391
Size:	9.1 KB
ID:	405389

    Click image for larger version

Name:	2.png
Views:	2426
Size:	14.3 KB
ID:	405390

    zabbix_sender -z localhost -s "zabbix_script" -k newkey -o '{"data":[{"{#KEYNAME}":"SipRejectCause499"}]}'
    Response from "localhost:10051": "processed: 1; failed: 0; total: 1; seconds spent: 0.000236"


    will result in:

    Click image for larger version

Name:	3.png
Views:	2406
Size:	6.8 KB
ID:	405391

    so the name is perfect, but i would like to get rid of: " key[ ] " to archive something like this:


    Click image for larger version

Name:	4.png
Views:	2398
Size:	4.9 KB
ID:	405392

    is there any chance i can solve this with the discovery-function?

    Attached Files

    Comment

    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #3
      What happens if you change your Item Prototype so that instead of Key: key[{#KEYNAME}] you instead try Key: {#KEYNAME}

      ?

      Does that accomplish what you want?

      Comment

      • mitchie_moe
        Junior Member
        • Jul 2020
        • 4

        #4
        hi tim,
        thanks for your suggestion. unfortunatly it's not working, incorrect syntax:

        Click image for larger version

Name:	5.png
Views:	2312
Size:	6.5 KB
ID:	405414
        i have tried
        {#KEYNAME}
        [{#KEYNAME}]
        [#KEYNAME]


        all with the same result.

        Comment

        • Hamardaban
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • May 2019
          • 2713

          #5
          To get what you want (as in pictures) in field “key“ in item prototype just use lld macro {#KEYNAME}.

          Comment

          • mitchie_moe
            Junior Member
            • Jul 2020
            • 4

            #6
            Originally posted by Hamardaban
            To get what you want (as in pictures) in field “key“ in item prototype just use lld macro {#KEYNAME}.
            thanks hamardaban, but this "value" is not accepted, as you can see in post #4. or did you mean something different?
            this is the config which will lead to the error in post #4:

            Click image for larger version

Name:	6.png
Views:	2314
Size:	7.5 KB
ID:	405473

            btw, i am using Zabbix 4.4.5. on a RedHat OS

            Comment

            • Hamardaban
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • May 2019
              • 2713

              #7
              I saw that you tried to use the proposed syntax and wrote that it is correct, and not some other.
              Try do not use $1 as the name of the data item prototype. Specify the macro and some text explicitly.

              Comment

              Working...