X-13 Posted July 6, 2011 Posted July 6, 2011 I'm not too sure where to stick this, so I'll put it here for the time being. Currently we have 5 printer in the school. 1 connected via ethernet, the other 4 are wireless. The ethernet one has an option to set up e-mail alerts for low/no toner, paper jams, other malfunctions, but the others don't. Is there a way of setting them up to shoot off a message about errors? Bear in mind, we have no money. So buying something like papercut isn't really an option.
plexer Posted July 6, 2011 Posted July 6, 2011 Nagios or something similar to monitor them via snmp? Ben 1
X-13 Posted July 6, 2011 Author Posted July 6, 2011 Ah, I should have mentioned... We don't host/control/provide/own the e-mail server. The LEA provide it. I'm still trying to actually get the settings for it so I can set up the ethernet printer. This may even be moot depending on the LEA's reply. One day... ONE DAY... I'll actually be allowed to do my job...
Irazmus Posted July 6, 2011 Posted July 6, 2011 Another vote for Nagios. For 5 printers any old PC should do you, and you can get Nagios to alert you however you want. Ours alerts via e-Mail, SMS (via Twitter) and a display screen in the office. 1
pantscat Posted July 6, 2011 Posted July 6, 2011 SMS (via Twitter) How does that work? Would you mind telling me more? Cheers!
Irazmus Posted July 6, 2011 Posted July 6, 2011 You will need (at least) two Twitter accounts, one to post alerts to, and one (per person to be alerted) to follow the alert account. I keep the alert account's timeline private as I don't want to announce system issues to the world. You will also need to install Tweepy [ tweepy - Twitter API library for Python - Google Project Hosting ] and it's dependencies, Python 2.5+, Simplejson, Python-OAuth, python-memcached. Excuse me if I miss anything out, it's been years since I set this up. If memory serves, you will need to register a new application with Twitter. Register it online [ OAuth FAQ | dev.twitter.com ] then enter consumer secret and key in the variables below and run the first script. /usr/local/nagios/twitnag-authorize.py #!/usr/bin/env python import tweepy CONSUMER_KEY = '' CONSUMER_SECRET = '' auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth_url = auth.get_authorization_url() print 'Please authorize: ' + auth_url verifier = raw_input('PIN: ').strip() auth.get_access_token(verifier) print "ACCESS_KEY = '%s'" % auth.access_token.key print "ACCESS_SECRET = '%s'" % auth.access_token.secret Take the access secret and key produced by this script and add them, along with the consumer secret and key, into the second script, and update the proxy details as needed. /usr/local/nagios/twitnag.py #!/usr/bin/env python import sys import tweepy CONSUMER_KEY = '' CONSUMER_SECRET = '' ACCESS_KEY = '' ACCESS_SECRET = '' auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) api = tweepy.API(auth, proxy_host="proxy.county.org.uk", proxy_port="8080") api.update_status(sys.argv[1]) Then create two new definitions in your Nagios config. /usr/local/nagios/etc/objects/commands.cfg define command{ command_name notify-host-by-twitter command_line /usr/bin/python /usr/local/nagios/twitnag.py "$NOTIFICATIONTYPE$ - $HOSTNAME$-$SERVICEDESC$ - $SERVICESTATE$ - $SERVICEOUTPUT$" } define command{ command_name notify-service-by-twitter command_line /usr/bin/python /usr/local/nagios/twitnag.py "$NOTIFICATIONTYPE$ - $HOSTNAME$-$SERVICEDESC$ - $SERVICESTATE$ - $SERVICEOUTPUT$" } Add the new commands to your contact definition(s). /usr/local/nagios/etc/objects/contacts.cfg service_notification_commands notify-service-by-email notify-service-by-twitter ; send service notifications via email and twitter host_notification_commands notify-host-by-email notify-host-by-twitter ; send host notifications via email and twitter Now restart Nagios and any system alerts are sent to Twitter, and you can use their SMS gateway to receive alerts without paying* * Assuming you're on a supported mobile network. 2
pantscat Posted July 6, 2011 Posted July 6, 2011 @Irazmus - Wow! Thanks... that's absolutely brill! :-)
turnew Posted July 6, 2011 Posted July 6, 2011 I'd suggest using HP Web JetAdmin which gives you total management over your Printers (HP and Non HP). You can configure all the alerts you need. HP Web Jetadmin software
ChrisH Posted July 7, 2011 Posted July 7, 2011 @Irazmus do you know of any way to get the proxy to work under Windows? I have a few things I could use this for. I got it working how I wanted at home but it doesn't seem to recognise the proxy settings under Windows as from what I can tell, they are Linux env vars.
ChrisH Posted July 7, 2011 Posted July 7, 2011 Hmm couldn't get it to work under Linux either same error.
ChrisH Posted July 7, 2011 Posted July 7, 2011 I gave up with that in the end and managed to get a perl script called nitter2 to work under Linux at least. I would like to know if anyone has success with tweepy though.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now