Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.65k stars 406 forks source link

[1.2.20] - After changing device IP poller_items is not updated #4544

Closed bmfmancini closed 2 years ago

bmfmancini commented 2 years ago

Hey Guys,

I discovered an issue today where after changing a device IP you are able to get the sysdescr in the device window but polling fails After running spine manually you see that spine reports both the new IP and OLD IP

2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] INFO: SNMP Device 'NEW_IP:161' has a timeout of 500000 (500), with 3 retries
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] IPv4 address NEW_IP (NEW_IP)
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] DEBUG: Entering ICMP Ping
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038357755968] WARNING: Device[323] polling sleeping while waiting for 1 Threads to End
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] DEBUG: Attempting to ping New IP, seq 0 (Retry 0 of 1)
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] DEBUG: ICMP Device Alive, Try Count:1, Time:2.9109 ms
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038357755968] WARNING: Device[323] polling sleeping while waiting for 1 Threads to End
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038357755968] WARNING: Device[323] polling sleeping while waiting for 1 Threads to End
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] DEBUG: Entering SNMP Ping
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] PING Result: ICMP: Device is Alive
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] SNMP Result: Device responded to SNMP
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] Checking for System Information Update
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] Updating Full System Information Table
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] DEBUG: Device[323] HT[1] RECACHE: Processing 1 items in the auto reindex cache for 'NEW_IP'
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] HT[1] DQ[4] Extended Uptime Result: 3661347, Is Numeric: 1
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] HT[1] DQ[4] RECACHE OID: .1.3.6.1.2.1.1.3.0, (assert: 366130600 < output: 366134700)
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] HT[1] NOTE: There are '36' Polling Items for this Device
2022-02-04 11:20:42 - SPINE: Poller[1] PID[8582] PT[140038193874688] Device[323] INFO: SNMP Device 'OLD IP:161' has a timeout of 500000 (500), with 3 retries

The host table has the correct IP but the poller_items table does not

MariaDB [cacti]> select * from host where id = '323' \G;
*************************** 1. row ***************************
                     id: 323
              poller_id: 1
                site_id: 1
       host_template_id: 10
            description: (Hostname)
               hostname: 1.2.3.4
               location:
                  notes:
            external_id:

36. row local_data_id: 1741 poller_id: 1 host_id: 323 action: 0 present: 1 last_updated: 2022-02-04 11:58:09 hostname: (OLD IP) snmp_community: public snmp_version: 3

I tried to repopulate the poller cache and reindex and resave the device no changes The last_updated colum in the poller_items does get updates so it looks like something happens

bmfmancini commented 2 years ago

I updated the poller_item colum manually all was well until you attempt to repopulate poller cache the device then the old IP comes back into the poller_items table

bmfmancini commented 2 years ago

I was able to replicate this again on 1.2.20


Record Before
MariaDB [cacti]> select * from host   where id   = '260' limit 1\G;
*************************** 1. row ***************************
                    id: 260
             poller_id: 2
               site_id: 1
      host_template_id: 2
           description: mancinifw
              hostname: 192.168.1.254
              location:
                 notes:
           external_id:
        snmp_community: 
          snmp_version: 2
         snmp_username:
         snmp_password:

MariaDB [cacti]> select * from poller_item  where host_id = '260' limit 1\G;
*************************** 1. row ***************************
       local_data_id: 1298
           poller_id: 2
             host_id: 260
              action: 0
             present: 1
        last_updated: 2021-08-05 15:02:08
            hostname: 192.168.1.254
      snmp_community: 
        snmp_version: 2
       snmp_username:
       snmp_password:

After changing IP to 1.2.3.4

MariaDB [cacti]> select * from host   where id   = '260' limit 1\G;
*************************** 1. row ***************************
                    id: 260
             poller_id: 2
               site_id: 1
      host_template_id: 2
           description: mancinifw
              hostname: 1.2.3.4
              location:
                 notes:
           external_id:
        snmp_community: 
          snmp_version: 2

MariaDB [cacti]> select * from poller_item   where host_id   = '260' limit 1\G;
*************************** 1. row ***************************
       local_data_id: 1298
           poller_id: 2
             host_id: 260
              action: 0
             present: 1
        last_updated: 2022-02-04 12:30:47
            hostname: 192.168.1.254
      snmp_community: 
        snmp_version: 2
       snmp_username:
bmfmancini commented 2 years ago

Manually Updating record

MariaDB [cacti]> update poller_item set hostname='1.2.3.4' where host_id = 260;
Query OK, 24 rows affected (0.010 sec)
Rows matched: 24  Changed: 24  Warnings: 0

MariaDB [cacti]> select * from poller_item  where host_id = '260' limit 1\G;
*************************** 1. row ***************************
       local_data_id: 1298
           poller_id: 2
             host_id: 260
              action: 0
             present: 1
        last_updated: 2022-02-04 12:35:16
            hostname: 1.2.3.4

Hit repopulate poller cache

MariaDB [cacti]> select * from poller_item  where host_id = '260' limit 1\G;
*************************** 1. row ***************************
       local_data_id: 1298
           poller_id: 2
             host_id: 260
              action: 0
             present: 1
        last_updated: 2022-02-04 12:36:40
            hostname: 192.168.1.254
      snmp_community: 
        snmp_version: 2
       snmp_username:
       snmp_password:
TheWitness commented 2 years ago

Remote or local poller?

TheWitness commented 2 years ago

Hmm....

TheWitness commented 2 years ago

Are you sure you are "completely" up to date? How did you update the hostname? Exact steps.

bmfmancini commented 2 years ago

Steps to re-create

1.) Change IP of a device 2.) Save device 3.) Run spine you will see it showing 2 IP's the old and the new 4.) select * from poller_item you see the hostname is the old one 5.) Update the hostname manually 6.) Device is able to be polled again 7.) hit repopulate poller cache boom back to the old IP

TheWitness commented 2 years ago

Duplicate of #4508. Closing.