Ad Widget

Collapse

ZabCon or API help needed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • qix
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2006
    • 423

    #1

    ZabCon or API help needed

    Hi all,

    First of all, I'm not a programmer, but I can build descent Bash scripts if I need to
    I'm trying to figure out how to do the following.

    I'd like to be able to type a command on the zabbix server command line that will return a tab,space or semicolon separated list of data that I can parse through sed, grep and al the other cool GNU tools.
    I would like this data to be a representation of the active triggers screen, preferably without the acknowledged triggers.

    What command would I need to use on Zabcon to get this out of the API?
    All the commands I input, give me lists with reference ID's that don't really mean anything to me. I couldn't really find a command that will let me do a SQL join like operation on the ID's either.

    Is this possible? Or should I just create a SQL statement that'll return the wanted data and input that in mysql client?

    Thanks,
    With kind regards,

    Raymond
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    I need to add a feature like that for Zabcon, however you can use the data as it is now by usingthe | character as your delimiter. Also there are 3 lines at the top for the header and one at the bottom.

    I have added the following ticket. If you want you can add yourself as a follower on the ticket and you will get an email when it is added. I'll try to get it done in the next day or two.
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • fmrapid
      Member
      • Aug 2010
      • 43

      #3
      nelsonab,

      That is fabulous. Viva the API and zabcon.

      I look forward to this functionality.

      I expect the same principle would apply for other data values to be extracted.

      Cheers,

      fmrapid

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        Originally posted by nelsonab
        I have added the following ticket.
        where ?
        Zabbix 3.0 Network Monitoring book

        Comment

        • nelsonab
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Sep 2006
          • 1233

          #5
          LOL... ya a link would help... :-)

          RHCE, author of zbxapi
          Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
          Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

          Comment

          • qix
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2006
            • 423

            #6
            Hi Nelsonlab,

            Thanks for your response.
            How do I add myself to the ticket? I coudn't find a signup form or the like either.... Must be blind or something.

            Thnx!
            With kind regards,

            Raymond

            Comment

            • nelsonab
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Sep 2006
              • 1233

              #7
              :-) I guess I've done a good job of locking things down due to spam. :-)

              If you want you can send me a message privately, and I can add you or just watch this thread as I will update when I'm done.
              RHCE, author of zbxapi
              Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
              Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

              Comment

              • nelsonab
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • Sep 2006
                • 1233

                #8
                Ok ticket closed, revision 248 has the changes needed. I have not updated the tarball yet.

                If you execute Zabcon as part of a script you will not see any of the table or header information as before.

                Code:
                echo "get user" | zabcon -l
                
                userid,alias
                3,apitest
                If you wish to change the separator character use the -s option. If your separator involves spaces enclose the option with quotes, for instance

                Code:
                echo "get user" | zabcon -l -s ", "
                
                userid, alias
                3, apitest
                If you do not wish to see the header use the --no-header option

                Code:
                echo "get user" | zabcon -l --no-header
                
                3,apitest
                If you have any other needs or questions, just ask. :-)
                RHCE, author of zbxapi
                Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
                Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

                Comment

                • richlv
                  Senior Member
                  Zabbix Certified Trainer
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Oct 2005
                  • 3112

                  #9
                  Originally posted by nelsonab
                  If you execute Zabcon as part of a script you will not see any of the table or header information as before.
                  ooooh, very neat. makes scripting much easier
                  Zabbix 3.0 Network Monitoring book

                  Comment

                  Working...