Ad Widget

Collapse

Setting Zabbix agent 2 to target specific systemd processes fo rmonitoring

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pyritejoe
    Junior Member
    • Aug 2022
    • 15

    #1

    Setting Zabbix agent 2 to target specific systemd processes fo rmonitoring

    Hello All,

    I am admittitly very green to all this stuff with zabbix. That being said, I am trying to traget specific systemd processes for moniting. I have tried to just clone the systemd template and make some modifications but I am not able to firgure it out. Any help would be greatly appeaciated.

    Thanks
  • Answer selected by pyritejoe at 03-07-2025, 16:56.
    Viktor.Zavadskyi
    Junior Member
    • Jul 2024
    • 2

    Originally posted by Viktor.Zavadskyi

    Hello, can you helm me with this macros, i wanna define few services what i want to monitor with this template, i try to use this macros, but can define only one service, is it posible to define 2-3 services in this filed ? I tried use arrays, OR, AND operators in it, but its not worked (.
    Click image for larger version

Name:	Screenshot from 2024-07-26 17-54-50.png
Views:	345
Size:	37.9 KB
ID:	488438

    got answer by maself: to filter service you need, use this:

    Code:
    macro                                               value
    {$SYSTEMD.NAME.SERVICE.MATCHES}        (^rsyslog.service$|^firewalld.service$)

    Comment

    • BigSmooth
      Member
      • Jun 2023
      • 46

      #2
      Hi Joe,

      For templates, they usually have some MACROS you can set. For that template, and as per doc, the macro name for that is
      Code:
      {$SYSTEMD.NAME.SERVICE.MATCHES}
      . It is a regular expression of the service you want to monitor. If it is easier, you can also use the exclude MACROS (service you don't want to monitor)
      Code:
      {$SYSTEMD.NAME.SERVICE.NOT_MATCHES}
      . That's up to you.

      Olivier

      Comment

      • pyritejoe
        Junior Member
        • Aug 2022
        • 15

        #3
        Hi BigSmooth and thanks for the reply. I am looking at the template now. Would I just change the Value field to what I am wanting to monitor?

        Ok so the answer to that is yes.

        Next question, how does that variable work? Can I just put in something like f* and it will only grab stuff that starts with f? I ask because if I do it this way I am creating about a dozen templates for the services I actually care about.
        Last edited by pyritejoe; 03-04-2024, 03:06.

        Comment

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

          #4
          yes.. that is treated as regex. If you look into filters part of discovery, then you will find those macros being used there.

          Comment

          • pyritejoe
            Junior Member
            • Aug 2022
            • 15

            #5
            So The first attachment is how I am identifying the service. The second one where is what you are talking about.
            Attached Files

            Comment

            • Viktor.Zavadskyi
              Junior Member
              • Jul 2024
              • 2

              #6
              Originally posted by BigSmooth
              Hi Joe,

              For templates, they usually have some MACROS you can set. For that template, and as per doc, the macro name for that is
              Code:
              {$SYSTEMD.NAME.SERVICE.MATCHES}
              . It is a regular expression of the service you want to monitor. If it is easier, you can also use the exclude MACROS (service you don't want to monitor)
              Code:
              {$SYSTEMD.NAME.SERVICE.NOT_MATCHES}
              . That's up to you.

              Olivier
              Hello, can you helm me with this macros, i wanna define few services what i want to monitor with this template, i try to use this macros, but can define only one service, is it posible to define 2-3 services in this filed ? I tried use arrays, OR, AND operators in it, but its not worked (.
              Click image for larger version

Name:	Screenshot from 2024-07-26 17-54-50.png
Views:	345
Size:	37.9 KB
ID:	488438
              Attached Files

              Comment

              • Viktor.Zavadskyi
                Junior Member
                • Jul 2024
                • 2

                #7
                Originally posted by Viktor.Zavadskyi

                Hello, can you helm me with this macros, i wanna define few services what i want to monitor with this template, i try to use this macros, but can define only one service, is it posible to define 2-3 services in this filed ? I tried use arrays, OR, AND operators in it, but its not worked (.
                Click image for larger version

Name:	Screenshot from 2024-07-26 17-54-50.png
Views:	345
Size:	37.9 KB
ID:	488438

                got answer by maself: to filter service you need, use this:

                Code:
                macro                                               value
                {$SYSTEMD.NAME.SERVICE.MATCHES}        (^rsyslog.service$|^firewalld.service$)

                Comment

                Working...