Ad Widget

Collapse

Log item via Script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Voxie
    Junior Member
    • Jul 2009
    • 24

    #1

    Log item via Script

    Hi all,


    I've create a script item that is able to read all events via an API.

    I want to save the entries as log entries (with timestamp, eventid,severity etc, etc.)
    Is it possible and how ?

    Currently i am able to save the output as text, but i want to fill in timestamp, eventid, severoty, etc.)



    Kind regards,

    Hans Vos
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    eventid, source, severity etc are specific to log type and windows event logs (eventlog() item). You cannot use those with other types of items.
    You can save timestamp, if you add timestamp format (Log time format​) and save your data as log type. But there is no special fields for eventid or severity...

    Comment

    • Voxie
      Junior Member
      • Jul 2009
      • 24

      #3
      Hi cyber,

      That I understand.

      But we created a item with the type "Script" and the Type of information "Log".


      Click image for larger version

Name:	Schermafbeelding_20230123_104339.png
Views:	340
Size:	6.5 KB
ID:	458059

      The output of the script is currently saved as history in the item:

      Click image for larger version

Name:	Schermafbeelding_20230123_104525.png
Views:	327
Size:	12.4 KB
ID:	458060


      But is it possible for our script entry to fill the other fields ? (Local time, severoty, eventid, source)
      The documentation regarding the type "Script" is not that detailed.




      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        As I said those fields are for one specific type of items .windows event logs through eventlog() item.
        Local time is only one, you can use with log type. That format is described here.. https://www.zabbix.com/documentation...ypes/log_items
        And no, it will not work with unix timestamp...

        But why would you need all that, if I may ask?

        Comment

        • Voxie
          Junior Member
          • Jul 2009
          • 24

          #5
          Hi Cyber,

          We want to monitor the events from CommVault via the API.
          And is we hit a event with certain severity, eventid of source we want to trigger triggers.

          I read a post at the forum that with zabbix sender you can get this working if you post a JSON in the correct format.

          Example:
          Code:
          {
            "data": [
              {
                "timestamp": 1674472102,
                "source": "MediaManager",
                "eventid": "32:648",
                "severity": 3,
                "value": "Number of media [4] in the scratch pool [Default Scratch] inside the library [nlcxams1-tape] is less than the minimum required number [5]."
              }
            ]
          }​
          We don;t like external scripts running if we can accomplish it bit the zabbix script functionality.

          Comment

          • cyber
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Dec 2006
            • 4807

            #6

            I don't know anything about that.. There are some items that allow trapping, but in such way as you describe, I don't think it is possible... But then again, as I said, I don't really know..
            Zabbix_sender expects specific format for input (https://www.zabbix.com/documentation.../zabbix_sender), so I don't really know, how would you use JSON for that... As item value, yes, but to fill certain other fields, I have no idea... I guess you need to test it..

            But even if you don't fill those fields you can still create triggers on top of that item value you send.. regexing the hell out of it.. Maybe for some things you can use dependent items and split that data up into pieces... I am unfamiliar with the product, so giving advice here is a "bit" limited...

            Comment

            Working...