configure nagios riemann integration for monitoring - monitoring

Hi i want to know how can i configure Riemann to forward events to nagios Server This gives the API for Riemann nagios integration but there is not enough info of doing it.I am new to Riemann and i am unable to figure out a way.

You need something like the following in your riemann.config file:
(let [nagios (nagios {:host "localhost" :port 5667 :password "secret" :encryption TRIPLE_DES})]
(streams
(where (service "some-critical-service")
nagios)))
It will forward the events from service "some-critical-service" to nagios. The message sent to nagios will contain the host, state, service and description from the event.
You can find more info looking into the documentation for integrating with other systems and the api docs specific to the nagios integration

Related

Send Docker Entrypoint logs to APP in realtime

I'm looking for ideas to send Docker Logs for each runs to be sent to my application in realtime. I'm looking ways this can be done. Please let me know how this can be done.
Let me know if you have done this already or know how this can be achieved. I want to build feature similar to Netlify or vercel where they show you all build log on UI in realtime. I want something similar for my node application.
You can achieve this with Vercel and Log Drains.
Log Drains make it easy to collect logs from your deployments and forward them to archival, search, and alerting services by sending them via HTTPS, HTTP, TLS, and TCP once a new log line is created.
At the time of writing, we currently support 3 types of Log Drains:
JSON
NDJSON
Syslog
Along with Log Drains, we are introducing two new open-source integrations with logging services for you to start using them today: LogDNA and Datadog.
Install the integration: https://vercel.com/integrations?category=logging
See the announcement blog post: https://vercel.com/blog/log-drains
Note that Vercel does not allow Docker deployments, but does support Serverless Functions.

Why would I use Mandrill as opposed to the built in ActionMailer?

I've read the documentation for both services but I just am not seeing the benefits of using Mandrill as opposed to Rail's ActionMailer for transactional services. I can already customize emails with ActionMailer and send them out. Is the difference between the services a matter of volume? If so, at what point would I need to switch out ActionMailer for Mandrill?
This tutorial here is a little bit more confusing because it integrates ActionMailer with Mandrill. MailChimp/Mandrill tutorial
Can someone help me explain the difference? For my real life purpose, all I want to do is send emails to people to reverify their accounts and according to my research that would seem like a job suited for MailChimp.
Basically mailchimp/mandrill is a Saas offering they offer you a SMTP services like the amazon SES service.
ActionMailer is a part of Rails that allow interfacing with a mailing system.
from its docs you can see the following options:
Defines a delivery method. Possible values are:
:smtp (default), can be configured by using config.action_mailer.smtp_settings.
:sendmail, can be configured by using config.action_mailer.sendmail_settings.
:file: save emails to files; can be configured by using config.action_mailer.file_settings.
:test: save emails to ActionMailer::Base.deliveries array.
where the default for SMTP is using localhost (assuming your own server run a SMTP server.
In your case you should use mailchimp to deliver you message, but you will still need to use actionMailer to create the message/email itself.
It reduces complexity by allowing you to offload the sending part.
For the use that you're describing, it sounds like action mailer is just fine.
However, if
You're not interested in managing a mail server
Don't want to spend time trying to figure out if an email was actually sent (based on a client reports)
Want to impose mail quotas easily per client
Then I would recommend mandrill. We've started using it for mailing and haven't looked back since. You get reliability, expert advice / mail system setup and ultimately the biggest feature for me: delivery reporting.
Mandrill allows you to interact with their system via REST API or SMTP. If you're using their SMTP, you would still need to use ActionMailer to deliver email. All you need to do is setup your production.rb file to point to Mandrill:
config.action_mailer.smtp_settings = {
:address => "smtp.mandrillapp.com",
:port => 25, # ports 587 and 2525 are also supported with STARTTLS
:enable_starttls_auto => true, # detects and uses STARTTLS
:user_name => "username",
:password => "password", # SMTP password is any valid API key
:authentication => 'login', # Mandrill supports 'plain' or 'login'
:domain => 'example.com', # your domain to identify your server when connecting
}
So to summarize; in my opinion it's not a matter of volume, rather convenience.
I hope that helps.

Problems while trying to send emails to Hotmail or Yahoo in AWS EC2

I have a web app in AWS EC2 built on Ruby on Rails and I'm using Devise; when I try to send emails to Gmail it works, but when I try to send emails to Hotmail or Yahoo it fails...
What could it be? Is there a way to make it work without using AWS SES?
Thanks in advance
Most EC2 IP addresses are blacklisted on a lot of email services. You'll want to use something like SES, Sendgrid, or Postmark.
As Michael Fariley explained, the IP addresses are blacklisted. The reason is that its against the terms of use of AWS EC2, so most blacklists will catch a reverse dns that has Amazon EC2 within it.
However, Amazon allows you to change the reverse dns, you just need to ask. You can request it by going to https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request . Make sure that you put the reverse dns in your own dns, so the reversedns address matches the IP of the Elastic IP associated with your server.
i.e. - elastic IP = 1.1.1.1, reverse dns => revdns.mydomain.com = 1.1.1.1
Once your reverse dns has been changed, and you don't abuse it (by spamming, etc) you should be good to go, make sure to check the IP of your instance before and after to see the blacklist has been lifted.

setup POP3server for the internet

I have built several applications in delphi using the indy components suite(version 10.5.2 i think) and they all are working. I have just finished setting up the POP3server and it works locally. I can see mail sent locally on there. I have been using "localhost" as my hostname. However, i want to graduate to a higher level of function. I want to be able to receive email from the internet such from msn, gmail, yahoo ... The problem is I don't know how to do this. What address should I be using inorder to do this? So far "myhouse#localhost" has been working but only internally; can't seem to get external mail in there. Is it possible to receive mail like this? Thanks.
You need to register a domain, and then setup its DNS records (in particular, its MX records) to point to your server machine. That way, when an email is destined for any "#yourdomain" address by any sending service, it will be routed to your server machine (which needs to run an SMTP server to receive emails - POP3 is for downloading emails from your mailbox, not for putting emails into it). If your server does not have a static IP, then you need to use a service like DynDNS to mange the DNS records for you so they can account for your dynamic IP whenever it changes.
"The Internet" doesn't use POP3 to send and receive email, it uses SMTP. Here's how email "flows" from the sending computer to the receiving computer:
Server needs to send email to address: myhome#localhost. The first thing it does is isolate the server name, that's the part after "#". Next it uses DNS to lookup the SERVER IP for the computer that's supposed to receive email for the given domain. DNS contains a special record for this purpose, it's called the "MX" record. You can use command line tools like dig on Linux or nslookup on Windows to find this address, or you can use an online tool like the one found at http://www.mxtoolbox.com/ (google found this site, I assume there are many others!).
If you try to locate the MX record for your "localhost" domain you'll obviously discover it's not possible, because it's not a fully-qualified name. You first need to get yourself an domain name, so you can register a MX record!
Things you need in order to RECEIVE email
Need an "real" IP address. Servers outside your local network need to contact your server, and they obviously need a way to do it. Make sure no routers along the way block SMTP ports.
You need to register an domain name, add a MX record and point it to your "real" IP address.
Need to run SMTP server software on your box. You can use Indy components to write one.
Things you need in order to SEND email
Theoretically sending email with SMTP is the easy part. You just contact the responsible server using SMTP and send email, that's the way the protocol works: any computer in the world may send email to any SMTP server.
Practically sending email is the most difficult thing you'd have to do, mostly because foreign SMTP servers don't trust you (ever heard of SPAM?). Here are some of the things you might need to do so foreign SMTP servers accept email from you. There's no definitive list because the protocol itself doesn't include a clear authentication mechanism, so every big SMTP server out there uses it's own heuristics to decide rather to accept email from you or not. You'll find yahoo especially fun!
You need to have REVERSE DNS for the IP you're using to send email.
You need to send from one of the SMTP servers listed in DNS as your MX servers.
Your DNS records need to have long TTL (this rules out Dynamic DNS services)
Many other things...
What people usually do?
eMail is hard, there's a surprisingly small number of full SMTP servers available for your own server: Exchange, Notes, Postfix, QMail, Sendmail. They're all notoriously difficult to configure. Most people would use hosted mail services, some people would use the SMTP services provided by the ISP, and very few would install one of the mentioned services.
If you really want to write your own SMTP server go ahead, but you might want to install one of the ready-made ones before, to get a bit of eMail and DNS experience. The Linux ones are cheap to install and may also help with development (you don't want to send too much bad email to your free yahoo address, you might get blacklisted!)
POP3 is a protocol to read email from a mailbox. The TidPOP3Server component implements a POP3 server (and AFAIK it has no host property to set...), while TidPOP3 implements a POP3 client. To read mail from GMail or any POP3 server you need a TidPOP3 component. The hostname to set is the DNS name the service instructs you to use (i.e. pop3.mydomain.com).

Sendmail vs SMTP

A rails application in production should use smtp or sendmail to send mails?
SMTP is the protocol that is used by nearly all Internet hosts to send mail. This protocol is spoken by sendmail. Sendmail determines where to send your message and how.
Some mail programs (most, today) will connect directly to a mail server and speak SMTP to it. However, the "traditional" method - and arguable the better method - is to let sendmail do it.
There are two reasons for this: 1) nearly every program in UNIX that does what sendmail does is designed to be a drop-in replacement (this includes Postfix and Exim for instance); and 2) sendmail or its replacement was designed to handle mail and nothing else - by using sendmail you don't have to design a SMTP client.
The Mutt email client for UNIX is one email client that still refuses to talk SMTP directly to a mail server; a good (technical) description is on the wiki.
If you have a choice (on UNIX anyway) of talking SMTP directly or using sendmail, use sendmail - especially on servers.
As NDP already mentioned, they both work fine - that is, if your volume of messages doesn't exceed a certain amount.
For example, if your application can talk SMTP to either the local SMTP server (on IP 127.0.0.1, Port 25) or a server in the same subnet (i.e., over a low-latency link), and that server does not use any content filters before it queues a message, you will usually be able to submit a lot more mails over SMTP in a shorter time.
A useful link for Postfix may be General Mail Delivery Performance Tips - note the quote saying
Submit mail via SMTP instead of /usr/sbin/sendmail.
However, on modern hardware, if you don't plan to submit more than about 10 messages per second, you shouldn't notice any real difference.
Your question is incorrect - SMTP stands for Simple Mail Transfer Protocol whereas sendmail is the software piece to send the mail using this protocol.
Use sendmail.
They both will work fine. Action Mailer supports both.
I have used SMTP on several projects successfully. My sense was that this was a little more "standard", but I may be wrong.
I haven't used sendmail. My concern would be that it may be harder to set up in a development environment if you aren't developing directly on Unix/Linux. Where you can talk directly to any SMTP server -- even a remote one, -- you would have to install sendmail on the rails machine to get it to work.
The main problem I run into with email is sending messages asynchronously. Without a local SMTP server, a local sendmail instance is going to be more performant.
Either way, it looks pretty easy to switch if you decide you picked wrong.

Resources