Archive

Posts Tagged ‘Mrogram Part-2 Python Mikrotik DNS Cache’

Mrogram Part-2 Python Mikrotik DNS Cache

March 7th, 2014 No comments

Part 2  saya membahas bagaimana python membaca nilai DNS  Cache count lalu menyimpan ke database dan memunculkan data statistik dalam bentuk grafik, hasilnya seperti dibawah

dnscache

How To Python and MIkrotik /ip dns cache

1. BUat File di Mikrotik:  
/file print file=dnscache

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

Buat Scheduler

;;; dnscache COUNT
name="dnscache" start-date=jan/02/1970 start-time=05:00:00 
interval=1m4s on-event=dnscache 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_dnscache` ( `waktu` datetime DEFAULT NULL,  `dnscache` int(40) DEFAULT NULL);                    Query OK, 0 rows 

affected (0.13 sec)

4. Isi Direktori
 Read more...