Archive

Tag Archives of : script

Bandwidth usage report per IP address

I created a simple python script for collecting data from mikrotik accounting (documetation) feature. Here is my “mik_collector.py” script: all you need to change is router_ip variable to match your router IP after that you can run this script simply with this command: python mik_collector.py this will collect data from...

Send telegram messages from Mikrotik RouterOS

If you are here you probably already know what telegram is. If not you can read about it here. I created a simple script (SendToTelegram) that allows you to send messages to telegram: :global telegramMessage :local botid :local chatid set botid "sdfzgasf7126jwsd7a8s12>" # <- change this set chatid "21156423187"...

Programatically change ports on Mikrotik RouterOS

I created a simple script, that can help you change ports on your Mikrotik router How to use in my script fill array with port aliases: :global PFVports {http="80";ssh="22";https="443";ftp=23}; add a comment to your NAT rule, that starts with “PFV_” and folows with port alias like that: Now run...

BGInfo – Script for Local IP, Public IP and ISP Name

I recently created 3 scripts for BGInfo … If you need it, use it ;) Local IP.vbs I found this script at ardamis.com and adapted to my needs. I removed VMware local IP, because I don’t need it strMsg = "" strComputer = "."   Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\"...

Check log files with grep

I sometime need to check some logs and I do this with this command: egrep -o "p1|p2|...|pn" filename | sort | uniq -c Example: egrep -o "success|error|fail" test_file | sort | uniq -c Sample input: test started at 00:00 test delete fail test error test connect success test insert...

Power on/off script for Xen Running VMs on XenServer

Days ago I needed a script to power on/off my runing VMs on XenServer… In my case I needed this to power off VMs when my UPS is running on batery and later to power on when the power comes back. I was looking for a script that can...