[tap device] problem if tap goes down (solved)

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
loopx
Posts: 6
Joined: Wed Mar 15, 2006 11:38 am

[tap device] problem if tap goes down (solved)

Post by loopx »

Hello,


I've a problem when running cacti on my Gentoo Linux. All work fine the first time (I created a new device using generic snmp and used template to create graphs for my network interface). After a reboot, ... the problem come :

- all physical interface work perfectly
- virtual interface are no more monitored


In fact, if my "tap2" goes down and goes up, cacti refuse to draw graph and, may be, think that the network interface has gone and a new one has come (new because down and up ...). The problem is the same if I reboot the server or if à restart openvpn (which create the tap device).

I've think that may be because after restarting openvpn, the tap is destroy and recreated whith a new hardware ethernet adress (mac). So, I've add that to my openvpn configuration file :

Code: Select all

up "ifconfig tap2 down ; ifconfig tap2 hw ether CA:DF:36:A1:7F:EE ; ifconfig tap2 up ; echo"
With this line, i'm able to stop and start openvpn without loosing the mac adress of tap2. I've tested it and the mac is still the same, but Cacti don't understand it and create a new device or something like that :(

So, how can I do to let Cacti continue the graph of "tap2" after restart or reboot ? (the graph stop at the first stop/reboot and never continue it's work when tap goes up again).


Here is the list of interface that Cacti show to me if I try to create a new graph using my device "snmp generic" on localhost :

Code: Select all

Index 	Status 	Description 	Name (IF-MIB) 	Alias (IF-MIB) 	Type 	Speed 	Hardware Address 	IP Address  	
1	Up	lo	lo		softwareLoopback(24)	10000000		127.0.0.1	
2	Up	eth0	eth0		ethernetCsmacd(6)	100000000	00:00:10:A7:21:4C:3E	10.2.1.65	
3	Up	eth1	eth1		ethernetCsmacd(6)	100000000	00:00:04:5A:71:B7:AF		
4	Down	sit0	sit0		tunnel(131)	0			
5	Up	tap0	tap0		ethernetCsmacd(6)	10000000	00:D2:1A:5B:36:D5:B9		
6	Up	br0	br0		ethernetCsmacd(6)	10000000	00:00:04:5A:71:B7:AF	10.2.1.62	
7	Down	tap2	tap2		ethernetCsmacd(6)	10000000	00:CA:DF:36:A1:7F:EC		
8	Down	tap2	tap2		ethernetCsmacd(6)	10000000	00:1A:85:40:A0:98:A6		
9	Down	tap2	tap2		ethernetCsmacd(6)	10000000	00:CA:DF:36:A1:7F:EC		
18	Down	tap2	tap2		ethernetCsmacd(6)	10000000	00:D6:A6:71:54:D0:0E		
20	Down	tap2	tap2		ethernetCsmacd(6)	10000000	00:5E:66:CC:0F:EA:ED		
21	Down	tap2	tap2		ethernetCsmacd(6)	10000000	00:3E:61:DB:84:49:C4		
22	Down	tap2	tap2		ethernetCsmacd(6)	10000000	00:CA:DF:36:A1:7F:EE		
23	Down	tap2	tap2		ethernetCsmacd(6)	10000000	00:CA:DF:36:A1:7F:EE		
24	Up	tap2	tap2		ethernetCsmacd(6)	10000000	00:CA:DF:36:A1:7F:EE	10.2.5.2	
25	Down	tap1	tap1		ethernetCsmacd(6)	10000000	00:AE:E5:E7:F4:9B:B3		
26	Down	tap1	tap1		ethernetCsmacd(6)	10000000	00:36:C9:14:15:67:48

Any ideas ?


EDIt: after using my little command to set the mac, I've used this one : 00:CA:DF:36:A1:7F:EE

EDIT2: I've just seen that in log file :

Code: Select all

11/23/2008 03:05:03 AM - SYSTEM STATS: Time:1.2005 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:11 RRDsProcessed:8
11/23/2008 03:10:04 AM - CMDPHP: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid.  Partial Result: No Such Instance cur
11/23/2008 03:10:04 AM - CMDPHP: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid.  Partial Result: No Such Instance cur
11/23/2008 03:10:04 AM - SYSTEM STATS: Time:1.2822 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:11 RRDsProcessed:8
11/23/2008 03:15:15 AM - POLLER: Poller[0] WARNING: Cron is out of sync with the Poller Interval!  The Poller Interval is '300' seconds, with a maximum of a '300' second Cron, but 312 seconds havepassed since the last poll!
11/23/2008 03:15:20 AM - CMDPHP: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid.  Partial Result: No Such Instance cur
11/23/2008 03:15:20 AM - CMDPHP: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid.  Partial Result: No Such Instance cur
11/23/2008 03:15:21 AM - SYSTEM STATS: Time:5.7747 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:11 RRDsProcessed:8
EDIT3: because I hope to get any answer, I add a last comment :
When I restart openvpn or reboot the machine, the virtual interface (bring up by openvpn) has the same mac, same ip and the same interface name. What more can I do for let cacti understand that tap2 must be graphed in the same graph ?
Last edited by loopx on Thu Nov 27, 2008 4:59 pm, edited 1 time in total.
khufure
Cacti User
Posts: 203
Joined: Wed Oct 24, 2007 5:47 pm
Location: San Francisco, CA
Contact:

Post by khufure »

This sounds like a bug in net-snmp.

If I were you I'd graph the bandwidth using a custom script instead of the interfaces. Write a NRPE or netcat shell script that outputs the data for you. I know it's not the best envisioned method but I think it will give the quickest and most reliable results.
loopx
Posts: 6
Joined: Wed Mar 15, 2006 11:38 am

Post by loopx »

Ok, thanks for reply.


I've observed that it's snmpd the problem.


When tun/tap is re-created, the index is incremented ... But, why is Cacty not using the interface name instead of a stupid index number ?

If Cacti look for "tun0" or "tap2", there where no problem .. but in fact, the problem is in snmpd ... but what can I do ?


The only method working for me is to create tun/tap device on boot. Openvpn will not destroy tun/tap and index will not growing up. So, it's working ... but I got a last question ...

If I plug a new network interface ... the index of "tap2" will be incremented by 1. So, my graph is no more draw ... How can I set the new index of the graph ? Because it may now look for index+1 and not index ...

You understand me ?
khufure
Cacti User
Posts: 203
Joined: Wed Oct 24, 2007 5:47 pm
Location: San Francisco, CA
Contact:

Post by khufure »

As I said, I think you'll be better off NOT using the interfaces method and instead do it in a script. While you are at it you can also get other nice stats like user count through the openvpn management port. So there is at least some nice upside.
loopx
Posts: 6
Joined: Wed Mar 15, 2006 11:38 am

Post by loopx »

I would be a good idea, but ... I can't use script (no knowledge).


Have you a link which explain how to do this ?



For my problem, this continue ... If I put my laptop in "standby", and "weak up" it, index is incremented too ... But, for that problem, I've no workaround so I'll need script ... (eth0 and eth1 index are growing up also ...).
loopx
Posts: 6
Joined: Wed Mar 15, 2006 11:38 am

Post by loopx »

Ok, no need to use script!


I found the solution ... It's very simple!!!!!!


Just go to "Data Sources" menu from Cacti Web interface. After that, select the data source of the graph you've just lost and update these fields :

Index Type => ifIP
Value => IP of the interface



In fact, this is the only way to let Cacti select only 1 interface for that data source. If using ifDesc, Cacti see 2 or more interface (bug snmp) and then, take the first? which is not the good ... the last (index number) is the correct interface. So, when using "ifIP", there is only 1 interface that can have the IP.

I've not tested with mac adress, may be it would work if the lost interface loose its mac (like IP does)!!! (else, 2 mac and then, you are going to the same problem as "ifDescr" does).


So, my problem is solved :-)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests