Ad Widget

Collapse

Zabbix agent, UserParameter, and including?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mikecrowe
    Member
    • Dec 2007
    • 34

    #1

    Zabbix agent, UserParameter, and including?

    Hi folks,

    One thing I hate is manually editing all my UserParameter settings on each monitored system.

    I'd love to see 2 things:
    1. Ability to "include" a separate .conf script with UserParameter entries (so a corporate set of parameters can be distributed)
    2. Ability of the agent to parse this live, so we don't have to restart the agent.
    Does anybody else agree?
  • jcollie
    Junior Member
    • Dec 2006
    • 11

    #2
    Configuration Management

    Use a configuration management system like Puppet or Bcfg2 to manage the Zabbix configuration files (both of which include the ability to use templates) and restart the agent service as needed.




    For example, here is the template that generates my zabbix_agentd.conf:

    Code:
    Server=127.0.0.1,10.0.0.1
    Hostname=$metadata.hostname
    ListenPort=10050
    StartAgents=5
    DebugLevel=3
    PidFile=/var/run/zabbix/zabbix_agentd.pid
    LogFile=/var/log/zabbix/zabbix_agentd.log
    Timeout=3
    DisableActive=1
    EnableRemoteCommands=1
    
    {% if metadata.hostname in [ 'anfwext01.dmacc.net', 'anfwext02.dmacc.net' ] %}\
    UserParameter=tcstat[*],/root/bin/tcstat $1 $2
    {% end %}\
    {% if 'mysql-server' in metadata.groups %}\
    UserParameter=mysql.ping,/usr/bin/mysqladmin --user=monitor ping|grep alive|wc -l
    UserParameter=mysql.uptime,/usr/local/bin/mysql-stats-inquirer status.uptime
    UserParameter=mysql.threads,/usr/local/bin/mysql-stats-inquirer status.threads
    UserParameter=mysql.questions,/usr/local/bin/mysql-stats-inquirer status.questions
    UserParameter=mysql.slowqueries,/usr/local/bin/mysql-stats-inquirer status.slow_queries
    UserParameter=mysql.qps,/usr/local/bin/mysql-stats-inquirer status.queries_per_second
    UserParameter=mysql.version,mysql -V
    {% end %}\
    {% if 'asterisk-server' in metadata.groups %}\
    UserParameter=asterisk[*],/usr/local/bin/asterisk-stats-inquirer $$1
    {% end %}
    In this case I'm using the Genshi templating system:

    Comment

    • mikecrowe
      Member
      • Dec 2007
      • 34

      #3
      Funny you should mention that: I was just reading up on puppet last night.

      However, my point was that the agent really has 2 different types of config: server/process info which don't change, and userparameters which may be expanded as your monitoring develops.

      I've had problems when doing /etc/init.d/zabbix-agent restart. It almost needs a pause to sample until the existing processes are going before restarting. I almost always do a stop, a lot of ps | grep zabbix, and start commands.

      Comment

      • jcollie
        Junior Member
        • Dec 2006
        • 11

        #4
        Configuration Management

        Originally posted by mikecrowe
        I've had problems when doing /etc/init.d/zabbix-agent restart. It almost needs a pause to sample until the existing processes are going before restarting. I almost always do a stop, a lot of ps | grep zabbix, and start commands.
        That sounds like a bug in the init script... it should be a relatively easy matter to update the init script so that it waits for all existing zabbix_agent processes to disappear before starting up the new ones.

        If you don't feel like updating the init script you should be able to accomplish what you want with Puppet's "file" and "exec" types - I use Puppet to manage a different set of servers running Zabbix.

        Comment

        Working...