Ad Widget

Collapse

Unknown Host Item - Newbie question/error

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • highway_fixer_man
    Member
    • Jun 2022
    • 35

    #1

    Unknown Host Item - Newbie question/error

    Hi,

    I am trying to build a custom trigger to alert me if certain services stop working.

    If I run this from the zabbix server (where MY_SERVICE_NAME is the name of the process I want to confirm is running, and MY_HOST is a remote host with IP 192.16.2.59):

    Code:
    zabbix_get -s 192.16.2.59 -k 'proc.num[MY_SERVICE_NAME]'
    I get the desired result - 1 (Showing that there is one instance of this service running)


    If i try and use this in the GUI to create a trigger, I get this error in the "expression constructor":

    Code:
    last(/MY_HOST/proc.num[MY_SERVICE_NAME]):Unknown host item, no such item in selected host
    And if I click "Add" I get this error:

    Code:
    Incorrect item key "proc.num[MY_SERVICE_NAME]" provided for trigger expression on "MY_HOST".

    Question: How do I turn my working zabbix_get command into a working trigger? I have several custom processes I need to monitor, and I believe this proc.num route is the right way to go - but if not, please correct me. I have read this page as suggested on other posts but while it does tell me things I didn't know, it doesn't show me how to properly format my trigger. From what I read on that page, I believe my formatting to be correct.








  • Answer selected by highway_fixer_man at 19-09-2022, 16:15.
    highway_fixer_man
    Member
    • Jun 2022
    • 35

    Right...

    I managed to work through this.

    I first added an item:

    1. Configuration -> Hosts -> Items (for the host I was testing on)
    2. Create Item (Top right)
    3. Gave it a name ("MY_SERVICE_NAME status" <- this is the name I gave it)
    4. Set "Key" as follows :

    Code:
    proc.num[MY_SERVICE_NAME,my_user,all,MY_SERVICE_NAME]
    5. Click "Add"

    Now to create the trigger:

    6. Configuration -> Hosts -> Triggers (for the host I was testing on)
    7. Create Trigger (Top right)
    8. Gave it a name ("MY_SERVICE_NAME is not running!!" <- this is the name I gave it)
    9. Set Severity accordingly
    10. Set "Expression" as follows:

    Code:
    last(/MY_HOST/proc.num[MY_SERVICE_NAME,my_user,all,MY_SERVICE_NAME])=0
    11. Click "Add"

    Works for me.

    I now realize that I should have added the items and triggers to a template to make it easier to assign to other hosts. This will be my next task - but hopefully this helps someone else.



    Comment

    • highway_fixer_man
      Member
      • Jun 2022
      • 35

      #2
      Furthermore:

      This zabbix_get command works just as well:

      Code:
      zabbix_get -s 192.16.2.59 -k 'proc.num[MY_SERVICE_NAME,my_user,all,MY_SERVICE_NAME]'
      And this is 100% according to the docs here I believe.

      When I try and add this as a trigger:

      Code:
      last(/MY_HOST/proc.num[MY_SERVICE_NAME,my_user,all,MY_SERVICE_NAME])=0
      I get the same errors as before:

      Expression Constructor:

      Code:
      last(/MY_HOST/proc.num[MY_SERVICE_NAME,my_user,all,MY_SERVICE_NAME]):Unknown host item, no such item in selected host
      And the GUI:

      Code:
      Incorrect item key "proc.num[MY_SERVICE_NAME,my_user,all,MY_SERVICE_NAME]" provided for trigger expression on "MY_HOST".


      Feel free to berate me for missing something - but I have tried very hard to get this working. I must be misunderstanding something big, or missing something small. Any advice or assistance appreciated.

      Comment

      • highway_fixer_man
        Member
        • Jun 2022
        • 35

        #3
        Right...

        I managed to work through this.

        I first added an item:

        1. Configuration -> Hosts -> Items (for the host I was testing on)
        2. Create Item (Top right)
        3. Gave it a name ("MY_SERVICE_NAME status" <- this is the name I gave it)
        4. Set "Key" as follows :

        Code:
        proc.num[MY_SERVICE_NAME,my_user,all,MY_SERVICE_NAME]
        5. Click "Add"

        Now to create the trigger:

        6. Configuration -> Hosts -> Triggers (for the host I was testing on)
        7. Create Trigger (Top right)
        8. Gave it a name ("MY_SERVICE_NAME is not running!!" <- this is the name I gave it)
        9. Set Severity accordingly
        10. Set "Expression" as follows:

        Code:
        last(/MY_HOST/proc.num[MY_SERVICE_NAME,my_user,all,MY_SERVICE_NAME])=0
        11. Click "Add"

        Works for me.

        I now realize that I should have added the items and triggers to a template to make it easier to assign to other hosts. This will be my next task - but hopefully this helps someone else.



        Comment

        Working...