Ad Widget

Collapse

Value from Zabbix_Agentd and Zabbix_Get from Server is Different

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arifzulfikar
    Junior Member
    • Mar 2014
    • 7

    #1

    Value from Zabbix_Agentd and Zabbix_Get from Server is Different

    Hi All Zabbix Expert,

    Now I have problem with my zabbix server, I dont know this is BUG or my mistake.
    I have 2 server, which one act as Zabbix-Server and one else is monitored server.

    My zabbix server IP Address is 192.168.122.103 and the monitored server is 192.168.122.3.

    I want to monitor some log message, in my zabbix agentd in the monitored server (192.168.122.3) I configure user parameter like this :

    UserParameter=logmessages,less /var/log/messages | wc -l

    When I running this in the monitored server with this command :
    [root@server3 ~]# zabbix_agentd -t logmessages
    logmessages [t|16685]


    The values is like what I expected, but when I trying to get the value from zabbix server
    with zabbix_get command, I get different value the value is always 0 :
    [root@zabbix ~]# zabbix_get -s 192.168.122.3 -p 10050 -k "logmessages"
    0


    The result is make a different value, I want to create graph trafic from my .txt log..

    Can someone the help me?

    Regards,
    ArifZ
  • steveboyson
    Senior Member
    • Jul 2013
    • 582

    #2
    Definitely a permission problem. Most likely your zabbix user (on the agent machine) is not allowed to get the filesize in /var/log/.

    Do (starting as root) a "su - zabbix --shell=/bin/bash" on the agent and check for yourself.

    Oh, I just see: "less <file>" is the very wrong way of counting the number of lines. Less is the pager, it is used for displaying a file. If you want to count the lines in a file, simply use "wc -l <file>". That is very likely a problem in your setting, too.

    Comment

    • arifzulfikar
      Junior Member
      • Mar 2014
      • 7

      #3
      Hi steve,

      Thanks for help, now I use your method with wc -l <file> and zabbix_get is return true value
      I use like this in user parameter for /var/log/messages :
      wc -l /var/log/messages | awk '{print $1}'

      By the way, how if I want to get value of service for example httpd service?
      In user parameter I define like below :
      UserParameter=httpdstatus,service httpd status | grep running | wc -l

      When I using zabbix_agentd -t httpdstatus from the monitored server(agent) the return value is 1 like I expected.
      But, when I trying zabbix_get from zabbix server to the agent the return value from the agent the value is still 0

      Have any idea for my cases above?

      Thx broo

      Regards
      ArifZ

      Comment

      • steveboyson
        Senior Member
        • Jul 2013
        • 582

        #4
        Have you tried the command I suggested? Try to run that "service httpd status" as user "zabbix".

        By the way, why don't you just use Zabbix' builtin item function "proc.num[...]"?


        (this is for 2.0, but 2.2 is working the same way)

        Comment

        • arifzulfikar
          Junior Member
          • Mar 2014
          • 7

          #5
          Hi Steve,

          Thanks bro, Its work.

          I know there is many template for zabbix for monitoring some service. But I have some project to developed some module. In order to monitor the service module I think I have to using this method.

          Thanks btw

          Comment

          Working...