I have a command line application and I would like to have a way to be notified if an error occurs via e-mail. It is a ruby command line app, it runs via a schedule cron job.
Anything that is fairly simple to setup would be greatly appreciated.
There are a couple of services that you can use to catch Ruby errors and exceptions. Most of them provide some kind of free package and all of them relay errors via email.
Sentry - free plan for 250 events per day with 7 day history. Email notifications. All you have to do is install raven-ruby gem and set SENTRY_DSN environment variable provided by Sentry.
Honeybadger - micro plan for $19/month for 3 apps with 7 day history. You install honeybadger gem and environment variable HONEYBADGER_API_KEY and you are ready to go. They also send notifications via email.
Raygun - They provide free trail without credit card, emails are also part of their service. You need raygun4ruby gem, instructions to use it with Rails can be found here.
Other option could be that you log your exceptions into log and then you create another cron job that sends you that daily report?
I'm adding this here in the hope that the next person that wants to add honeybadger to their app doesn't struggle with the same problem I did. If you're running honeybadger outside of a rails app, you need to start the service explicity.
ENV['HONEYBADGER_API_KEY'] = 'abc123'
Honeybadger.start
# Your code here...
Honeybadger.stop
If you don't start the honeybadger service, you won't be able to send notifications. I couldn't find anywhere that mentioned this important fact.
Related
My slack bot starts answering multiple times after a while.
Restarting the slack bot container resolves the issue temporarily.
We have integrated a slack bot with our ruby app using the slack-ruby-bot gem.
See the code for a simple example of how the commands are implemented. In this command whenever a user writes to say 'any_phrase' the bot answers with that exact 'any_phrase'.
This works fine but after a while, the bot starts answering multiple times.
This was implemented with a docker container so I added logs to verify We get responses from the same machine, not from another container listening. And it's coming from the same IP.
Also, After I restart my container it resolves the issue which also indicates it's coming from the same machine.
class Say < SlackRubyBot::Commands::Base
command 'say' do |client, data, match|
client.say(channel: data.channel,text: match['expression'])
end
end
The bot should only answer once at all times. There are other commands that affect the app's data and we do not want it to run multiple times.
Looks like this may be a confirmed bug with slack-ruby-bot + celluloid, see https://github.com/slack-ruby/slack-ruby-bot/issues/236. There's a workaround of switching to async-websocket.
I've created a simple ruby script to automate my slack tags for employee's via a bot.
I was wondering if there are any services that are available to run this code constantly 24/7, this code loops on it's self and run's every 24 hours.
If your script runs on a web server and can be triggered from the Internet by a http request you can use a web CRON service.
One service that works very well and is also free is cron-job.org.
I have a console app that uses Quartz and sends out emails on a schedule. I want some basic logging so I can see if the app has started and configured (NHibernate) correctly, and also any stack traces from uncaught exceptions.
I could set up Log4net or similar to write log entries to a database table, or email them to me. But is there a simple way built into AppHarbor?
Use the LogEntries Add on. Then install the le_log4net nuget package and enter your api key in the app.config. There is a Free subscription that should tell you what you need.
I have a django application in heroku and one thing I need to do sometimes that take a little bit of time is sending emails.
This is a typical use case of using workers. Heroku offers support for workers, but I have to leave them running all the time (or start and stop them manually), which is annoying.
I would like to use a one-off process to send every email. One possibility I first thought of was using IronWorker, since I thought that I could simply add the job to ironworker's queue and it would be exectuted with a mex of 15 min delay, which is ok for me.
The problem is that with ironworker, I need to put in a zip file all the modules and their dependencies in order to run the job, so in my email use case, as I use "EmailMultiAlternatives" from "django.core.mail.message", I would need to include all the django framework in my zip file in order to be able to use it.
According to this link, it's possible to add/remove workers from the app. Is it possible to start one-off processes from the app?
Does anyone has a better solution?
Thanks in advance
I am wondering if there is a way to monitor these automatically. Right now, in our production/QA/Dev environments - we have bunch of services running that are critical to the application. We also have automatic ETLs running on windows task scheduler at a set time of the day. Currently, I have to log into each server and see if all the services are running fine or not, or check event logs for any errors, or check task scheduler to see if ETLs ran well etc etc... I have to do all the manually... I am wondering if there is a tool out there that will do the monitoring for me and send emails only in case something needs attention (like ETLs fail to run, or service get stopped for whatever reason or errors in event log etc). Thanks for the help.
Paessler PRTG Network Monitor can do all that. we have very good experience with it.
http://www.paessler.com/prtg/features
Nagios is the best tool for monitoring. It checks for the server status as well the defined services in it and if any service goes down or system goes down, sends the mail to specified mail id.
Refer the : http://nagios.org/
Thanks for the above information. I looked at the above options but they have a price.. what I did is an inexpensive way to address my concerns..
For my windows task scheduler jobs that run every night - I installed this tool/service from codeplex that is working great.
http://motash.codeplex.com/documentation#CommentsAnchor
For Windows services - I am just setting the "Recovery" Tab in each service "property" with actions to do when it fails. (like restart, reboot, or run a program which could be an email that will notify)
I built a simple tool (https://cronitor.io) for monitoring periodic/scheduled tasks. The name is a play on "cron" from the unix world, but it is system/task agnostic. All you have to do is make an http request to a unique tracking URL whenever your job runs. If your job doesn't check-in according to the rules you define then it will send you an email/sms message.
It also allows you to track the duration of your jobs by making calls at the beginning and end of your task. This can be really useful for long running jobs since you can be alerted if they start taking too long to run. For example, I once had a backup task that was scheduled every hour. About six months after I set it up it started taking longer than an hour to run!
There is https://eyewitness.io - which is for monitoring server cron tasks, queues and websites. It makes sure each of your cron jobs run when they are supposed to, and alerts you if they failed to be run.