OTRS API functions for scheduler and sending and email
Moderator: crythias
-
- Znuny newbie
- Posts: 16
- Joined: 11 May 2016, 20:01
- Znuny Version: 5.0.6
OTRS API functions for scheduler and sending and email
Hello.
I'm currently building a monitoring module for my OTRS deployment. The idea is to invoke a certain function (for example, let's call this function Kernel::System::CustomMonitoring::DeadlineCheck) through the scheduler.
This seems to be pretty straight forward here, so not a priority for now, even though I would appreciate some pointers on how to achieve this.
The main concern here is actually what this function will do. This function will send an email to a pre-configured mailbox when it runs it's query and results are found. To achieve this, I considered using PHP mail() function, however OTRS has it's own mail configuration, so my plan is to actually use whatever the API provides or OTRS uses in it's stock form.
Documentation seems to be really scarce regarding the API, so if anyone knows what function to call and which arguments it takes, that would be awesome.
Cheers.
I'm currently building a monitoring module for my OTRS deployment. The idea is to invoke a certain function (for example, let's call this function Kernel::System::CustomMonitoring::DeadlineCheck) through the scheduler.
This seems to be pretty straight forward here, so not a priority for now, even though I would appreciate some pointers on how to achieve this.
The main concern here is actually what this function will do. This function will send an email to a pre-configured mailbox when it runs it's query and results are found. To achieve this, I considered using PHP mail() function, however OTRS has it's own mail configuration, so my plan is to actually use whatever the API provides or OTRS uses in it's stock form.
Documentation seems to be really scarce regarding the API, so if anyone knows what function to call and which arguments it takes, that would be awesome.
Cheers.
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: OTRS API functions for scheduler and sending and email
Heres the documentation you are looking for:
https://otrs.github.io/doc/api/otrs/5.0 ... il.pm.html
https://otrs.github.io/doc/api/otrs/5.0 ... il.pm.html
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
-
- Znuny newbie
- Posts: 16
- Joined: 11 May 2016, 20:01
- Znuny Version: 5.0.6
Re: OTRS API functions for scheduler and sending and email
Oh wow. I completely missed that!
A big thank you for the heads up!
A big thank you for the heads up!
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: OTRS API functions for scheduler and sending and email
Very welcome. For the ITSM API I'm using this (slightly outdated) page:
http://otrs.perl-services.de/docs/ITSMC ... gitem.html
http://otrs.perl-services.de/docs/ITSMC ... gitem.html
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: OTRS API functions for scheduler and sending and email
Thanks for the hintRStraub wrote:Very welcome. For the ITSM API I'm using this (slightly outdated) page:
http://otrs.perl-services.de/docs/ITSMC ... gitem.html

Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny guru
- Posts: 2210
- Joined: 13 Mar 2014, 09:16
- Znuny Version: 6.0.14
- Real Name: Rolf Straub
Re: OTRS API functions for scheduler and sending and email
Oh that was easy. Didn't realize you were involved in that page as well 
Thanks a bunch!

Thanks a bunch!
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
-
- Znuny newbie
- Posts: 16
- Joined: 11 May 2016, 20:01
- Znuny Version: 5.0.6
Re: OTRS API functions for scheduler and sending and email
Okay, so I used Kernel::System::Email as per the documentation, but it's not sending any emails. For now I just set it up using my own account as destination and a dummy address as origin. I also set up a wrapper to invoke my function at Kernel::System::Console::Command::Maint::CustomMonitoring::RunAlarmCheck (simply invokes the function at System::CustomMonitoring::DeadlineCheck which holds all the logic.
I implemented a final check as per the example and I get a successful output out of it. But no email is received in my inbox. Tried switching inboxes to a generic gmail one, to no avail.
Now how can I debug the Send function any further?
I implemented a final check as per the example and I get a successful output out of it. But no email is received in my inbox. Tried switching inboxes to a generic gmail one, to no avail.
Now how can I debug the Send function any further?
-
- Znuny newbie
- Posts: 16
- Joined: 11 May 2016, 20:01
- Znuny Version: 5.0.6
Re: OTRS API functions for scheduler and sending and email
Also, just to add, I removed the Sign and Crypt structures from the input to the Send function. If I tried to use them like in the example, I got this error:
Code: Select all
Message: Failed creation of crypt object
Traceback (27081):
Module: Kernel::System::Email::Send Line: 650
Module: Kernel::System::CustomMonitoring::DeadlineCheck Line: 152
Module: Kernel::System::Console::Command::Maint::CustomMonitoring::RunAlarmCheck::Run Line: 41
Module: (eval) Line: 436
Module: Kernel::System::Console::BaseCommand::Execute Line: 430
Module: Kernel::System::Console::InterfaceConsole::Run Line: 86
Module: bin/otrs.Console.pl Line: 38
-
- Znuny newbie
- Posts: 16
- Joined: 11 May 2016, 20:01
- Znuny Version: 5.0.6
Re: OTRS API functions for scheduler and sending and email
Okay scratch that. It is probably something wrong with my enterprise inbox.
The messages just popped up in the gmail inbox all of a sudden.
Cheers!
The messages just popped up in the gmail inbox all of a sudden.
Cheers!