Graph view: unable to move items up or down

A7V

28-02-2005 13:08:16

Due to some updates on some interfaces I was updating the graph order on a list of 160 items, but was unable to. Every way I try to move graphs up or down, single or group selection, nothing happens, the list updates, but the order remains the same.
Anyway I can debug what's going wrong?

balleman

28-02-2005 16:31:01

You can do a SELECT on your database to determine if there is any inconsistency that might be causing this problem.

For example
SELECT id,pos FROM view WHERE object_id=1 AND object_type="device" ORDER BY pos;

This will list the items on the view for device #1. You want to see if there are any duplicate or non-sequential numbers in the "pos" column. If there are, they can be fixed by manually updating the database (ie, UPDATE view SET pos=222 WHERE id=211).

That seems to be the most likely cause. You might also try running a MySQL repair on the view table, just to make sure things are OK. You might also try turning database debugging on in your NetMRG config, which should reveal any errors being returned from MySQL.

Good luck, and let us know if anything works or if you need more help.

A7V

03-03-2005 09:24:17

Well, this is how I found one of the faulty views

[code1be3b04b4f7]
mysql> SELECT id,pos FROM view WHERE object_id=153 AND object_type="device" ORDER BY pos;
+-------+-----+
| id | pos |
+-------+-----+
| 11244 | 1 |
| 11245 | 2 |
| 11249 | 3 |
| 11251 | 4 |
| 11253 | 5 |
<...>
| 11645 | 115 |
| 11646 | 116 |
| 12757 | 117 |
| 11707 | 117 |
| 11706 | 117 |
| 12759 | 117 |
| 12760 | 117 |
| 12763 | 117 |
| 12767 | 117 |
| 12769 | 117 |
| 12772 | 117 |
| 12773 | 117 |
| 11705 | 117 |
| 11704 | 117 |
| 12753 | 117 |
| 12755 | 117 |
| 12054 | 117 |
| 12053 | 117 |
| 12052 | 117 |
| 12051 | 117 |
| 12050 | 117 |
| 12049 | 117 |
| 12048 | 117 |
| 12047 | 117 |
| 12046 | 117 |
| 12041 | 117 |
| 12040 | 117 |
| 12039 | 117 |
| 12038 | 117 |
| 12035 | 117 |
| 12034 | 117 |
| 11886 | 117 |
| 11885 | 117 |
| 11875 | 117 |
| 11876 | 117 |
| 11884 | 117 |
| 11879 | 117 |
| 11878 | 117 |
| 11877 | 117 |
| 11656 | 117 |
| 11651 | 117 |
| 11650 | 117 |
| 11874 | 117 |
| 11647 | 117 |
| 11648 | 117 |
| 11649 | 117 |
+-------+-----+
160 rows in set (0.00 sec)
[/code1be3b04b4f7]

I'm using your solution and it's working thanks!
Any way of automating a repair on this sort of problems?

A7V

03-03-2005 10:17:50

OK, I have another problem cry
I was updating and I noticed this

[code166a74c9ca3]
mysql> UPDATE view SET pos=128 WHERE id=11875;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 1
[/code166a74c9ca3]
This is a MySQL 3 so I can't use "SHOW WARNINGS;" as it only appeared in MySQL 4.1.
Everything I tried above 127 returned liked that. Then I saw the light 127 is the limit of an unsigned int. I checked the table and there it is
[code166a74c9ca3]
mysql> describe view;
+----------------+--------------------------------------+------+-----+-----------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------------------------------+------+-----+-----------+----------------+
| pos | tinyint(4)
[/code166a74c9ca3]

I have 160 graphs...
Is it possible to alter a datatype? (I think so)

silfreed

03-03-2005 10:31:51

That's a lot of graphs in one view, and a lot of monitors ;)

We actually already have a bug with a similar problem for the next release, see bug#395. Feel free to add your own notes to this bug.

I take it this is probably some type of switch; did you have any automated method for adding the graphs, or did you just use the interface cache?

-Doug

silfreed

03-03-2005 10:34:38

Basically all we'll be doing for the release is the following (untested)
[code129356449df]ALTER TABLE view MODIFY pos INT NOT NULL;[/code129356449df]
When you update to the next version, this query will probably still run fine as it won't really change anything, so you should still be good to upgrade.

-Doug

A7V

03-03-2005 11:22:53

[quote1757b9f4e9="silfreed"]
We actually already have a bug with a similar problem for the next release, see bug#395. Feel free to add your own notes to this bug.[/quote1757b9f4e9]
Done.

[quote1757b9f4e9="silfreed"]That's a lot of graphs in one view, and a lot of monitors ;)

I take it this is probably some type of switch; did you have any automated method for adding the graphs, or did you just use the interface cache?
[/quote1757b9f4e9]

Actually this is a container device where the interfaces are dhcp scopes and the tests are scripts I did.
I did ALTER the table and everything is now alright, thanks! D

silfreed

03-03-2005 12:18:28

Just FYI, you can attache graphs to groups as well so you don't have to create a device and then disable it.

-Doug

A7V

03-03-2005 12:28:05

[quotedb71b74b86="silfreed"]Just FYI, you can attache graphs to groups as well so you don't have to create a device and then disable it.

-Doug[/quotedb71b74b86]

Yes, I know and I use that funcionality, but here the device and the sub-devices are all virtual, just containers for the monitors, which are scripts to run with variables defined on the sub-interfaces.
I can post some more info and pics if you're interested.

silfreed

03-03-2005 12:29:10

Ah; I misunderstood.

-Doug