Bug 1181 - Make changes in unbound-control syntax
Make changes in unbound-control syntax
Product: unbound
Classification: Unclassified
Component: server
x86_64 Windows
: P5 enhancement
Assigned To: unbound team
Depends on:
  Show dependency treegraph
Reported: 2016-12-12 12:19 CET by Oleg Klucharev
Modified: 2016-12-13 11:00 CET (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Klucharev 2016-12-12 12:19:19 CET
1. unbound-control have to use data in /etc/default/unbound

I have unbound 1.5.8 installed on Ubuntu Server 16.4.

My unbound conf is not in default place (/opt/dns/unbound/etc/unbound/unbound.conf instead of /etc/unbound/unbound.conf)

I have created /etc/default/unbound:
DAEMON_OPTS="-c /opt/dns/unbound/etc/unbound/unbound.conf"    

But nevertheless, every time I run unbound-control, I have to point manually, where config file is:

/usr/bin/sudo /usr/sbin/unbound-control -c /opt/dns/unbound/etc/unbound/unbound.conf

It would be better, that if I omit "-c" parameter for unboud-control, it uses path for unbound.conf from /etc/default/unbound. It's for syntax of unbound-control to be simplier, light-weight.

2. unbound-control stats for only parameter.

Now, if I run statistics for unbound, it prints everything, and I have to use such heavy construction to get one parameter I need:

/usr/bin/sudo /usr/sbin/unbound-control -c /opt/dns/unbound/etc/unbound/unbound.conf stats | grep mem.cache.rrset | sed -e 's/^.*=//'

This construction is rather hard, when I need to obtain a lot of parameters for monitoring systems like Zabbix.

I think, it's better to change syntax for unbound-control stats, in sysctl style:
- if I run "unbound-control stats" with NO parameters, it prints everything
- if I run "unbound-control stats <parameter_name>" it prints only value of parameter I have written.
Comment 1 Oleg Klucharev 2016-12-12 12:22:37 CET
> I have created /etc/default/unbound:
> "
> DAEMON_OPTS="-c /opt/dns/unbound/etc/unbound/unbound.conf"    
> "

This file works well, when I restart unbound service. Service managed knows, where unbound config placed.
I'd like unbound-control to have the same "knowledge" about config location
Comment 2 Ralph Dolmans 2016-12-12 13:37:44 CET
Hi Oleg,

Regarding your first item: using values from /etc/default/unbound when starting the daemon is something done by your OS, not by Unbound itself. We can therefore not use values from this file in unbound-control.

Regarding your second item: thanks for this feature request. Sounds like a nice addition to me.

-- Ralph
Comment 3 Ralph Dolmans 2016-12-13 11:00:47 CET
Hi Oleg,

In addition to your second item: the unbound-munin plugin (in the contrib directory) gets all the statistics using "unbound-control stats" and writes the output to a temporary file. After that it uses grep to obtain the needed values from this file. 

This way you only need to setup one connection using unbound-control.

-- Ralph