Monitoring bots

in #python8 years ago (edited)

My STEEM related bots are actually long-running processes. They sometimes stop, fail and go offline. It might be an unhandled exception, a network issue, a temporary steem public node issue, etc. You should always log these fuckups.

However, most of the time a restart of the bot is enough to keep things going.


Famous quote of It Crowd.

I use Supervisor to control the processes of the bots. It monitors the processes and can auto-restart if something happens like that. It will also auto-start the scripts if an os reboot happens.

For example, I have curobot as my personal curation bot. It's current config on my machine:

command = /var/bots/curobot-env/bin/curobot /var/bots/curobot/config.json
stdout_logfile = /var/logs/curobot.log
stderr_logfile = /var/logs/curobot.log
redirect_stderr = True
redirect_stdout = True
autorestart = True
environment = POSTING_KEY=foo

Supervisor daemon also has a neat web interface that, you can actually monitor and manage your processes via the web browser.

A screenshot from my supervisord setup


I use it for the last 4-5 years. It's a rock-solid solution to manage and monitor the processes. Check supervisord.org for more info.

Sort:  

I’ve been using pm2 a lot lately, really like it a lot.

I'm only using pm2 - super helpful and very reliable.

One day I will tell you, what behemoth I build for steem.
But today is not that day.
Just that much.
I use crontab:)

It's not actually a replacement for crontab. I also use crontab for some bots.

This is for the scripts designed to run forever, always listening new blocks, transactions, etc.

I tried that too, but streaming is way to unreliable on my old vps for steem. And nodes too.
I have everything in funny cronjobs.
And lost them at one point to crontab - r
Don't execute that!! E and R are just to close on my mobile phones keyboard.
Now, all my crontab are also on my git backup:)
But I repeat myself.

I've been messing around with drdoogie by @inertia, how is your curobot different?
Honestly I'm still so green that I dont get how steembottracker works, but it seems like I'm such a lowlevel plankton that paying for upvotes is basically a waste of my time unless I'm willing to shell out big votes ...