Ad Widget

Collapse

UserParameter not sending data to items in frontend

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jab2805
    Junior Member
    • Nov 2011
    • 2

    #1

    UserParameter not sending data to items in frontend

    Hi all,


    I have been trying to setup a UserParameter to watch a log file for the string ERROR.


    ENV:

    Zabbix server 1.8.3

    zabbix_agentd:

    ZABBIX Agent (daemon) v1.6.1 (04 November 2008)
    Compilation time: Apr 20 2010 19:40:47


    Setup:


    UserParameter=fastchecklog.status,cat /home/fastuser/fastcheck/check_datestamp.log|awk '{print $3}'| grep ERROR


    1. I restarted zabbix_agentd.

    2. Set debug level to 4 in /etc/zabbix/zabbix_agentd.conf.


    3. Tested successfully my key from the zabbix server using zabbix_get:

    $ zabbix_get -s nyss0223 -p 10050 -k fastchecklog.status
    ERROR
    ERROR
    ERROR
    ERROR
    ERROR
    ERROR
    ERROR

    4. On the client I tested using zabbix_agent -t:

    zabbix_agent -t fastchecklog.status
    fastchecklog.status [t|ERROR
    ERROR
    ERROR
    ERROR
    ERROR
    ERROR
    ERROR]

    5. I configured the following item setting

    Host=xxxx
    Description=fastchecklog.status
    Type=Zabbix agent
    Key=fastchecklog.status
    Type of information=Text
    Update interval(in sec)=60
    Keep history(in days)=7



    The item is not updating with any data when I check Monitoring | latest data.

    What could the issue be?
  • justinc
    Junior Member
    • Aug 2011
    • 20

    #2
    First question how long does it take to parse the data? If it's taking too long to gather you might need to look at using a different method instead of using a userparameter.

    Originally posted by jab2805
    UserParameter=fastchecklog.status,cat /home/fastuser/fastcheck/check_datestamp.log|awk '{print $3}'| grep ERROR
    Also good practice when using positional references you should use $$.

    UserParameter=fastchecklog.status,cat /home/fastuser/fastcheck/check_datestamp.log|awk '{print $$3}'| grep ERROR

    You may be running into an issue with a multi-line response.
    If you are want to capture the string data and you want to put it on one line you can do something like:
    UserParameter=fastchecklog.status,cat /home/fastuser/fastcheck/check_datestamp.log|awk '{print $$3}'| grep ERROR | awk -vORS=' ' 1

    If you are only capturing the word ERROR for how many times it occurs it maybe more efficient to just do a grep count so then you are sending a single numeric value to zabbix.

    UserParameter=fastchecklog.status,grep -c ERROR /home/fastuser/fastcheck/check_datestamp.log
    or
    UserParameter=fastchecklog.status,cat /home/fastuser/fastcheck/check_datestamp.log|awk '{print $$3}'| grep -c ERROR

    Comment

    • jab2805
      Junior Member
      • Nov 2011
      • 2

      #3
      Thanks justinc,


      Because its a grep of the file I don't think the time is that long. I tried all of the above changes, but my items are still not getting any data. I changed the item type from char. to dec. since I'm now send a numeric values. One odd thing I notice is when I run zabbix_agent -t key I still get string data retuned; I was expecting numeric data, however zabbix_get from the zabbix server returns the expected data type.


      1.
      zabbix_agent -t fastchecklog.status
      fastchecklog.status [t|ERROR
      ERROR
      ERROR
      ERROR
      ERROR
      ERROR

      2.
      zabbix_get -s nyss0223 -p 10050 -k fastchecklog.status
      8

      Comment

      Working...