Archive

Posts Tagged ‘Mrogram Part-3 Python Mikrotik IPv4 connection’

Mrogram Part-3 Python Mikrotik IPv4 connection

March 7th, 2014 No comments

Part 3  saya membahas bagaimana python membaca nilai IPv4 Firewall Connection  count lalu menyimpan ke database dan memunculkan data statistik dalam bentuk grafik, hasilnya seperti dibawah

ipfirewall

1. Buat File di Mikrotik:  
/file print file=ipfirewall

2. Buat Script dan Scheduler di Mikrotik:
:local first [/ip ipfirewall connection print count-only brief];
/file set ipfirewall.txt contents=  "  $first "

Buat Scheduler

;;; ipfirewall COUNT
name="ipfirewall" start-date=jan/02/1970 start-time=05:00:00 
interval=1m4s on-event=ipfirewall owner=mahmudsaja 
policy=reboot,read,write,policy,test,password,sniff,sensitive 
run-count=12353 next-run=10:36:00 

3. Buat Database
mysql> show tables;
+--------------------+
| Tables_in_mikrotik |
+--------------------+
| user_host          |
| user_sso
| user_dnscache      |
+--------------------+
2 rows in set (0.00 sec)

mysql> CREATE TABLE `user_ipfirewall` ( `waktu` datetime DEFAULT NULL,  `ipfirewall` int(40) DEFAULT NULL);                    Query OK, 0 rows 

affected (0.13 sec)
 Read more...