Ad Widget

Collapse

How to verify log monitor output

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xtonymarsx
    Junior Member
    • Jun 2018
    • 5

    #1

    How to verify log monitor output

    I'm working on setting up log monitoring right now. I've got simple triggers setup to show when the shutterspeed of a remote controlled camera are set to 30 seconds by parsing the log specifically for 30 "{log[<path_to_log>,shutterspeed: ].str(*30*)}=1, and those are working just fine. I've had to set up individual triggers for different shutterspeeds. Ultimately, I want it to pull the shutterspeed value from the log file and trigger if it's anything other than 15. I've tried a couple different variations, but none have worked thus far. The value in the log appears as "shutterspeed: X"

    {log[<path_to_log>,shutterspeed: ,,,,\1].last()}<>15 (this is the most recent one I tried. I thought \1 captures the value after the search string, but it's not.

    So...
    1. What is wrong with the item/trigger above?
    2. Is there a way (like zabbix_agentd -t <item>) to test out log items on command line to verify the output is what I think it is going to be?
    Last edited by xtonymarsx; 02-07-2018, 22:20.
  • kernbug
    Senior Member
    • Feb 2013
    • 330

    #2
    Hello,

    The value in the log appears as "shutterspeed: X"
    You can use preprocessing for this, see examples here: Item value preprocessing
    Also overall review of the preprocessing feature: https://www.zabbix.com/documentation.../preprocessing

    Comment

    • xtonymarsx
      Junior Member
      • Jun 2018
      • 5

      #3
      Is there a way for me to see the output of my trigger via command line? For example, I can run...
      "zabbix_agentd -t agent.ping" and of course I get a return of [u|1]

      but...
      "zabbix_agentd -t [log[<path>,shutterspeed: ,,,,\1]" returns "m|ZBX_NOTSUPPORTED"

      I ask because how am I supposed to set up the preprocessing if I don't have confidence in what string is actually being gathered from the log?
      Last edited by xtonymarsx; 05-07-2018, 13:54.

      Comment

      • Atsushi
        Senior Member
        • Aug 2013
        • 2028

        #4
        There is no way to check the output result of log[] on the command line.

        Please register items and output logs to check if values can be obtained.
        There is also a method of creating a test file of the same format instead of an actual log file and adding an output example to that file and trying it.

        Presenting a more concrete log file format and output example, you will receive more specific advice.
        Detailed version of Zabbix being used is also important information.

        Comment

        • xtonymarsx
          Junior Member
          • Jun 2018
          • 5

          #5
          Versions:
          Server: v3.4.9
          Agent: v2.2.7 (which I'd never checked before, and WOW we need to do an update)

          Ok. Can I get a sanity check then? Below is the actual line from the my log file, and if I could get an example of how I SHOULD be parsing the "30" value would be a big help.

          2018-07-06 09:33:47 DEBUG get_capture_settings(180) shutterspeed: 30

          Is my original key even going to grab the "30" value? If not, can someone tell me what you think it is grabbing?
          Last edited by xtonymarsx; 06-07-2018, 19:05.

          Comment


          • Atsushi
            Atsushi commented
            Editing a comment
            Please try with the item key as below.
            log[<path_to_log>,"shutterspeed: ([0-9]+)",,,,\1]
        Working...