Mikrotik RouterOS Registration Tables (Update 11/21/2006)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

User avatar
mojiro
Cacti User
Posts: 121
Joined: Sun Jul 24, 2005 12:20 pm
Location: Ireland, Dublin

Mikrotik RouterOS Registration Tables (Update 11/21/2006)

Post by mojiro »

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: Select all

/ip service set ssh disabled=no
Create a User Group Named cacti

Code: Select all

/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: Select all

/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: Select all

~# login <username>
Password: <password>
Create the home directory if it doesn't exist.

Code: Select all

~# mkdir /home/<username>
Try to Login at your Router's Ssh Console from here

Code: Select all

~# 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: Select all

/quit
Logout from apache user

Code: Select all

~# 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...
Attachment mikrotik_wireless_interfaces.php.txt
as mikrotik_wireless_interfaces.php
at <cactidir>/scripts/
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
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
mikrotik_wireless_interfaces.php.txt
(2.04 KiB) Downloaded 3138 times
mikrotik_wirelless_interfaces.xml
(1.29 KiB) Downloaded 3026 times
cacti_data_query_mikrotik_get_wireless_interfaces.xml
(13.79 KiB) Downloaded 2883 times
cacti_data_template_mikrotik_wireless_signal_strength_nic_based.xml
(4.41 KiB) Downloaded 3072 times
cacti_graph_template_mikrotik_signal_strength_nic_based.xml
(12.22 KiB) Downloaded 3504 times
Last edited by mojiro on Tue Nov 21, 2006 8:10 pm, edited 4 times in total.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Two things

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

2) Sample graphs are nice for examples.
User avatar
mojiro
Cacti User
Posts: 121
Joined: Sun Jul 24, 2005 12:20 pm
Location: Ireland, Dublin

Post by mojiro »

a first Sample Graph :wink:
Attachments
graph_image.php.png
graph_image.php.png (18.84 KiB) Viewed 65436 times
newbieuser
Posts: 1
Joined: Fri Sep 08, 2006 5:09 am

Post by newbieuser »

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:
User avatar
mojiro
Cacti User
Posts: 121
Joined: Sun Jul 24, 2005 12:20 pm
Location: Ireland, Dublin

Post by mojiro »

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
yogid
Posts: 3
Joined: Thu Nov 23, 2006 6:22 am

Post by yogid »

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)
root@yogi:~# 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)
root@yogi:~# 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.
User avatar
mojiro
Cacti User
Posts: 121
Joined: Sun Jul 24, 2005 12:20 pm
Location: Ireland, Dublin

Post by mojiro »

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...
yogid
Posts: 3
Joined: Thu Nov 23, 2006 6:22 am

Post by yogid »

Ok, you have right about oids!

I have some problems:
1) Mikrotik - Get Wireless Interfaces (Verbose Query) Uptime Goes Backwards Success [0 Items, 0 Rows]
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:
root@yogi:/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
$prf = "ssh cacti@" . $hst;
Could you tell where I have mistake?!
If you use: /interface wireless registration-table print interface=name stats it will be ....genius.
User avatar
mojiro
Cacti User
Posts: 121
Joined: Sun Jul 24, 2005 12:20 pm
Location: Ireland, Dublin

Post by mojiro »

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
yogid
Posts: 3
Joined: Thu Nov 23, 2006 6:22 am

Post by yogid »

I have mikrotiks. I need graphs! Maby I could help?!
I'll be a first beta tester :D
willyhun
Posts: 3
Joined: Mon Dec 18, 2006 3:19 am

Post by willyhun »

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!
User avatar
mojiro
Cacti User
Posts: 121
Joined: Sun Jul 24, 2005 12:20 pm
Location: Ireland, Dublin

Post by mojiro »

It cannot work with oid, because oid paths, are beign generated dynamically...
willyhun
Posts: 3
Joined: Mon Dec 18, 2006 3:19 am

Post by willyhun »

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

Post by willyhun »

oid_index_parse can handle this?
jagowan
Posts: 2
Joined: Tue Aug 14, 2007 7:59 am
Contact:

Post by jagowan »

i have some error after execute poller.php
sh: /var/www/htdocs/cacti/scripts/mikrotik_wireless_interfaces.php: Permission denied

please help me

rgrd
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests