Ad Widget

Collapse

Loading External Data Into Zabbix

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

    #1

    Loading External Data Into Zabbix

    New to Zabbix here, been searching around and I cannot seem to find out how I would request data from an external servers (not owned by us) API and parse the data back into Zabbix for monitoring purposes.

    I have a feeling it has something to do with the scripts functionality under the Administrator tab but when I go to write my python script there, it only gives me about 8 lines to write my code, this isn't enough.

    Can someone please point me to some documentation or something else that will get me back on track?

  • kernbug
    Senior Member
    • Feb 2013
    • 330

    #2
    Hi,

    If I understood you correctly start from here https://www.zabbix.com/documentation...types/external

    Steps:
    1. Write your python script, check it with sudo -H -u zabbix -c "/your/script/path/script.py";
    2. Put it to 'ExternalScripts' directory of the Zabbix server, with the zabbix owner and group;
    3. Add script path under Administration tab;
    3. Make items in web interface as described in the manual.

    Feel free to ask additional questions.

    Comment


    • giltea
      giltea commented
      Editing a comment
      Thanks Kernbug, I have added the script to the appropriate folder and added the script under the administration tab. I'm somewhat stuck at this point.

      I assume that I would need to add this external host somehow but it's not on our LAN.

      I was looking at the documentation and tried to add the URL to my dashboard but it's indicating no host has been selected. Do I need to add the external host? Can I do this by IP?
  • kernbug
    Senior Member
    • Feb 2013
    • 330

    #3
    Hello, giltea

    Now you need to add host to zabbix frontend, you can leave host IP "dummy" (127.0.0.1) (because you have all of the necessary logic in your script):
    More information about the host: https://www.zabbix.com/documentation...fig/hosts/host
    and items: https://www.zabbix.com/documentation...fig/items/item
    and external checks: https://www.zabbix.com/documentation...types/external

    Comment

    • giltea
      Junior Member
      • Jun 2018
      • 9

      #4
      Thanks Kernbug, I appreciate your patience and directing me to the appropriate resources. Systems Admin is not really my thing, as you probably have noted.

      I have followed the docs and setup my host, item, and script as indicated. My script is in the external scripts folders, with the owner and group as Zabbix, permissions set to 775.

      I'm at least getting an error message now (shown below):

      Received empty response from Zabbix Agent at [127.0.0.1]. Assuming that agent dropped connection because of access permissions.

      I did a little research and found some really old posts mentions zabbix_agentd.conf needs to include 127.0.0.1 and the default should be "Zabbix Server". Is this the case?

      I have also attached screen shots of my setup. Sorry for all the rookie questions, I do really appreciate the help.
      Attached Files

      Comment

      • giltea
        Junior Member
        • Jun 2018
        • 9

        #5
        By Golly, I got it! Below are the steps I went through to achieve this goal

        Notes:
        • Zabbix:
          • I finally figured out how to pull external data into Zabbix. Below is the process on how to do so.
            1. Place the script on Zabbix Server in /etc/Zabbix/externalscripts/
            2. Change the owner and group to “zabbix” and ensure the script permissions allow for execution.
            3. Go to the front end of the Zabbix web GUI and navigate to the Administration -> scripts tab and select create new script. See screen shot below for setup details
        1. Navigate to the Configuration tab and select “Hosts”. Choose to create a host.
        2. Create a dummy host has shown in the screen shot below:
        3. Once that has been added, from the Hosts page select the item hyper link on row of the host you just setup.
        4. Create the item accordingly (as shown below):
        5. Navigate to the monitoring tab and select latest data. If the script pulled correctly the data will be listed there.








        Attached Files

        Comment

        Working...