Ad Widget

Collapse

External Scripts and Problems

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • giltea
    Junior Member
    • Jun 2018
    • 9

    #1

    External Scripts and Problems

    I recently was able to add an external script that pulls data from an external API. The plain text output is shown in the attached screen shot.

    Now my question is, can this data be used to create triggers and problems. If so can you please point me to the correct documentation?

    Thanks!

    [IMG]file:///C:/Users/GIL~1.COM/AppData/Local/Temp/msohtmlclip1/01/clip_image002.gif[/IMG]

    Attached Files
  • kernbug
    Senior Member
    • Feb 2013
    • 330

    #2
    Originally posted by giltea
    I recently was able to add an external script that pulls data from an external API. The plain text output is shown in the attached screen shot.

    Now my question is, can this data be used to create triggers and problems. If so can you please point me to the correct documentation?
    Hi

    In this case it is better to use "External checks": https://www.zabbix.com/documentation...types/external, request exact values with your script from API and push them to the items. For example:

    Host: wan-rig1 Items: Hashrate Below Threshold, Hashrate Calculated, Hashrate Sent, Minutes Since Submit and so on.


    Comment

    • giltea
      Junior Member
      • Jun 2018
      • 9

      #3
      Kernbug, I am going owe you a couple coffee's at this pace. Thanks again!

      Comment

      • giltea
        Junior Member
        • Jun 2018
        • 9

        #4
        Sorry Kernbug, I have another question. Do I need to have separate script for each item, or is there a way to parse the data into the items from a single script file.

        Comment

        • kernbug
          Senior Member
          • Feb 2013
          • 330

          #5
          Originally posted by giltea
          Sorry Kernbug, I have another question. Do I need to have separate script for each item, or is there a way to parse the data into the items from a single script file.
          You can parse args in the script and request items like:
          Code:
          external.script.name[arg1,arg2]
          Documentation for external checks (external script on the server):
          http://www.zabbix.com/documentation/...xternal_checks

          Documentation for user parameters (external script on the client):
          http://www.zabbix.com/documentation/...ser_parameters

          Comment

          • giltea
            Junior Member
            • Jun 2018
            • 9

            #6
            Originally posted by kernbug

            You can parse args in the script and request items like:
            Code:
            external.script.name[arg1,arg2]
            Documentation for external checks (external script on the server):
            http://www.zabbix.com/documentation/...xternal_checks

            Documentation for user parameters (external script on the client):
            http://www.zabbix.com/documentation/...ser_parameters
            Thanks Kernbug, you're help is always appreciated.

            I have been trying various ways to achieve this and have not yet been successful.
            been trying various solutions such as:
            dwarf.py[rig_1_hashrate_below_threshold]
            dwarf.py[${rig_1_hashrate_below_threshold}]
            This still pulls all my data from the original script and I can't find a way to parse into separate items with out separate scripts.

            I have been doing a bit of research and I found something called the zabbix_sender functionality that goes hand in hand with a zabbix trapper item type.

            Is this the route that I should be taking? Or is there some rookie move that I'm making here?

            Comment

            • kernbug
              Senior Member
              • Feb 2013
              • 330

              #7
              Originally posted by giltea

              This still pulls all my data from the original script and I can't find a way to parse into separate items with out separate scripts.

              Is this the route that I should be taking? Or is there some rookie move that I'm making here?
              Hi

              What programming language are you using? Looks like your script does not handle the passed arguments.

              Here is the the example:
              Perl: https://docs.python.org/3.3/library/argparse.html
              Python: https://perlmaven.com/argv-in-perl

              Comment

              • giltea
                Junior Member
                • Jun 2018
                • 9

                #8
                Originally posted by kernbug

                Hi

                What programming language are you using? Looks like your script does not handle the passed arguments.

                Here is the the example:
                Perl: https://docs.python.org/3.3/library/argparse.html
                Python: https://perlmaven.com/argv-in-perl
                Hey Kernbug, I am somewhat confused. I am not looking to pass arguments to the script but rather pass a variable of the output to an item that would be viewed in Zabbix. I should have explained what I was trying to achieve better, after reviewing my previous comments.

                What I am trying to achieve:

                - I have a few mining rigs that are mining etherium coins through a pool called Dwarf pool.
                - I wrote a python script that queries the dwarf pool API and returns key information for monitoring the rigs.
                - I have been able to get the standard output into an HTML format which can be viewed in table format on my dashboard (this is great and almost gets me to where I want to be)
                - I would like to parse the standard output of my script and load them as items. (This is where I am stuck)
                - This will allow me to create visual graphs of the mining statistics and create triggers / alerts when the rigs are no longer mining or have an error.


                I know that this must be achievable just not sure how to get there.....


                Thanks Kernbug.
                Last edited by giltea; 21-06-2018, 17:51.

                Comment

                • kernbug
                  Senior Member
                  • Feb 2013
                  • 330

                  #9
                  Originally posted by giltea
                  I am not looking to pass arguments to the script but rather pass a variable of the output to an item that would be viewed in Zabbix.
                  - I wrote a python script that queries the dwarf pool API and returns key information for monitoring the rigs.
                  - I would like to parse the standard output of my script and load them as items. (This is where I am stuck)
                  Why write the clear text in Zabbix and then process it, if you can immediately put necessary values in Zabbix?
                  One script gets data from rig, depending on args script returns parsed values for items.


                  Comment

                  Working...