A basic notification method you definitely should set up on your installation is, notifying by email. Most companies already have their own mail server. To keep things simple, this tutorial will show you, how to use the existing mail server as relay host.
We recommend to use Postfix as layer between your existing company mail server, and the monitoring system.
apt-get install postfix
Now we are going to set the ip address of your companies mail server at
relayhost = 192.168.1.1
To enable the new configuration, just restart postfix.
systemctl restart postfix
The mail configuration for openITCOCKPIT will be set in the file
The configuration for a local Postfix is very simple. Just set
host, port to
You can also just use the following configuration:
<?php return [ /** * Do not change this * */ 'Email' => [ 'default' => [ 'transport' => 'default', 'from' => 'you@localhost', //'charset' => 'utf-8', //'headerCharset' => 'utf-8', ], ], /** * Email configuration. * * Make your email settings down below * */ 'EmailTransport' => [ 'default' => [ 'className' => \Cake\Mailer\Transport\MailTransport::class, /* * The following keys are used in SMTP transports: */ 'host' => "127.0.0.1", 'port' => 25, 'timeout' => 30, 'username' => null, 'password' => null, 'client' => null, 'tls' => null, 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null), ], ] ];
If you want to change the email sender address, go to System System Settings
To test your new mail system, you need to create a new contact with your email address.
Now assign the contact to a service or host.
To enable the new configuration, you need to run Refresh monitoring configuration.
Select the host or service on which you have added your contact. In this example, we added the contact to the Ping. Now click on Send custom service notification. Go with the default settings and press on Save.
Check your inbox for the mail.
Run the command
oitc debug --tailf to get more information from the logs.
[31.01.2018 - 12:22:51] SERVICE NOTIFICATION: Demo Contact[376a2dcf-ba7c-40be-b5ef-1b46c59a85cf];My first Linux host[c963e9f2-a1cb-43f6-8ad6-0babe02294c9];Ping[80ff370a-deff-4b8b-a37c-677a22d2e7a6];CUSTOM (OK);service-notify-by-cake[a517bbb6-f299-4b57-9865-a4e0b70597e4];PING OK - Packet loss = 0%, RTA = 0.28 ms;John Doe;test notification
© 2021 it-novum GmbH - All Rights Reserved