How to specify the Mailbin that the icinga2 uses when invoking the mail command - ubuntu-16.04

I have icinga2 set up on a Ubuntu xenial machine. I'm using postfix to send emails, which is working properly, i.e.
echo "hello world" | mail -s "test subject" sammy#example.com
sends an email as expected.
However, when an icinga sends an email, I find the following error message:
/var/log/icinga2/debug.log
[2017-12-12 02:56:05 +0000] notice/Process: PID 5512 >
('/etc/icinga2/scripts/mail-host-notification.sh' '-4' '$
$a.mydomain.com' (PID: 5512, arguments: '/etc/icinga2/scripts/mail-host-notification.sh' '-4' '127.0.0$
Can't canonicalize "./Maildir"
./Maildir/sent: No such file or directory
Failed to save message in "./Maildir/sent" - message not sent
I know that the error is caused by the Maildir directory not being set up. However, I can't figure out how to determine which user is invoking the mail command. I also don't know what the cwd is set to in ./Maildir/sent.
I would be very grateful if anyone could help me figure out either:
Where to set up the Maildir
How to specify the user that icinga uses so as to know where to set up the Maildir
A better method to get icinga to send emails
Thanks in advance

I was able to get my icinga2 instance to mail properly by creating the Maildir in the / directory and setting the owner:group to nagios:nagios. Currently not sure how to configure this, but it is a working configuration!

Related

weblogic fail to start: Address already in use error

I have a test application that I created to start learn weblogic with Eclipse .
yesterday the jsp page was working well when I run as / on server , I got the basic page that I created .
but today I have an error message :
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]
in the browser I got this :
Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
and an other time I got this on console :
weblogic.application.ModuleException: null
null
at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:270)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
Truncated. see log file for complete stacktrace
can you explain to me what I miss , when I start the server it has the status started . thank you I can add any information .
The most probable cause is server running in debug mode and having the same debug port as an existing server on same machine.
If you have multiple domains configured for each domain running in development mode on the same machine make sure DEBUG_PORT in the setDomainEnv script has different values.
If you have multiple managed servers on the same domain and same machine, create a separate startManagedWeblogic script to start your managed servers and set the Debug Port in that script.
If you use Node Manager to start your managed servers, make sure you have the following lines set in your nodemanager.properties file, otherwise etDomainEnv.sh won't be executed:
StartScriptEnabled=true
StopScriptEnabled=true
This way, if you start the Managed Server via the Admin Console, setDomainEnv.sh will get called.
Then, you can modify the WebLogic domain script setDomainEnv.sh to set the proper DEBUG_PORT value according to the server name that needs to be started:
Use your favourite editor to change the setDomainEnv.sh file
You should find the following lines already :
if [ "${SERVER_NAME}" = "" ] ; then
SERVER_NAME="AdminServer"
export SERVER_NAME
fi
The same way, you can add :
if [ "${SERVER_NAME}" = "ManagedServer1" ] ; then
DEBUG_PORT="8454"
export DEBUG_PORT
fi
if [ "${SERVER_NAME}" = "ManagedServer2" ] ; then
DEBUG_PORT="8455"
export DEBUG_PORT
fi

How can I delete a message without mailbox file lock? I'm using Perl's Mail::Box

I run Postfix on Ubuntu 16.04 server to send "internal email" messages and a crontab Perl job to parse the related bounce messages (delivered to local mailbox /var/mail/bounceparser). The Perl code basically checks the bounceparser mailbox, parse all the messages and take some actions (delete bounced addresses, etc).
The problem is that when I try to delete those already-parsed messages using Mail::Box library, the mailbox gets locked and if a new message arrives the postfix daemon throws an exception trying to deliver the message: "cannot update mailbox /var/mail/bounceparser for user bounceparser. cannot open file: Permission denied".
Is there a way to delete a message without locking the mailbox file? If it's not possible, any other suggested strategy?
The code I use to delete the messages:
my $mbox = Mail::Box::Mbox->new(folder =>'/var/mail/bounceparser', access => 'rw');
# #mailbox_pending_deletes contains the list of message ids to delete
for my $message_id (#mailbox_pending_deletes){
$message = $mbox->find($message_id);
$message->delete;
}
my $delete_result = $mbox->close(write=>'MODIFIED');
Thank you!
As suggested by #SteffenUllrich using mailbox single file box it's not a good idea (sincerely I was using it just because it's the default Postfix configured value ^_^).
So, if you have a similar issue 1.- Configure Postfix to use Maildir instead of Mailbox for messages delivery (main.cf file):
# Set Postfix to deliver messages to Maildir user folder
home_mailbox = Maildir/
and 2.- use Mail::Box:Maildir and not the Mail::Box:Mbox I was using to find-delete the messages.
my $mbox = Mail::Box::Maildir->new(folder =>'/home/bounceparser/Maildir', access => 'rw');
# #mailbox_pending_deletes contains the list of message ids to delete
for my $message_id (#mailbox_pending_deletes){
$message = $mbox->find($message_id);
$message->delete;
}
my $delete_result = $mbox->close(write=>'MODIFIED');
Fortunately the Sisimai library I use to parse the bounce/delivery/etc messages also accepts a Maildir path to go for the messages:
my $v = Sisimai->make('/home/bounceparser/Maildir/new','hook'=>$x);
Thanks for helping!

while start the bro the error is coming "error occurred while trying to send mail: send-mail: SENDMAIL-NOTFOUND not found"

I've installed the Bro IDS but when I try to start the service an error is coming that :
Error: error occurred while trying to send mail: send-mail: SENDMAIL-NOTFOUND not found
starting ...
starting bro ...
bro terminated immediately after starting; check output with "diag"
I've already used broctl install and broctl update but still got the same error.
Kindly help
I've checked the configuration file i.e. node.cfg under /nsm/bro/etc and change the default interface eth0 with my system interface.
now bro has started
Bro can run without sendmail present but you may have been hit by a bug in Bro where it failed to include the Sendmail location in the config files. Whilst it says the bug was supposed to be fixed I've also seen the problem in Bro-2.5. So an easy fix is to do as suggested in the bug report and add the SendMail = /usr/sbin/sendmail to /usr/local/bro/etc/broctl.cfg and then rerun the deployment command:
sudo /usr/local/bro/bin/broctl deploy

Why getting this tls_socket_read error in Mutt?

I get the error in Mutt 1.5.21 (2010-09-15) with large amount (>500) of mails when accessing my mails through SSH in Chromebook but in the server Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-66-generic x86_64):
which seems to be a known bug about mutt - TLS packet with unexpected length:
mutt tls_socket_read (a tls packet with unexpected length was received was received.)
Changing set imap_keepalive=900 higher does not help.
My $HOME/.muttrc where the alias is corresponding to my real email address:
alias masi Masi Lorem <masiipsunloremlorem#gmail.com>
#create folders for sennnt mail#
send-hook . my_hdr Fcc: +.sent_`date +%Y_%B`
set sort=threads
set postponed="$HOME/mail/postponed"
mailboxes "=inbox"
mailboxes "=sent"
mailboxes "=draft"
#^u to open url
macro pager \cu |urlview\n
set imap_keepalive=900 # default
set timeout=300
## send-hook '~t ^masimasiloremhello#gmail\.fi$' 'my_hdr From: Test Hooooook From Mutt Works if you see me <user#host>'
##### Headers
## main headers
ignore *
unignore From: To: Cc: Subject: Date:
## headers in editor
set edit_headers="yes"
set editor="vim"
set beep_new
set record="$HOME/mail/sent/mails"
set mbox=+mbox
macro index,pager y "<change-folder>?<toggle-mailboxes>" "show incoming mailboxes list"
Fix
I think the update to the latest Mutt version with the patches of 2014 should fix the problem.
I am testing the upgrade in two servers and I will report if it works.
Why this bug is occurring in Mutt?
This is Ubuntu specific bug.
Switch to Debian so you avoid those bugs in the future.

Tigase refuses Tsung

I set up a tigase(5.1.5) server, and succeed to register, login and chat using Spark. But strangely I failed to use tsung(1.5.0) to perform loading test.
I use the jabber_registrer.xml as tsung script. The tsung log shows the error, it seems that tigase refuses the connection from tsung:
=INFO REPORT==== 28-Jun-2013::02:39:32 ===
ts_client:(4:<0.6960.0>) connection close while sending message !
=INFO REPORT==== 28-Jun-2013::02:39:32 ===
ts_client:(5:<0.6960.0>) Server must have closed connection upon us, waiting 10 msec
My tigase.conf:
ENC="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8"
DRV="-Djdbc.drivers=com.mysql.jdbc.Driver"
GC="-XX:+UseBiasedLocking -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:ParallelCMSThreads=8 -XX:-ReduceInitialCardMarks"
EX="-XX:+OptimizeStringConcat -XX:+DoEscapeAnalysis -XX:+UseNUMA"
JAVA_HOME="${JAVA_HOME}"
CLASSPATH=""
JAVA_OPTIONS="${GC} ${EX} ${ENC} ${DRV} -server -Xms100M -Xmx2000M -XX:PermSize=32m -XX:MaxPermSize=256m -XX:MaxDirectMemorySize=128m "
TIGASE_CONFIG="etc/tigase.xml"
TIGASE_OPTIONS=" --property-file etc/init.properties --test "
My init.properties:
config-type=--gen-config-def
--admins=admin#$xmppserver.com
--virt-hosts = www.xmppserver.com
--monitoring=jmx:9050,http:9080,snmp:9060
--auth-db=tigase-auth
--user-db=mysql
--user-db-uri=jdbc:mysql://127.0.0.1:3306/tigasedb?user=root&password=111111&useUnicode=true&characterEncoding=UTF-8
--user-repo-pool-size=12
I use db-create-mysql.sh to set up my database:
#scripts/db-create-mysql.sh tigase_user tigase_passwd tigasedb root 111111 localhost
My first goal is to create some users in tigase by tsung, but I got this error and can not create any user at all.
I ran tsung on server itself, then on a client PC, both get the same error. Is there anyone has the same problem? Thanks for any answer!
Thanks kellogs, it's my bad.
The problem is in the script of tsung. In section, the "domain" value must be the same as "virt-hosts" value in etc/init.properties of tigase.
And why tigase said "Address already in use" is because it was once aborted abnormally, kill the jvm process manually can resolve this.