Deleting
routers and interfaces from the harvester database in RA 9.0
Let’s start saying
that the developers don’t agree deleting devices and adding them back is not the best way to solve problems. They recommend
to repoll the device if necessary, but definitely now delete them if we still need them.
To Repoll a device
Go to the RA admin page (Admin>Enable
Interfaces and select router or device), there is a section called Enable Interfaces (Admin>Enable Interfaces and select
router or device). There you will see the routers listed. On the top right of each router, there are 3 buttons, click the
one that looks like binoculars. This is the repoll function (should come back and say profile found if successful).
Try to repoll a device and not delete it unless totally necessary.
Adding
a device back after being deleted
If we have to add it back, here are the steps to follow:
We access the harvester database
C:\Documents and Settings\nqadmin>mysql -P 3308 harvester
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
45247 to server version: 5.1.30-enterprise-commercial-advanced
Type 'help;' or '\h' for help.
Type '\c' to clear the buffer.
Check the content of the routers database, you will see a wide table with the routers and their
details. The router doesn’t appear in a human understandable IP address. You the commend below will help to display
to columns of interest, with IP and the router uptime in human. Don’t worry about the dates. This is our lab, and we
have fake data, so I would expect all kind of weird things. The command will show us if the router is indeed there.
mysql> select * from routers;
+------------+----------+-----------+------------+-------+------------+-------+--------------------+
| Router | EngineID | SysUptime | ObsTime | State
| UpdateTime | Trust | SampleRateOverride |
+------------+----------+-----------+------------+-------+------------+-------+--------------------+
| 3232237046 | 256 | 31630000 | 1285854407 |
1 | 1285854512 | 0 |
1 |
| 3232237047 | 256 | 31630000 |
1285854407 | 1 | 1285854512 | 0 |
1 |
| 3232237048 | 256 | 31630000 |
1285854407 | 1 | 1285854512 | 0 |
1 |
| 3232237045 | 256 | 15251000 |
1286183689 | 1 | 0
| 0 |
1 |
| 3232237050 | 256 | 31690000 |
1285854467 | 1 | 1285854512 | 0 |
1 |
| 3232237049 | 256 | 31690000 |
1285854467 | 1 | 1285854512 | 0 |
1 |
| 3232237051 | 256 | 31690000 |
1285854467 | 1 | 1285854512 | 0 |
1 |
+------------+----------+-----------+------------+-------+------------+-------+--------------------+
7 rows in set (0.00 sec)
mysql> select inet_ntoa(router), from_unixtime(SysUptime)
from routers;
+-------------------+--------------------------+
| inet_ntoa(router) | from_unixtime(SysUptime)
|
+-------------------+--------------------------+
| 192.168.5.246 |
1971-01-01 20:06:40 |
| 192.168.5.247 |
1971-01-01 20:06:40 |
| 192.168.5.248 |
1971-01-01 20:06:40 |
| 192.168.5.245 |
1970-06-26 07:23:20 |
| 192.168.5.250 |
1971-01-02 12:46:40 |
| 192.168.5.249 |
1971-01-02 12:46:40 |
| 192.168.5.251 |
1971-01-02 12:46:40 |
+-------------------+--------------------------+
7 rows in set (0.00 sec)
This command will delete the router from the table
mysql> delete from
routers where inet_ntoa(router) = '192.168.5.246'
Now it is time to find
which interfaces belong to that router. You can see that router has 6 interfaces, one of them are enabled:
mysql> select
inet_ntoa(router), EphID, PstID, Enabled from interfaces order by router;
+-------------------+-------+-------+---------+
| inet_ntoa(router) | EphID | PstID | Enabled |
+-------------------+-------+-------+---------+
| 192.168.5.246 | 3 | 2
| N |
| 192.168.5.246 |
1 | 3 | Y |
| 192.168.5.246
| 4 | 4 | Y
|
| 192.168.5.246 | 5
| 5 | Y |
| 192.168.5.246
| 7 | 6 | Y
|
| 192.168.5.246 | 2
| 1 | N |
| 192.168.5.247
| 1 | 3 | N
|
| 192.168.5.247 | 4
| 4 | N |
| 192.168.5.247
| 5 | 5 | N
|
| 192.168.5.247 | 7
| 6 | N |
| 192.168.5.247
| 3 | 2 | Y
|
| 192.168.5.247 | 2
| 1 | Y |
| 192.168.5.248
| 2 | 1 | Y
|
| 192.168.5.248 | 3
| 2 | Y |
| 192.168.5.249
| 2 | 1 | N
|
| 192.168.5.249 | 3
| 2 | Y |
| 192.168.5.250
| 3 | 2 | Y
|
| 192.168.5.250 | 2
| 1 | Y |
| 192.168.5.251
| 2 | 1 | Y
|
| 192.168.5.251 | 3
| 2 | Y |
+-------------------+-------+-------+---------+
20 rows in set (0.00 sec)
The command to delete all those interfaces would be:
mysql> delete from
routers where inet_ntoa(router) = '192.168.5.246'
you should see the number of matching lines, which should
be the same as the number of interfaces.
Once you finish,
restart the harvester service and wait a few minutes for it to be rediscovered.