ZABBIX Forums  
  #1  
Old 07-05-2012, 20:39
MikeJ1234 MikeJ1234 is offline
Junior Member
 
Join Date: Jan 2012
Posts: 7
Default 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
Reply With Quote
  #2  
Old 07-05-2012, 23:48
eskytthe eskytthe is offline
Senior Member
Zabbix Certified Specialist
 
Join Date: May 2011
Location: Denmark
Posts: 348
Default

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
Reply With Quote
  #3  
Old 08-05-2012, 13:34
MikeJ1234 MikeJ1234 is offline
Junior Member
 
Join Date: Jan 2012
Posts: 7
Default

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
Reply With Quote
  #4  
Old 08-05-2012, 14:40
MikeJ1234 MikeJ1234 is offline
Junior Member
 
Join Date: Jan 2012
Posts: 7
Default

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.
Reply With Quote
  #5  
Old 08-05-2012, 20:08
MikeJ1234 MikeJ1234 is offline
Junior Member
 
Join Date: Jan 2012
Posts: 7
Default

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
Reply With Quote
  #6  
Old 09-05-2012, 22:43
eskytthe eskytthe is offline
Senior Member
Zabbix Certified Specialist
 
Join Date: May 2011
Location: Denmark
Posts: 348
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:31.