Ad Widget

Collapse

Read log file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marcos.schimidt
    Junior Member
    • Apr 2019
    • 18

    #1

    Read log file

    Hi,

    I have one script to connect another server with ssh and collect some informations and create in zabbix server "/etc/zabbix/logs/springs" files extension .log

    I Try but, I'm doesn't have success when I create one item to monitor output "WARNING" in log file..

    Could someone help me with the problem ...

    Sorry my english is a working in progress..
  • andris
    Zabbix developer
    • Feb 2012
    • 228

    #2
    How does your log item key look ? Something like "log[/etc/zabbix/logs/springs.log,WARNING] ? Is item Type set to "Zabbix agent (active)" ?

    Comment

    • marcos.schimidt
      Junior Member
      • Apr 2019
      • 18

      #3
      I try, thi is result:
      Click image for larger version

Name:	Clipboard01.jpg
Views:	5705
Size:	24.4 KB
ID:	378095

      Comment


      • Atsushi
        Atsushi commented
        Editing a comment
        The text is small and unreadable, but what does the red text show?

      • steeladept
        steeladept commented
        Editing a comment
        Maybe I am missing something here that you already stated, but the Log Warning states it is an Active Check. Do you have active checks enabled in the server/proxy? Just trying to cover the basics first.
    • andris
      Zabbix developer
      • Feb 2012
      • 228

      #4
      You can temporarily set DebugLevel=4 in config file "zabbix_agentd.conf" and restart zabbix_agentd. Then look for lines with "springs.log" to see how log checks go.

      Comment

      • marcos.schimidt
        Junior Member
        • Apr 2019
        • 18

        #5
        Originally posted by andris
        You can temporarily set DebugLevel=4 in config file "zabbix_agentd.conf" and restart zabbix_agentd. Then look for lines with "springs.log" to see how log checks go.
        Log is empty

        [root@zabbix ~]# tailf /var/log/zabbix/zabbix_agentd.log |grep springs.log








        Comment

        • andris
          Zabbix developer
          • Feb 2012
          • 228

          #6
          Hmm... There is no standard command "tailf". Have you defined your own "tailf" as an alias to "tail -f" ? If so, then no wonder it shows nothing.
          Better try "grep springs.log /var/log/zabbix/zabbix_agentd.log". If you see some output, then look into /var/log/zabbix/zabbix_agentd.log for context - what is before and after matching strings. The goal is to understand if "log[/etc/zabbix/logs/springs.log,WARNING]" item is working at all.

          Comment

          • marcos.schimidt
            Junior Member
            • Apr 2019
            • 18

            #7
            Originally posted by andris
            Hmm... There is no standard command "tailf". Have you defined your own "tailf" as an alias to "tail -f" ? If so, then no wonder it shows nothing.
            Better try "grep springs.log /var/log/zabbix/zabbix_agentd.log". If you see some output, then look into /var/log/zabbix/zabbix_agentd.log for context - what is before and after matching strings. The goal is to understand if "log[/etc/zabbix/logs/springs.log,WARNING]" item is working at all.
            Sorry for the delay in responding.
            See log
            -----------------
            10654:20190430:110904.275 In need_meta_update() key:log[/var/log/zabbix/monitor/springs.log,WARNING]
            10654:20190430:110905.275 In process_logrt() flags:0x04 filename:'/var/log/zabbix/monitor/springs.log' lastlogsize:3 mtime:1556221273
            10654:20190430:110905.276 In add_logfile() filename:'/var/log/zabbix/monitor/springs.log' mtime:1556221273 size:3
            10654:20190430:110905.276 create_old2new_and_copy_of(): is_same_file(/var/log/zabbix/monitor/springs.log, /var/log/zabbix/monitor/springs.log) = 1
            10654:20190430:110905.276 nr:0 filename:'/var/log/zabbix/monitor/springs.log' mtime:1556221273 size:3 processed_size:3 seq:1 copy_of:-1 incomplete:0 dev:64768 ino_hi:0 ino_lo:67580870 md5size:3 md5buf:d36f8f9425c4a8000ad9c4a97185aca5
            10654:20190430:110905.276 nr:0 filename:'/var/log/zabbix/monitor/springs.log' mtime:1556221273 size:3 processed_size:3 seq:1 copy_of:-1 incomplete:0 dev:64768 ino_hi:0 ino_lo:67580870 md5size:3 md5buf:d36f8f9425c4a8000ad9c4a97185aca5

            Last edited by marcos.schimidt; 30-04-2019, 16:09.

            Comment

            • marcos.schimidt
              Junior Member
              • Apr 2019
              • 18

              #8
              Actually the springs.log file will contain "OK" when the environment is good and "WARNING" when it is in trouble, so I changed the Key to:
              log [/var/log/zabbix/monitor/springs.log,OK]
              I do not know now how to create the alert if springs.log is with the word "WARNING"

              ========================
              [root@zabbix ~]# cat /var/log/zabbix/monitor/springs.log
              OK
              ========================

              Comment

              • marcos.schimidt
                Junior Member
                • Apr 2019
                • 18

                #9
                Hello, I tried, tried, tried, but not successful

                Follow my configuration printout

                Status is *problem*

                springs.log file content

                [root@zabbix monitor]# cat /var/log/zabbix/monitor/springs.log
                OK



                Attached Files

                Comment


                • Atsushi
                  Atsushi commented
                  Editing a comment
                  The item seems to be set to the host "Zabbix server", but the conditional expression in the setting of the trigger seems to specify the conditional expression to the item of the host "zabbix.avista.local". In this setting, even if the host "Zabbix server" acquires the corresponding log, the trigger event does not occur because the item is not specified in the trigger conditional expression.

                  If you use "log [/var/log/zabbix/monitor/spring.log, OK]" which is the key of the log item of host "Zabbix server" in the conditional expression of the trigger, As an item you specify in the conditional expression
                  You should specify "Zabbix server:log[/var/log/zabbix/monitor/spring.log,OK]" instead of "zabbix.avista.local:log[/var/log/zabbix/monidor/spring.log]" as the item specified in the conditional expression.
              • marcos.schimidt
                Junior Member
                • Apr 2019
                • 18

                #10
                Hi,

                It gives error when trying to change
                Attached Files

                Comment

                • marcos.schimidt
                  Junior Member
                  • Apr 2019
                  • 18

                  #11
                  Originally posted by marcos.schimidt
                  Hi,

                  It gives error when trying to change
                  Follows zabbix_agent.log part

                  16908:20190502:114201.630 End of send_buffer():SUCCEED
                  16908:20190502:114201.630 __zbx_zbx_setproctitle() title:'active checks #1 [processing active checks]'
                  16908:20190502:114201.630 In process_active_checks() server:'127.0.0.1' port:10051
                  16908:20190502:114201.630 In process_logrt() flags:0x04 filename:'/var/log/zabbix/monitor/springs.log' lastlogsize:3 mtime:1556807942
                  16908:20190502:114201.630 In add_logfile() filename:'/var/log/zabbix/monitor/springs.log' mtime:1556807942 size:3
                  16908:20190502:114201.630 add_logfile() logfiles:0x5604be6c33c0 logfiles_alloc:64
                  16908:20190502:114201.630 End of add_logfile()
                  16908:20190502:114201.630 create_old2new_and_copy_of(): is_same_file(/var/log/zabbix/monitor/springs.log, /var/log/zabbix/monitor/springs.log) = 1
                  16908:20190502:114201.630 process_logrt() old file list:
                  16908:20190502:114201.630 nr:0 filename:'/var/log/zabbix/monitor/springs.log' mtime:1556807942 size:3 processed_size:3 seq:1 copy_of:-1 incomplete:0 dev:64768 ino_hi:0 ino_lo:67580873 md5size:3 md5buf:d36f8f9425c4a8000ad9c4a97185aca5
                  16908:20190502:114201.630 process_logrt() new file list: (mtime:1556807942 lastlogsize:3 start_idx:0)
                  16908:20190502:114201.630 nr:0 filename:'/var/log/zabbix/monitor/springs.log' mtime:1556807942 size:3 processed_size:3 seq:1 copy_of:-1 incomplete:0 dev:64768 ino_hi:0 ino_lo:67580873 md5size:3 md5buf:d36f8f9425c4a8000ad9c4a97185aca5
                  16908:20190502:114201.630 End of process_logrt():SUCCEED
                  16908:20190502:114201.630 In need_meta_update() key:log[/var/log/zabbix/monitor/springs.log,OK]
                  16908:20190502:114201.630 End of need_meta_update():FAIL
                  16908:20190502:114201.630 End of process_active_checks()
                  16908:20190502:114201.630 In get_min_nextcheck()
                  16908:20190502:114201.630 End of get_min_nextcheck():1556808122
                  16908:20190502:114201.630 __zbx_zbx_setproctitle() title:'active checks #1 [idle 1 sec]'
                  16904:20190502:114202.605 __zbx_zbx_setproctitle() title:'collector [processing data]'
                  16904:20190502:114202.605 In update_cpustats()
                  16904:20190502:114202.605 End of update_cpustats()
                  16904:20190502:114202.605 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]'
                  16908:20190502:114202.630 In send_buffer() host:'127.0.0.1' port:10051 entries:0/100
                  16908:20190502:114202.630 End of send_buffer():SUCCEED
                  16908:20190502:114202.630 __zbx_zbx_setproctitle() title:'active checks #1 [processing active checks]'
                  16908:20190502:114202.630 In process_active_checks() server:'127.0.0.1' port:10051

                  Comment

                  • marcos.schimidt
                    Junior Member
                    • Apr 2019
                    • 18

                    #12
                    Hi... problem Solved

                    Comment

                    • nyarlath
                      Junior Member
                      • Sep 2019
                      • 5

                      #13
                      Originally posted by marcos.schimidt
                      Hi... problem Solved
                      Hello, it would have been kind from you to share what you did to solve the issue, don't you think?

                      Comment

                      Working...