Ad Widget

Collapse

Json file monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NeutrALUS
    Junior Member
    • Jun 2022
    • 8

    #1

    Json file monitoring

    Hello,

    It is posible to monitor local json file via zabbix active check?
    And parse it?

    zabbix active check gets all json file output line by line and i am not able to parse it
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    What check gets json file output? What exactly you mean with "I am not able to parse it" ? Preprocessing? Or .. what is your goal ?

    Comment

    • NeutrALUS
      Junior Member
      • Jun 2022
      • 8

      #3
      json output

      {
      "date_time":"2022-08-11T15:16:12.864+0300",
      "name":"Alliance Cloud state started",
      "id":"50021",
      "severity":"INFO",
      "event_class":"Software",
      "event_text":"SIL instance 424013c7-7d1d-47e0-8eaa-5fbc624edd09\n Message: Alliance Cloud Client moved to STARTED state"
      }
      {
      "date_time":"2022-08-11T15:16:14.771+0300",
      "name":"SIL start success",
      "id":"10001",
      "severity":"INFO",
      "event_class":"Software",
      "event_text":"SIL 424013c7-7d1d-47e0-8eaa-5fbc624edd09 was started successfully."
      }​


      and zabbix collect it any order, it not like json format, and line by line like separete log
      2023-09-05 12:26:46 }
      2023-09-05 12:26:46 "actor_name":"cn=sil-adm2,o=cbsblt26,o=swift",
      2023-09-05 12:26:46 "actor_type":"File channel",
      2023-09-05 12:26:46 "event_text":"Downloaded successfully distributions IDs [108086391061740355]"
      2023-09-05 12:26:45 {
      2023-09-05 12:26:45 "actor_type":"File channel",
      2023-09-05 12:26:45 "actor_name":"cn=sil-adm2,o=cbsblt26,o=swift",
      2023-09-05 12:26:45 }
      2023-09-05 12:26:45 "event_text":"Downloaded successfully distributions IDs [108086391061740344]"
      2023-09-05 12:26:45 "date_time":"2023-09-05T12:17:42.337+0300",
      2023-09-05 12:26:45 "name":"Message batch received from Alliance Cloud",
      2023-09-05 12:26:45 "id":"55003",
      2023-09-05 12:26:45 "severity":"INFO",
      2023-09-05 12:26:45 "event_class":"Message",
      2023-09-05 12:26:44 "severity":"INFO",
      2023-09-05 12:26:44 "actor_type":"File channel",
      2023-09-05 12:26:44 "actor_name":"cn=sil-adm2,o=cbsblt26,o=swift",
      2023-09-05 12:26:44 "event_text":"Messages with Cloud references [2ab5f6b6-6405-460b-aa1b-eaef60df80c0,toc] uploaded successfully"


      my goal is to get, only date and event text


      {
      "date_time":"2022-08-11T15:16:14.771+0300",
      "event_text":"SIL 424013c7-7d1d-47e0-8eaa-5fbc624edd09 was started successfully."
      }​​

      Comment

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

        #4
        What item are you using for this? log[] ? logrt[] ?
        Show the config...

        Comment

        • Hamardaban
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • May 2019
          • 2713

          #5
          Using the log key type you will not get what you want.
          If this json is the result of a request to some API, then you can request it directly from zabbix.
          Or do something else to transfer the entire json. For example ."vfs.file.contents" or "system.run" keys

          Comment

          Working...