[SR-Users] host to get name of local server

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 5 18:41:55 CEST 2017


I haven't looked at its implementation, so be careful if it does DNS (or
system call) query every time it is used, it may slow down the
processing, in that case you can just store in another variable and use
it instead.

Cheers,
Daniel

On 05.07.17 17:01, Henry Fernandes wrote:
> I ended up using $HN().
>
> https://www.kamailio.org/wiki/cookbooks/4.2.x/pseudovariables#hn_key_-_hostname_details
>
>
>
>
>
>
> From: Daniel-Constantin Mierla <miconda at gmail.com
> <mailto:miconda at gmail.com>>
> Reply-To: "miconda at gmail.com <mailto:miconda at gmail.com>"
> <miconda at gmail.com <mailto:miconda at gmail.com>>
> Date: Monday, July 3, 2017 at 1:03 AM
> To: "Kamailio (SER) - Users Mailing List" <sr-users at lists.kamailio.org
> <mailto:sr-users at lists.kamailio.org>>, Henry Fernandes
> <henry at usinternet.com <mailto:henry at usinternet.com>>
> Subject: Re: [SR-Users] host to get name of local server
>
> Hello,
>
>
> On 29.06.17 18:11, Henry Fernandes wrote:
>> We have multiple Kamailio 4.4.x servers and I am setting up stats
>> tracking.  I would like to track the stats for each individual
>> Kamailio server separately like so:
>>
>>     kamailio_1.sip.register.count
>>     kamailio_2.sip.register.count
>>     kamailio_3.sip.register.count
>>
>> The problem is that we use one common file (in version control) for
>> our Kamailio configuration.  Thus, I can’t just hardcode the hostname
>> into the file because it will be the same for each server.
>>
>> Does anyone have a solution for me?  Is there a variable that
>> provides the hostname or is there something else I can do?
>>
>> Ideally, I’d love to be able to do something like this.
>>
>>     statsd_incr($host_name + “.sip.register.count");
>>
>>
>
> one option would be to define it via command line parameter with -A
> option. Your start script can set it using the usual shell scripts.
>
> Cheers,
> Daniel
> -- 
> Daniel-Constantin Mierla
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - www.asipto.com
> Kamailio World Conference - www.kamailioworld.com

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170705/66545357/attachment.html>


More information about the sr-users mailing list