[asterisk-dev] systemd sd_notify() [was: Re: Journald support for Asterisk]

Matthew Jordan mjordan at digium.com
Tue May 12 20:24:32 CDT 2015


On Sun, May 10, 2015 at 3:03 AM, Tzafrir Cohen <tzafrir.cohen at xorcom.com> wrote:
> On Sat, May 09, 2015 at 10:17:24AM +0200, Ludovic Gasc wrote:
>> Hi,
>>
>> Systemd and Journald is now by default on Debian Jessie and Ubuntu 15.04,
>> as on RHEL/CentOS.
>> Journald supports syslog format, nevertheless, at least for us, the
>> structured log system provided with journald helps us to debug the
>> production.
>
> Slightly off-topic: if anybody wants to implement support for
> sd_notify(3)[1] in Asterisk, it would be nice.
>
> Suppose there would be a function called ast_daemon_changed_state()[2] to
> notify journald on end of start, start/end of reload and start of end.
> Is this information useful to anything else besides notifying systemd
> via sd_notify()?
>
> [1] http://www.freedesktop.org/software/systemd/man/sd_notify.html
>
> [2] Bad name, I know.

I'm not sure I'd create a new C API for this. Asterisk already uses
Stasis to convey a lot of this information, although today, it is only
consumed by AMI. The right way to do this would be to pull the
messages out of the manager topic and make them a bit more publicly
consumable. If that is done, you could then have a completely
independent external module that interfaces with systemd.

Since there isn't a reload start/stop, there'd have to be at least one
new message added as well.

The messages to look at are:

The publishing of Reload in loader.c::publish_reload_message
The publishing of FullyBooted in asterisk.c::publish_fully_booted
The publishing of Shutdown in asterisk.c::really_quit

-- 
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-dev mailing list