Obsolete:morebots

From Wikitech
(Redirected from Morebots)
morebots has been replaced by Stashbot in Wikimedia IRC channels.
Toolforge tools
morebots
Description Server Admin Log irc bot
Keywords irc, SAL, python
Author(s) Andrew Bogott, Antoine Musso, Kunal Mehta, Ori Livneh, Reedy, Ryan Lane
Maintainer(s) (View all)
Source code operations/debs/adminbot
License GNU General Public License 3.0 or later
Issues Open tasks · Report a bug

morebots is a Python server admin log updatin' bot.

morebots listens in these channels on irc.freenode.net:

We also have qa-morebots to log to Release Engineering/SAL:

  • #wikimedia-releng

Setup

It runs from Wikimedia Toolforge under the "morebots" account. Bots are started and stopped using normal Toolforge conventions.

Source code is here: <https://gerrit.wikimedia.org/r/gitweb?p=operations/debs/adminbot.git;a=tree>.

README

Several irc logbots live here.  Each is started like this:

$ sudo -iu local-morebots
$ jstart -N <botname> /usr/lib/adminbot/adminlogbot.py --config ./confs/<config-for-this-bot>

To get a list of running bots:

$ become morebots
$ qstat

To stop a running bot:

$ become morebots
$ qdel <job#>


The bots are:

analytics-logbot:  Lives in #wikimedia-analytics and logs to www.mediawiki.org/wiki/Analytics/Server_Admin_Log

labs-logbot:  Lives in #wikimedia-cloud and logs to https://wikitech.wikimedia.org/wiki/Labs_Server_Admin_Log

morebots:  Lives in #wikimedia-operations and logs to wikitech.wikimedia.org/wiki/Server_Admin_Log

qa-morebots: Lives in #wikimedia-releng and logs to https://wikitech.wikimedia.org/wiki/Release_Engineering/SAL

test-logbot:  Lives in #morebots-test and logs to www.mediawiki.org/wiki/Analytics/Server_Admin_Log
(This one is generally not running, just here as a dev tool.)

Example: restart the ops channel morebot

Ssh to login.toolforge.org

become morebots
qstat
# now find the instance running on labs
qdel <id>
./labs.sh
jstart -N production-logbot /usr/lib/adminbot/adminlogbot.py --config ./confs/production-logbot.py

Deleting Twitter status

Sometime people fill in spam on IRC which ends up on twitter account. To clear them up, you can use small python script that uses the twitter token stored in the configuration file.

$ become morebots
$ . ./venv/bin/activate
$ python
>>> import imp
>>> botconf = imp.load_source('botconf', './confs/production-logbot.py')
>>> import twitter
>>> api = twitter.Api(**botconf.twitter_api_params)
# List a status by id
>>> print api.getStatus(12345678)
# Delete it
>>> print api.DestroyStatus(12345678) 

See also