Closed jult closed 10 months ago
OK, I managed to install the python modules using apt (I think). Now I get:
python3[13633]: File "/opt/MikrotikTrafficMonitor/dbo.py", line 153, in <module>
python3[13633]: config = read_config()
python3[13633]: ^^^^^^^^^^^^^
python3[13633]: File "/opt/MikrotikTrafficMonitor/configuration.py", line 8, in read_config
python3[13633]: data = yaml.load(f.read())
python3[13633]: ^^^^^^^^^^^^^^^^^^^
python3[13633]: TypeError: load() missing 1 required positional argument: 'Loader'
systemd[1]: MikrotikTrafficMonitor.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: MikrotikTrafficMonitor.service: Failed with result 'exit-code'.
systemd[1]: MikrotikTrafficMonitor.service: Consumed 1.232s CPU time.
Any idea what to do here?
Created a merge request for the yaml load issue. I've got it working now. I'd like to have time-based links on the left-frame for Current day (Today), Yesterday, perhaps also current week, last week, if possible. And maybe even last hour, or last 6 hours of traffic or something. I'll try code this myself, but I'm new to python. I'm currently not happy with the dhcp related script you point to, and still on below v7 of RouterOS, so Accounting is fine for our use..
For the yaml you need to change it to safe_load(f.read())
, or specify loader. Due to new PyYAML version.
I'm not sure why you had to install anything through apt. You should be able to do apt install python3-pip
or apt install python-pip
and pip install -r requirements.txt
should work from there. If not you may try using virtual environment:
cd /install/folder/MikroticTrafficMonitor
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python app.py
You would also need to adjust systemd files to work with venv:
[Service]
Type=simple
ExecStart=/install/folder/MikroticTrafficMonitor/venv/bin/python app.py
WorkingDirectory=/install/folder/MikroticTrafficMonitor
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=mixed
TimeoutStopSec=5
PrivateTmp=true
other parts I think remain the same.
But yeah, Mikrotik kinda lacks in this regard. I think there are other solutions for enterprise use, better network monitoring tools that can connect to mikrotik and get all the data needed or something like that. My usecase was more a casual home use rather than anything serious.
Pretty sure if they focused a bit more on making more user friendly UI and some features like that, even if they increase the price a little, they might just kill a lot of the competition.
PR accepted
It's a can of worms. And yes, I know you point towards the 'new' scripts mentioned in mt forum, but I do not want to have to enter winbox or mikrotik web-ui to see those stats.