mcktr / check_fritz

Check plugin written in Go to monitor a Fritz!Box
GNU General Public License v2.0
32 stars 10 forks source link

Crashing smart_heatertemperatur #77

Closed AnneWielis closed 4 years ago

AnneWielis commented 4 years ago

Just experimenting with the plugin. Basic things arw working, but:

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x21fc7c]

goroutine 1 [running]: main.CheckSpecificSmartHeaterTemperatur(0xc665e8, 0xc665f0, 0xc665f8, 0xc66600, 0xc66608, 0x0, 0x0, 0x0, 0x0, 0xc7e254, ...) /home/travis/gopath/src/github.com/mcktr/check_fritz/cmd/check_fritz/check_smart.go:61 +0x1d4 main.main() /home/travis/gopath/src/github.com/mcktr/check_fritz/cmd/check_fritz/main.go:212 +0x1e70

Did i possibly do something wrong?

mcktr commented 4 years ago

Hi @AnneWielis,

thanks for opening this issue. Can you please share the exact CLI parameters which you used to run the check plugin (hide sensitive information like passwords)?

Best regards Michael

AnneWielis commented 4 years ago

Sure. How can i collect those?

-----Original Message----- From: Michael Insel notifications@github.com To: mcktr/check_fritz check_fritz@noreply.github.com Cc: Anne W aw@wielis.com, Mention mention@noreply.github.com Sent: Fr., 01 Mai 2020 12:45 Subject: Re: [mcktr/check_fritz] Crashing smart_heatertemperatur (#77)

Hi @AnneWielis,

thanks for opening this issue. Can you please share the exact CLI parameters which you used to run the check plugin (hide sensitive information like passwords)?

Best regards Michael

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/mcktr/check_fritz/issues/77#issuecomment-622339990

mcktr commented 4 years ago

@AnneWielis With CLI parameters I mean the exact plugin call e.g.

$ ./check_fritz.linux.amd64 -H ### -p ### -m smart_heatertemperatur

But I think I know whats wrong. In order to query a smart device you need to give the index number e.g.

$ ./check_fritz.linux.amd64 -H ### -p ### -m smart_heatertemperatur -i 6

OK - Comet DECT 03.68 - Büro 18.00 °C | 'temperature'=18.000000;;;;

Without the -i (--index) parameter I get your error too, so this is indeed a bug where the error handling is not good. Please try to set the index parameter.

mcktr commented 4 years ago

Sorry forget about the -i (--index) parameter. Use the --ain parameter instead.

$ ./check_fritz.linux.amd64 -H ### -p ### -m smart_heatertemperatur --ain "00000 0000000"

You can find the AIN in the Fritz!Box web interface in the smart device settings. Please try to set the AIN parameter. :-)

AnneWielis commented 4 years ago

OK, calling it directly works fine:

root@ubuntu:/home/ubuntu# /usr/lib/nagios/plugins/check_fritz -H 192.168.2.1 -u icinga2 -p xxx  -m smart_heatertemperatur   --ain "09995 0309722"
OK - FRITZ!DECT 301  - Home Office 19.00 °C | 'temperature'=19.000000;;;;

So, probably the config is wrong?

`apply Service "Heizung Home Office" { import "generic-service"

    check_command = "fritz"
    vars.fritz_method = "smart_heatertemperatur"
    vars.ain = "09995 0309722"

assign where host.address == "192.168.2.1" } `

mcktr commented 4 years ago

@AnneWielis If you use the CheckCommand that is provided in the README you should use:

vars.fritz_ain = "XXXX XXXXXXX"
AnneWielis commented 4 years ago

That was it, many thanks!