Ad Widget

Collapse

Force Re-Discovery?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bernd Hohmann
    Member
    • Mar 2013
    • 46

    #1

    Force Re-Discovery?

    I have some autodiscovery templates for network and disks which are "work in progress".

    How can I drop the discovered stuff and force a re-discovery?

    Currently I unlink and relink the discovery-template on some hosts, but I fear the time when I have to do this on +500 hosts...

    Any ideas?

    Bernd
  • eger
    Member
    • Nov 2006
    • 95

    #2
    I'd love to know how to force-rediscovery also. If this isn't possible, maybe we should make a feature request?

    Comment

    • oliverm
      Senior Member
      • May 2006
      • 155

      #3
      Did you find a way to do this?

      I'd like to see a simple "Discover now" button, perhaps with an option to re-discover as you suggested, or even just to force a discovery run.

      Olly

      Comment

      • eger
        Member
        • Nov 2006
        • 95

        #4
        Originally posted by oliverm
        Did you find a way to do this?

        I'd like to see a simple "Discover now" button, perhaps with an option to re-discover as you suggested, or even just to force a discovery run.

        Olly
        I did not find a way to do this. I ran into a number of other little quirks in discovery and eventually ended up manually configuring what I needed.

        Comment

        • benny
          Junior Member
          • Jul 2015
          • 1

          #5
          Force Discovery

          I too would like to see this feature, triggered when a host is added.
          Having to wait 60 mins (the default) for a new host to be discovered is odd. I know I can reduce the discovery time but then I have to change it back after the new host is discovered.
          I can't think of a situation when after you have added a host, you wouldn't want it discovered immediately.

          Comment

          • Ravikumar
            Junior Member
            • Jun 2018
            • 3

            #6
            Force discovery is possible by changing nextcheck value in table drules from "zabbix" database. nextcheck time is unix timestamp value. you can update that value.

            Steps:
            ------
            login to mysql on zabbix server (in case distributed setup you can have separate server for mysql)
            mysql> use zabbix;
            mysql> select * from drules where status=0\G
            ------

            status=0 means enabled rules only 1 means disabled.
            lets say I have below rule:
            -------------------
            druleid: 17
            proxy_hostid: xxxx
            name: rule_name
            iprange: <ip range>
            delay: 360
            nextcheck: 1530777142
            status: 0
            3 rows in set (0.00 sec)
            -------------------

            [localhost:]$date -d@1530777142
            Thu Jul 5 13:22:22 IST 2018
            [localhost:]$date -d "2018-07-05 13:20:00" "+%s"
            1530777000

            you can use this value to update nextcheck

            Last edited by Ravikumar; 05-07-2018, 10:01.

            Comment

            • kloczek
              Senior Member
              • Jun 2006
              • 1771

              #7
              Originally posted by Bernd Hohmann
              I have some autodiscovery templates for network and disks which are "work in progress".

              How can I drop the discovered stuff and force a re-discovery?

              Currently I unlink and relink the discovery-template on some hosts, but I fear the time when I have to do this on +500 hosts...
              Use zabbix API and write short script.
              More important question is why you are trying to do this?
              Do you want to delete items history?
              LLD has iterator item which is used to generate all LLD prototypes. If those items are not updating it means that probably you have something wrong with this iterator item and its update interval.
              No matter how long this period is it is possible to force query LLD item iterator by restart zabbix agent if this LLD uses zabbix agent type of item.
              http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
              https://kloczek.wordpress.com/
              zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
              My zabbix templates https://github.com/kloczek/zabbix-templates

              Comment

              • Linwood
                Senior Member
                • Dec 2013
                • 398

                #8
                Originally posted by Bernd Hohmann
                I have some autodiscovery templates for network and disks which are "work in progress".

                How can I drop the discovered stuff and force a re-discovery?
                Two separate things.

                Cleaning up old is quickest if you set the "keep lost resources period" to zero. If that's not fast enough (and you do not mind losing history for that template) just "unlink and clear" and then re-apply the template to remove all old items.

                To do a rediscover now, just set the discovery period to a short value, like 1m. It's not "now" but it's close. If it's a huge, widely applied template obviously that has an impact, but presumably you are not doing development with it already applied to hundreds of devices. But even if you are, just back off the discovery interval a bit if it becomes too compute intensive. I often debug new discovery in a separate template, then copy (sadly by hand) the discovery rule and prototypes into the otherwise production template.

                Yeay, a "discover now" would be nice, but setting to a short interval is close enough.

                Ravikumar thanks for the sql pointer, I had not noticed that before, also quite useful for those brave enough to update their database directly (or, in my case, foolish enough perhaps).


                Comment

                • kloczek
                  Senior Member
                  • Jun 2006
                  • 1771

                  #9
                  Originally posted by Linwood

                  Two separate things.

                  Cleaning up old is quickest if you set the "keep lost resources period" to zero. If that's not fast enough (and you do not mind losing history for that template) just "unlink and clear" and then re-apply the template to remove all old items.
                  When someone executes cleat history data (over web interface or zabbix api) zabbix never deletes those data instantly (just in case if someone have such impression that it is done like this).
                  If history tables housekeeper is enabled it adds record to delete all history data to housekeeper table related to exact itemid and physically those data will be removed on next HK cycle.
                  When HK on history* tables is disabled and someone maintains delete oldest data by dropping oldest history* tables data those data will be removed with with delete oldest partitions.
                  The same is with trends* data. However even if someone has partitioned trends* tables it is good to keep HK enabled on trends* tables.
                  Why? Because content of those tables may be rotated even after many years and because this those data may stay around for very long time.
                  Solution in such cases is have enabled trends HK enabled to delete those data physically from trends tables. This will create some holes in files of those tables which can be reduced quite easy by optimise query.
                  If such query will be started after every hour finishing new trends points data such optimisation will not cause locking any other zabbix operations.
                  Usually trends data takes less then 5% of whole database size even in trends is 3y of all trends data so optimise those tables takes usually ~few minutes.

                  So again: delete/clear history data never ever instantly deletes any data.

                  To do a rediscover now, just set the discovery period to a short value, like 1m. It's not "now" but it's close.
                  Rediscovery is done when new data used in LLD iterator will arrive to the zabbix server.
                  Ergo: just cause that those data will be sampled again by for example restart the agent.
                  You don''t need to change anything in the templates or hosts settings.
                  If LLD iterator item uses trapper items just use zabbix_send command to feed LLD iterator item to force reevaluate all populated items.
                  Last edited by kloczek; 05-07-2018, 17:53.
                  http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                  https://kloczek.wordpress.com/
                  zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                  My zabbix templates https://github.com/kloczek/zabbix-templates

                  Comment

                  • Linwood
                    Senior Member
                    • Dec 2013
                    • 398

                    #10
                    kloczek, re cleanup I was assuming the OP wanted it to disappear from zabbix screens, and if you clear when unlinking, it does so, right?

                    I don't follow your last note. Unless you are speaking specifically of the zabbix agent; I never consider it, as 99% of what I do is SNMP. With SNMP to rediscover, isn't it necessary to do something to change the interval (or as noted above cheat with SQL)?

                    Comment

                    • kloczek
                      Senior Member
                      • Jun 2006
                      • 1771

                      #11
                      Originally posted by Linwood
                      kloczek, re cleanup I was assuming the OP wanted it to disappear from zabbix screens, and if you clear when unlinking, it does so, right?

                      I don't follow your last note. Unless you are speaking specifically of the zabbix agent; I never consider it, as 99% of what I do is SNMP. With SNMP to rediscover, isn't it necessary to do something to change the interval (or as noted above cheat with SQL)?
                      In case using LLD with SNMP it is always down to kind of estimation how frequently some metrics populated by LLD iterator which is using SNMP item type.
                      Monitoring should be something which should not relay on some manually done operations.
                      If you are thinking that you need to force something manually to repopulate metric generated by prototypes some small red dwarf sitting inside of your school should start screaming "what are you doing?"

                      May I ask in case of what kind OIDs mapped to zabbix metrics you have such dilemmas?
                      http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                      https://kloczek.wordpress.com/
                      zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                      My zabbix templates https://github.com/kloczek/zabbix-templates

                      Comment

                      • Linwood
                        Senior Member
                        • Dec 2013
                        • 398

                        #12
                        Originally posted by kloczek
                        May I ask in case of what kind OIDs mapped to zabbix metrics you have such dilemmas?
                        I interpreted the question as being related to one developing a new templates, so you put something in, try a discovery; put in some more prototypes, try a discovery, repeat.

                        I am not talking about production but development. Maybe I misunderstood the OP.

                        Comment

                        • kloczek
                          Senior Member
                          • Jun 2006
                          • 1771

                          #13
                          Originally posted by Linwood

                          I interpreted the question as being related to one developing a new templates, so you put something in, try a discovery; put in some more prototypes, try a discovery, repeat.

                          I am not talking about production but development. Maybe I misunderstood the OP.
                          In such case best is use active proxy. Restarting it it will cause probe all LLDs iterator items.
                          http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                          https://kloczek.wordpress.com/
                          zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                          My zabbix templates https://github.com/kloczek/zabbix-templates

                          Comment

                          • richlv
                            Senior Member
                            Zabbix Certified Trainer
                            Zabbix Certified SpecialistZabbix Certified Professional
                            • Oct 2005
                            • 3112

                            #14
                            Details depend on the type of the LLD rule (which the original question seems to be out, even though some answers mix in network discovery), but the polling of passive-type LLD rules can be manually forced since Zabbix 4.0: https://www.zabbix.com/documentation...cs_immediately .
                            Zabbix 3.0 Network Monitoring book

                            Comment

                            Working...