Ad Widget

Collapse

Problem when creating an item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mio
    Junior Member
    • May 2011
    • 1

    #1

    Problem when creating an item

    Hi!

    I have a problem when creating an item:

    in zabbix conf file I placed new item:

    UserParameter=TomcatThreadStatus,curl -su Administrator:Password 10.0.0.2/manager/status/all | grep http-80 | awk '{ gsub("<tr>","\n"); print }' | awk '{ gsub("<td>"," ") ; print }' | awk '{if ($2 > 1000) print $2}' | awk '/[0-9]/' | /usr/bin/wc -l

    When pasting this query directly, result is OK:
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 36780 0 36780 0 0 1529k 0 --:--:-- --:--:-- --:--:-- 1933k
    0


    Unfortunately in Zabbix all I can see is status \not supported\.
    I restart zabbix agent after applying changes in config file.

    Would be grateful for any help.

    - Michal
  • untergeek
    Senior Member
    Zabbix Certified Specialist
    • Jun 2009
    • 512

    #2
    Wow! That's huge!

    You may be better off writing a simple shell script to do that. Zabbix sometimes complains of spaces and extended characters in UserParameters.

    Instead of what you have, put what you have in a shell script, e.g. example.sh

    Then call that script as the UserParameter, e.g.

    UserParameter=TomcatThreadStatus,/path/to/example.sh

    I find that this keeps my config file cleaner, and it is easier to troubleshoot because it keeps odd pipe behavior out of Zabbix's way.

    Comment

    Working...