Skip navigation
4001 Views 14 Replies Latest reply: Mar 5, 2012 2:51 PM by Shane Scott RSS
xlancealot Rank: White Belt 69 posts since
May 13, 2010
Currently Being Moderated

Mar 1, 2012 10:11 AM

Graph results of a shell script

Guess that explains it       I have the mysql tools installed getting a lot of info, but don't have the connection / thread count.  Grants are allowed for zenoss, so on that box I would like the folllowing;

 

Create a graph and simply use the command; mysqladmin -h $server processlist |grep -v 'show processlist' | wc -l

 

That will return the value, and just go from there.   I'm not sure on the variable, but I can find that, it's something like $manageIP or something but the above is the most important.


Tnx

  • dpetzel Rank: Brown Belt 1,141 posts since
    Oct 17, 2010
    Currently Being Moderated
    1. Mar 1, 2012 8:41 PM (in response to xlancealot)
    Re: Graph results of a shell script

    Your talking about a "command datasource" The admin guide covers them a bit. Basically you'll probably want to wrap the command in a small shell that takes the output and returns it in nagios plugin format.

  • themactech Rank: Brown Belt 537 posts since
    Apr 13, 2009
    Currently Being Moderated
    4. Mar 2, 2012 10:53 AM (in response to xlancealot)
    Re: Graph results of a shell script

    I've written a couple of fairly long and detailed posts on getting command datasources working with nagios formatted scripts.  You should be able to find them in here somewhere with a simple search.

     

    Manuel

  • themactech Rank: Brown Belt 537 posts since
    Apr 13, 2009
    Currently Being Moderated
    6. Mar 2, 2012 3:04 PM (in response to xlancealot)
    Re: Graph results of a shell script

    It take a bit for the graph to populate.  Also a good thing to check is that the RRD files get created for your data point and are populated, you will find this in /usr/local/zenoss/zenoss/perf/Devices/<your_IP_here>/

     

    If you RRD files do not get populated, then you have a issue to fix before you mess with graphs.

     

    Manuel

  • themactech Rank: Brown Belt 537 posts since
    Apr 13, 2009
    Currently Being Moderated
    7. Mar 2, 2012 3:14 PM (in response to xlancealot)
    Re: Graph results of a shell script

    Your datapoint must match the syntax of your nagios output.  If your script ends like this:

     

    echo "Datasource|SQLConns="$SQLConns

    exit 0

     

    Then your datapoint must be called SQLConns, you can't give it an arbitrary name, it must match your nagios style output.

     

    Manuel

  • themactech Rank: Brown Belt 537 posts since
    Apr 13, 2009
    Currently Being Moderated
    10. Mar 2, 2012 3:47 PM (in response to xlancealot)
    Re: Graph results of a shell script

    Your script output does not follow nagios format, I think that's the issue.

     

    you need:

     

    echo "Datasource|Connections="$Connections

    exit 0

     

    When you add a datapoint, it must be called 'Connections', the | is the indicator that says 'everything after this is datapoint info'.  Your script could return multiple datapoint (I do this a lot), example:

     

    echo "Datasource|TempHigh="$TempHigh" TempLow="$TempLow

     

    Then you could create both datapoints TempHigh and TempLow and they would get their value from your script.

     

    Manuel

  • themactech Rank: Brown Belt 537 posts since
    Apr 13, 2009
    Currently Being Moderated
    12. Mar 2, 2012 4:00 PM (in response to xlancealot)
    Re: Graph results of a shell script

    It's all part of my evil ploy to take over the world, one SNMP query at a time...

     

    Muhahahahaha

     

    Manuel

  • Shane Scott ZenossMaster 1,373 posts since
    Jul 6, 2009
    Currently Being Moderated
    14. Mar 5, 2012 2:51 PM (in response to xlancealot)
    Re: Graph results of a shell script

    xlancealot:

     

    If you want to poll faster, adjust your polling rate and adjust the RRD create command on the associated monitor. Delete all RRD's on items monitored by that monitor so they can be recreated with the correct step and consolidation.

     

    RRD normalizes all data, this is normal. Because of this graphs whose lastTime does not fall on the step value will have fractional numbers in most cases.

     

    --Shane

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points