Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Cannot run the script on a Raspberry Pi #76

Closed
zainag opened this issue Jul 7, 2021 · 2 comments
Closed

Cannot run the script on a Raspberry Pi #76

zainag opened this issue Jul 7, 2021 · 2 comments

Comments

@zainag
Copy link

zainag commented Jul 7, 2021

Sorry if this solution cannot work on a Raspberry Pi but I have a version 4B and after building unbound_telemetry I keep getting errors:

Here's my unbound.conf


# /etc/unbound/unbound.conf.d directory.
include: "/etc/unbound/unbound.conf.d/*.conf"
    server:
      # These options should be added to the existing server configuration,
      # overwriting existing values if they're there.

      # This refreshes expiring cache entries if they have been accessed with
      # less than 10% of their TTL remaining
      prefetch: yes

      # This attempts to reduce latency by serving the outdated record before
      # updating it instead of the other way around. Alternative is to increase
      # cache-min-ttl to e.g. 3600.
      cache-min-ttl: 0
      serve-expired: yes
      # I had best success leaving this next entry unset.
      # serve-expired-ttl: 3600 # 0 or not set means unlimited (I think)

      # Use about 2x more for rrset cache, total memory use is about 2-2.5x
      # total cache size. Current setting is way overkill for a small network.
      # Judging from my used cache size you can get away with 8/16 and still
      # have lots of room, but I've got the ram and I'm not using it on anything else.
      # Default is 4m/4m
      msg-cache-size: 128m
      rrset-cache-size: 256m

      # enable shm for stats, default no.  if you enable also enable
      # statistics-interval, every time it also writes stats to the
      # shared memory segment keyed with shm-key.
      #shm-enable: yes

      statistics-interval: 0
      extended-statistics: yes
      statistics-cumulative: yes

remote-control:
# Enable remote control with unbound-control(8) here.
control-enable: yes
# what interfaces are listened to for remote control.
control-interface: 127.0.0.1
# port number for remote control operations.
control-port: 8953



Unbound is running:


pi@pihole1:~/unbound-telemetry $ sudo netstat -pant | grep 8953
tcp        0      0 127.0.0.1:8953          0.0.0.0:*               LISTEN      27479/unbound

Here's the error I'm getting when I click the Metrics hyperlink:
# Unable to observe unbound statistics: Connection reset by peer (os error 104)

Log trace


pi@pihole1:~/unbound-telemetry $ sudo ./unbound-telemetry tcp -b 0.0.0.0:9167 --control-interface 127.0.0.1:8953 --log-level trace
TRACE [mio::poll] registering with poller
INFO  [unbound_telemetry::server] Listening on 0.0.0.0:9167
TRACE [mio::poll] registering with poller





TRACE [mio::poll] registering with poller
TRACE [hyper::proto::h1::conn] Conn::read_head
TRACE [hyper::proto::h1::conn] flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Busy }
TRACE [hyper::proto::h1::conn] Conn::read_head
DEBUG [hyper::proto::h1::io] read 513 bytes
TRACE [hyper::proto::h1::role] Request.parse([Header; 100], [u8; 513])
TRACE [hyper::proto::h1::role] Request.parse Complete(513)
DEBUG [hyper::proto::h1::io] parsed 11 headers
DEBUG [hyper::proto::h1::conn] incoming body is empty
TRACE [mio::poll] registering with poller
TRACE [hyper::proto::h1::conn] flushed({role=server}): State { reading: KeepAlive, writing: Init, keep_alive: Busy }
TRACE [hyper::proto::h1::conn] flushed({role=server}): State { reading: KeepAlive, writing: Init, keep_alive: Busy }
TRACE [hyper::proto::h1::conn] flushed({role=server}): State { reading: KeepAlive, writing: Init, keep_alive: Busy }
TRACE [hyper::proto::h1::conn] flushed({role=server}): State { reading: KeepAlive, writing: Init, keep_alive: Busy }
TRACE [mio::poll] deregistering handle with poller
ERROR [unbound_telemetry::server] Unable to observe unbound statistics: Connection reset by peer (os error 104)
TRACE [hyper::proto::h1::role] Server::encode status=500, body=Some(Known(79)), req_method=Some(GET)
DEBUG [hyper::proto::h1::io] flushed 200 bytes
TRACE [hyper::proto::h1::conn] flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Idle }
TRACE [hyper::proto::h1::conn] Conn::read_head
TRACE [hyper::proto::h1::conn] flushed({role=server}): State { reading: Init, writing: Init, keep_alive: Idle }
TRACE [hyper::proto::h1::conn] Conn::read_head
DEBUG [hyper::proto::h1::io] read 434 bytes
TRACE [hyper::proto::h1::role] Request.parse([Header; 100], [u8; 434])
TRACE [hyper::proto::h1::role] Request.parse Complete(434)
DEBUG [hyper::proto::h1::io] parsed 10 headers
DEBUG [hyper::proto::h1::conn] incoming body is empty
DEBUG [hyper::proto::h1::io] read 0 bytes
TRACE [hyper::proto::h1::conn] found unexpected EOF on busy connection: State { reading: KeepAlive, writing: Init, keep_alive: Busy }
TRACE [hyper::proto::h1::conn] State::close_read()
DEBUG [hyper::server::conn::spawn_all] connection error: connection closed before message completed
TRACE [mio::poll] deregistering handle with poller

Some more debug info:


pi@pihole1:~/unbound-telemetry $ sudo unbound-control stats_noreset
thread0.num.queries=728
thread0.num.queries_ip_ratelimited=0
thread0.num.cachehits=621
thread0.num.cachemiss=107
thread0.num.prefetch=60
thread0.num.zero_ttl=49
thread0.num.recursivereplies=107
thread0.requestlist.avg=0.610778
thread0.requestlist.max=9
thread0.requestlist.overwritten=0
thread0.requestlist.exceeded=0
thread0.requestlist.current.all=0
thread0.requestlist.current.user=0
thread0.recursion.time.avg=0.152097
thread0.recursion.time.median=0.0805916
thread0.tcpusage=0
total.num.queries=728
total.num.queries_ip_ratelimited=0
total.num.cachehits=621
total.num.cachemiss=107
total.num.prefetch=60
total.num.zero_ttl=49
total.num.recursivereplies=107
total.requestlist.avg=0.610778
total.requestlist.max=9
total.requestlist.overwritten=0
total.requestlist.exceeded=0
total.requestlist.current.all=0
total.requestlist.current.user=0
total.recursion.time.avg=0.152097
total.recursion.time.median=0.0805916
total.tcpusage=0
time.now=1625619187.760907
time.up=603.963341
time.elapsed=603.963341
mem.cache.rrset=402442
mem.cache.message=111528
mem.mod.iterator=16504
mem.mod.validator=60967
mem.mod.respip=0
mem.mod.subnet=41372
mem.streamwait=0
histogram.000000.000000.to.000000.000001=4
histogram.000000.000001.to.000000.000002=0
histogram.000000.000002.to.000000.000004=0
histogram.000000.000004.to.000000.000008=0
histogram.000000.000008.to.000000.000016=0
histogram.000000.000016.to.000000.000032=0
histogram.000000.000032.to.000000.000064=0
histogram.000000.000064.to.000000.000128=0
histogram.000000.000128.to.000000.000256=0
histogram.000000.000256.to.000000.000512=0
histogram.000000.000512.to.000000.001024=0
histogram.000000.001024.to.000000.002048=0
histogram.000000.002048.to.000000.004096=0
histogram.000000.004096.to.000000.008192=0
histogram.000000.008192.to.000000.016384=3
histogram.000000.016384.to.000000.032768=17
histogram.000000.032768.to.000000.065536=21
histogram.000000.065536.to.000000.131072=37
histogram.000000.131072.to.000000.262144=10
histogram.000000.262144.to.000000.524288=10
histogram.000000.524288.to.000001.000000=1
histogram.000001.000000.to.000002.000000=4
histogram.000002.000000.to.000004.000000=0
histogram.000004.000000.to.000008.000000=0
histogram.000008.000000.to.000016.000000=0
histogram.000016.000000.to.000032.000000=0
histogram.000032.000000.to.000064.000000=0
histogram.000064.000000.to.000128.000000=0
histogram.000128.000000.to.000256.000000=0
histogram.000256.000000.to.000512.000000=0
histogram.000512.000000.to.001024.000000=0
histogram.001024.000000.to.002048.000000=0
histogram.002048.000000.to.004096.000000=0
histogram.004096.000000.to.008192.000000=0
histogram.008192.000000.to.016384.000000=0
histogram.016384.000000.to.032768.000000=0
histogram.032768.000000.to.065536.000000=0
histogram.065536.000000.to.131072.000000=0
histogram.131072.000000.to.262144.000000=0
histogram.262144.000000.to.524288.000000=0
num.query.type.A=417
num.query.type.AAAA=296
num.query.type.TYPE65=15
num.query.class.IN=728
num.query.opcode.QUERY=728
num.query.tcp=0
num.query.tcpout=0
num.query.tls=0
num.query.tls.resume=0
`num.query.ipv6=0`
num.query.flags.QR=0
num.query.flags.AA=0
num.query.flags.TC=0
num.query.flags.RD=728
num.query.flags.RA=0
num.query.flags.Z=0
num.query.flags.AD=0
num.query.flags.CD=0
num.query.edns.present=0
num.query.edns.DO=0
num.answer.rcode.NOERROR=728
num.answer.rcode.FORMERR=0
num.answer.rcode.SERVFAIL=0
num.answer.rcode.NXDOMAIN=0
num.answer.rcode.NOTIMPL=0
num.answer.rcode.REFUSED=0
num.answer.rcode.nodata=36
num.query.ratelimited=0
num.answer.secure=240
num.answer.bogus=0
num.rrset.bogus=0
num.query.aggressive.NOERROR=1
num.query.aggressive.NXDOMAIN=0
unwanted.queries=0
unwanted.replies=0
msg.cache.count=351
rrset.cache.count=1795
infra.cache.count=370
key.cache.count=49
num.query.authzone.up=0
num.query.authzone.down=0
num.query.subnet=0
num.query.subnet_cache=0

Any help is greatly appreciated.

@zainag zainag changed the title Cannot run the scriupt on a Raspberry Pi Cannot run the script on a Raspberry Pi Jul 7, 2021
@svartalf
Copy link
Owner

svartalf commented Jul 9, 2021

Hi, @zainag!

According to unbound.conf(5), the following remote-control options have default values:

   server-key-file: <private key file>
        Path to the server private  key,  by  default  unbound_server.key.
        This file is generated by the unbound-control-setup utility.  This
        file is used by the unbound server, but not by unbound-control.

   server-cert-file: <certificate file.pem>
        Path to  the  server  self  signed  certificate,  by  default  un-
        bound_server.pem.   This  file  is  generated  by the unbound-con-
        trol-setup utility.  This file is used by the unbound server,  and
        also by unbound-control.

   control-key-file: <private key file>
        Path  to  the  control client private key, by default unbound_con-
        trol.key.  This file is  generated  by  the  unbound-control-setup
        utility.  This file is used by unbound-control.

   control-cert-file: <certificate file.pem>
        Path  to  the  control client certificate, by default unbound_con-
        trol.pem.  This certificate has to be signed with the server  cer-
        tificate.   This  file  is  generated by the unbound-control-setup
        utility.  This file is used by unbound-control.

My guess is that you also need to add them when calling unbound-telemetry:

    --server-cert-file <CA_FILE>       
        Server certificate file

    --control-cert-file <CERT_FILE>    
        Server control certificate file

    --control-key-file <KEY_FILE>      
        Control client private key

@zainag
Copy link
Author

zainag commented Jul 10, 2021

That was it! I finally got it up and running. Thanks so much!

Repository owner locked and limited conversation to collaborators Jul 10, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants