Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Aug 21, 2018 6:45 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Mikrotik RouterOS Registration Tables (Update 11/21/2006)
PostPosted: Tue Nov 21, 2006 1:40 pm 
Offline
Cacti User
User avatar

Joined: Sun Jul 24, 2005 12:20 pm
Posts: 120
Location: Ireland, Dublin
After a great Deathmatch :lol: with ssh/mikrotik I created another set
of scripts & templates that are focused on Wireless Registration Tables

This Version of script, is only for interfaces that are in
1) Access Point Mode, with one connected mac (P2P Links)
2) Client Mode

The main script uses, awk and grep utilities, so they must be installed
on your system

===============================================

Instalation HowTo...

1. Commanding...

The installation is a bit tricky... that's because of ssh usage to retrieve data.

Login at your Routers Winbox/Console

Enable Ssh Service
Code:
/ip service set ssh disabled=no


Create a User Group Named cacti
Code:
/user group add name="cacti" policy=ssh,read,!telnet,!local,!ftp,!reboot,!write,!policy,!test,!winbox,!password,!web


Create a User <username> for Group cacti with access for Server's IP (this user should be the same with the "web server" user)
Code:
/user add name="<username>" group=cacti address=<Server IP>/32 comment="" disabled=no


You can Logout now from Winbox/Console.

Login to your Linux System as the "web server" user, usually, apache or quest.
Code:
~# login <username>
Password: <password>


Create the home directory if it doesn't exist.
Code:
~# mkdir /home/<username>


Try to Login at your Router's Ssh Console from here
Code:
~# ssh <Router IP>
The authenticity of host '<Router IP> (<Router IP>)' can't be established.
DSA key fingerprint is 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mtik.kapa.awmn' (DSA) to the list of known hosts.


Ok, now Logout from Routers Ssh
Code:
/quit


Logout from apache user
Code:
~# logout


and if you are not Logged as your 'user' or root, Login whatever you like,
just to install Cacti Scripts at Cacti Dirs :wink:.

2. Copying...
Quote:
Attachment mikrotik_wireless_interfaces.php.txt
as mikrotik_wireless_interfaces.php
at <cactidir>/scripts/
Quote:
Attachment mikrotik_wirelless_interfaces.xml
as mikrotik_wirelless_interfaces.xml
at <cactidir>/resource/script_server/


3. Templating...
Login at your Cacti Interface and import the Templates
Quote:
cacti_data_query_mikrotik_get_wireless_interfaces.xml
cacti_data_template_mikrotik_wireless_signal_strength_nic_based.xml
cacti_graph_template_mikrotik_signal_strength_nic_based.xml


4. Cacting...
Finally go at your precious Device and a Add Data Query named
Mikrotik - Get Wireless Interfaces

Create graphs ... and let it graph :wink:


Attachments:
cacti_graph_template_mikrotik_signal_strength_nic_based.xml [12.22 KiB]
Downloaded 2992 times
cacti_data_template_mikrotik_wireless_signal_strength_nic_based.xml [4.41 KiB]
Downloaded 2480 times
cacti_data_query_mikrotik_get_wireless_interfaces.xml [13.79 KiB]
Downloaded 2368 times
mikrotik_wirelless_interfaces.xml [1.29 KiB]
Downloaded 2408 times
mikrotik_wireless_interfaces.php.txt [2.04 KiB]
Downloaded 2742 times


Last edited by mojiro on Tue Nov 21, 2006 8:10 pm, edited 4 times in total.
Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 21, 2006 2:21 pm 
Offline
Cacti Moderator
User avatar

Joined: Sat May 08, 2004 12:44 pm
Posts: 12150
Location: USA
Two things

1) It's November, not October still ;-) (your posting title)

2) Sample graphs are nice for examples.

_________________

| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 21, 2006 2:43 pm 
Offline
Cacti User
User avatar

Joined: Sun Jul 24, 2005 12:20 pm
Posts: 120
Location: Ireland, Dublin
a first Sample Graph :wink:


Attachments:
graph_image.php.png
graph_image.php.png [ 18.84 KiB | Viewed 51954 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 22, 2006 9:37 am 
Offline

Joined: Fri Sep 08, 2006 5:09 am
Posts: 1
Hi everyone :)

I use some other "MikroTik wireless" scripts from mojiro. They work very nice and I 'd like to congratulate him for his work.
Well done mojiro and thank you very much! :)

About this new scripts now, I would appreciate any help or advise from anyone, concerning this issue:

I am experiencing some difficulties trying to set up these new scripts at my cacti...

I get a "Error: XML: Hash version does not exist" at every attempt to import any of these templates:
    cacti_data_query_mikrotik_get_wireless_interfaces.xml
    cacti_data_template_mikrotik_wireless_signal_strength_nic_based.xml
    cacti_graph_template_mikrotik_signal_strength_nic_based.xml

Why is this happening?

I use this software:
    cacti Version 0.8.6h
    WinXP
    Apache2.2
    PHP Version 5.2.0RC2-dev
    Cygwin 1.5.21-2
    MySql 4.0.17



Thanks in advance!

PS: Looks like the problem above is a cacti version mismatch: Error: XML: Hash version does not exist. Sorry for posting without searching enough the forum first. :oops:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 22, 2006 12:01 pm 
Offline
Cacti User
User avatar

Joined: Sun Jul 24, 2005 12:20 pm
Posts: 120
Location: Ireland, Dublin
newbieuser wrote:
PS: Looks like the problem above is a cacti version mismatch: Error: XML: Hash version does not exist. Sorry for posting without searching enough the forum first. :oops:


thats true... templates are made for cacti version i :(

newer set of templates and scripts support

rx & tx signal
rx & tx ccq
rx & tx data rates


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 8:10 am 
Offline

Joined: Thu Nov 23, 2006 6:22 am
Posts: 3
Nice but..... I have other name for interfaces not wlan :P
I thing that mayby some other solution for take the signal strenth:

interface print: (we want interface number & name)
[email protected]:~# snmpwalk -v 1 IP 1.3.6.1.2.1.2.2.1.2 -c public
IF-MIB::ifDescr.2 = STRING: ether1
IF-MIB::ifDescr.3 = STRING: ether2
IF-MIB::ifDescr.4 = STRING: wsiec1
IF-MIB::ifDescr.5 = STRING: wsiec2
IF-MIB::ifDescr.6 = STRING: wtunel2
IF-MIB::ifDescr.7 = STRING: wtunel1
IF-MIB::ifDescr.8 = STRING: LAN
IF-MIB::ifDescr.9 = STRING: WAN31
IF-MIB::ifDescr.10 = STRING: WAN9
IF-MIB::ifDescr.12 = STRING: wdstunel1
IF-MIB::ifDescr.14 = STRING: wdstunel2

interface wireless registration-table print: (we want signal strenth)
[email protected]:~# snmpwalk -v 1 IP 1.3.6.1.4.1.14988.1.1.1.2.1.3.0 -c public
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.2.111.63.110.101.6 = INTEGER: -50
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.11.107.52.61.167.7 = INTEGER: -73
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.13.243.3.90.137.5 = INTEGER: -61
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.14.46.123.148.108.5 = INTEGER: -67
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.14.46.154.55.67.5 = INTEGER: -79
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.20.120.115.55.216.5 = INTEGER: -72
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.48.79.54.155.20.4 = INTEGER: -63
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.48.79.54.180.134.5 = INTEGER: -95
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.48.79.57.3.32.5 = INTEGER: -95
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.48.79.65.217.37.5 = INTEGER: -64
SNMPv2-SMI::enterprises.14988.1.1.1.2.1.3.0.48.79.77.102.99.5 = INTEGER: -95

What do you thing mayby this solution will be bether?!
I don't know how the cacti works byt i will learn :]
P.S. Sorry form my english.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 12:34 pm 
Offline
Cacti User
User avatar

Joined: Sun Jul 24, 2005 12:20 pm
Posts: 120
Location: Ireland, Dublin
I have already created a set of mikrotik templates that are oid based.
http://forums.cacti.net/viewtopic.php?t ... t=mikrotik

but...
each time a mac connects on your ap, mikrotik creates new/random oid!

Because of this problem, I created a script that retrieves data from ssh
shell, and not from snmp, based on the interface name - whatever name.
Names are being retrieved automatically.

Also with this way I can get more information about a link, and not only
signal strength. Soon I will upload another version that retrieves really
many things...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 9:01 am 
Offline

Joined: Thu Nov 23, 2006 6:22 am
Posts: 3
Ok, you have right about oids!

I have some problems:
Quote:
1) Mikrotik - Get Wireless Interfaces (Verbose Query) Uptime Goes Backwards Success [0 Items, 0 Rows]

Quote:
Data Query Debug Information

+ Running data query [12].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/htdocs/cacti/resource/script_server/mikrotik_wirelless_interfaces.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /var/www/htdocs/cacti/scripts/mikrotik_wireless_interfaces.php 192.168.21.1 index'
+ Executing script query '/usr/bin/php -q /var/www/htdocs/cacti/scripts/mikrotik_wireless_interfaces.php 192.168.21.1 query index'
+ Executing script query '/usr/bin/php -q /var/www/htdocs/cacti/scripts/mikrotik_wireless_interfaces.php 192.168.21.1 query name'
+ Executing script query '/usr/bin/php -q /var/www/htdocs/cacti/scripts/mikrotik_wireless_interfaces.php 192.168.21.1 query cmac'
+ Found data query XML file at '/var/www/htdocs/cacti/resource/script_server/mikrotik_wirelless_interfaces.xml'
+ Found data query XML file at '/var/www/htdocs/cacti/resource/script_server/mikrotik_wirelless_interfaces.xml'
+ Found data query XML file at '/var/www/htdocs/cacti/resource/script_server/mikrotik_wirelless_interfaces.xml'

From linux shell all work fine:
Quote:
[email protected]:/var/www/htdocs/cacti/scripts# /usr/bin/php -q mikrotik_wireless_interfaces.php 192.168.21.1 query cmac
wname1!00:30:4F:36:9B:14
00:0D:F3:03:5A:89
00:0D:F3:03:0E:77
wname2!00:30:4F:36:B4:86
00:0E:2E:7B:94:6C
00:30:4F:4D:66:63
00:30:4F:41:D9:25
00:0E:2E:9A:37:43
00:14:78:73:37:D8
00:30:4F:39:03:20
00:14:78:77:11:3A
00:0F:3D:67:F7:C1
name2!00:02:6F:3F:6E:65
name1!00:0B:6B:34:3D:A7

Yes, a change user in code
Quote:
$prf = "ssh [email protected]" . $hst;

Could you tell where I have mistake?!
If you use: /interface wireless registration-table print interface=name stats it will be ....genius.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 6:47 pm 
Offline
Cacti User
User avatar

Joined: Sun Jul 24, 2005 12:20 pm
Posts: 120
Location: Ireland, Dublin
I will be back, with a great version that solves some previous mistakes.
I should have post it, but I'm in the middle of my server recovery/install/compile/config/etc


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 4:31 am 
Offline

Joined: Thu Nov 23, 2006 6:22 am
Posts: 3
I have mikrotiks. I need graphs! Maby I could help?!
I'll be a first beta tester :D


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 18, 2006 3:25 am 
Offline

Joined: Mon Dec 18, 2006 3:19 am
Posts: 3
Hi,

Can you help me with oid data query, i cannot set every rb532 ssh access, and i always have 1 or 2 wlan interface with 1 client (wds links) but i load oid type data query to 0.8.6i an oidnumber(index) cannot work because oidnumber contains mac address off connected client.
How to include mac address to index? Can you help me?
Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 18, 2006 3:41 am 
Offline
Cacti User
User avatar

Joined: Sun Jul 24, 2005 12:20 pm
Posts: 120
Location: Ireland, Dublin
It cannot work with oid, because oid paths, are beign generated dynamically...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 18, 2006 4:07 am 
Offline

Joined: Mon Dec 18, 2006 3:19 am
Posts: 3
not dynamical, only contains mac address oid build like this: oidnumbase . mac_address . interface_index


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 18, 2006 4:08 am 
Offline

Joined: Mon Dec 18, 2006 3:19 am
Posts: 3
oid_index_parse can handle this?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 14, 2007 8:01 am 
Offline

Joined: Tue Aug 14, 2007 7:59 am
Posts: 2
i have some error after execute poller.php
sh: /var/www/htdocs/cacti/scripts/mikrotik_wireless_interfaces.php: Permission denied

please help me

rgrd


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group