Ad Widget

Collapse

Using User Paramaters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SMB
    Member
    • Sep 2007
    • 30

    #1

    Using User Paramaters

    I have created a user peramater as follows:

    UserParameter=psql.transactions,psql -U postgres --tuples-only -c "select sum(xact_commit) + sum(xact_rollback) from pg_stat_database"

    How do I get information out of that?

    I created a Template called Template_PGSQL. Under that I added an item with a key name of psql.transactions, Type is Zabbix Agent. After linking that template to the hosts that have the above user paramater, that item returns no data.

    So what have I done wrong?
  • hardtofi
    Member
    • Jan 2008
    • 32

    #2
    Originally posted by SMB
    I have created a user peramater as follows:

    UserParameter=psql.transactions,psql -U postgres --tuples-only -c "select sum(xact_commit) + sum(xact_rollback) from pg_stat_database"

    How do I get information out of that?

    I created a Template called Template_PGSQL. Under that I added an item with a key name of psql.transactions, Type is Zabbix Agent. After linking that template to the hosts that have the above user paramater, that item returns no data.

    So what have I done wrong?
    My first step would be to switch it to something simple first to see that it's actually executed. like:
    UserParameter=psql.transactions,ls |wc -l

    If that works, then you can rule out problems between the agent and the server. And if it does work (not having used postgres) I'd make sure you command only returns one value in one line, and that it's the same type as you've specified in your template.

    If it isn't then you might need to make the command some shell/perl/python/your-favorite-language program that fetches the data and just does 'print "$value\n"'

    Hope that helps

    Comment

    Working...