Announcement

Collapse
No announcement yet.

Creating a custom graph?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Creating a custom graph?

    Hello,

    Can someone point me in the right direction for creating a custom graph?

    Here's my scenario.

    I have one linux server running the SOLR indexing service. I can view the number of indexed records easily by running this command in a browser:

    Code:
    http://MySolrHost:8080/solr/select?q=*%3A*&start=0&rows=0
    It returns something like this:

    Code:
    <response>
    <lst name="responseHeader">
    <int name="status">0</int>
    <int name="QTime">1</int>
    <lst name="params">
    <str name="start">0</str>
    <str name="q">*:*</str>
    <str name="rows">0</str>
    </lst>
    </lst>
    <result name="response" numFound="1547" start="0"/>
    </response>
    This works nicely because I can see the value is 1547.

    To get only the value I want (without the XML output) I can run this:

    Code:
    /usr/bin/curl -v "http://MySolrHost:8080/solr/select?q=*%3A*&start=0&rows=0" 2>&1| sed -n  "s/.*numFound=\"//;s/\" start=.*//p"
    So what I would like to do is have Zabbix run the above command every minute and graph the values accordingly.

    What's the best approach for this (graphing a numeric value based on a CURL command). Can someone point me in the right direction - perhaps a previous post somewhere?

    Any help is greatly appreciated!
    Mike

    #2
    You can use user parameters:
    http://www.zabbix.com/documentation/...userparameters
    You can access a graph of you item(s) (data) in the GUI ( Monitor -> Last Data)
    And you can put this graph in a screen (simple graph).
    Br
    Erik

    Comment


      #3
      Thanks for your help on this.

      Can you confirm if I've done this correctly?

      Here's my zabbix_agentd.conf on my SOLR server (only the uncommented lines):

      Code:
      LogFile=/tmp/zabbix_agentd.log
      EnableRemoteCommands=1
      Server=MyZabbixServer
      Hostname=MySolrHost
      UserParameter=system.run,curl -v "http://MySolrHost:8080/solr/select?q=*%3A*&start=0&rows=0" 2>&1 | sed -n  "s/.*numFound=\"//;s/\" start=.*//p"
      And then I have this as the 'key' field for the item I created:

      Code:
      system.run[/usr/bin/curl -v "http://MySolrHost:8080/solr/select?q=*%3A*&start=0&rows=0" 2>&1 | sed -n  "s/.*numFound=\"//;s/\" start=.*//p"]
      I'm not sure about the key (if it should be system.run).

      I have specified the above information in my config but I'm not seeing the expected results in the graph.

      Thanks for your time.

      Mike

      Comment


        #4
        More information. It says the /usr/bin/curl -v .... command "became not supported: Not supported by Zabbix Agent"

        I found this information in the log file of the server.

        Comment


          #5
          I was able to correct this issue.

          The problem was that even though I was restarting the agent on the SOLR server, it wasn't actually removing the old pid in /tmp. I had to manually kill the agent using:

          killall -9 zabbix_agentd

          then restart it manually.

          After i did this, the agent reread the config file and the expected command ran.

          Thanks,
          Mike

          Comment


            #6
            Yes fine - you corrected it self!
            The key can be what ever you like - just it is the same at agent side (conf file) and server side (item).
            Br
            Erik

            Comment

            Working...
            X