Python Plugin: Network Pinger (Native ICMP) Topic is solved

Python and python framework

Moderator: leecollings

Kender
Posts: 10
Joined: Tuesday 03 January 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Kender »

Hi.
the same problem here:

2018-09-19 14:46:48.748 Error: (Ping Freenas) 'onHeartbeat' failed 'AttributeError':''IcmpDevice' object has no attribute 'Name''.
2018-09-19 14:46:48.748 Error: (Ping Freenas) ----> Line 187 in '/home/pi/domoticz/plugins/pinger/plugin.py', function onHeartbeat
2018-09-19 14:46:48.748 Error: (Ping Freenas) ----> Line 155 in '/home/pi/domoticz/plugins/pinger/plugin.py', function onHeartbeat

There are any news ?
The plugin is very interesting, but right now it's unusable :? :?
Thank you !
Andrea
Kender
Posts: 10
Joined: Tuesday 03 January 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Kender »

Hello,
I tried again to use the plugin ... I still have the error in the log ... but at least this time Domoticz was able to create the devices.
Now I have another problem: with the plugin enabled after 30-50 seconds the Domoticzìs web server crash and the web interface is not reachable anymore :(
In the log I can find the line: domoticz WebServer:8080 thread seems to have ended unexpectedly
As soon as I remove the plugin from the Plugin folder ... everything start to work again.
Some info:
OS: raspbian stretch
Domoticz version: 4.10857
Python: 3.5.3
Thank you for your help !!
User avatar
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by FearNaBoinne »

Would it be possible to add an option to try multiple times before calling a device down? (ie set per device the number of pings, and only call it down when all fail, and use the average of the pings as the response time for the graphs)

I currently use Monit to do this, because a single ICMP fail (which is relatively common for a busy WiFi network, esp when people start streaming and WMM kicks in) will cause a device to be down, when it actually just missed a single ping... Monit has the option to allow me to set how many attempts it should do, but doesn't give me historic ping time graphs, which pinger does...
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
nmaster
Posts: 54
Joined: Saturday 16 August 2014 17:17
Target OS: Linux
Domoticz version: 3.6304
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by nmaster »

Hi.

I'm trying to add this plugin in my domoticz system (domoticz 4.11068, python 3.7.5, alpine Linux)

I add the plugin for ping only one host: 192.168..0.1

Here is what I get in logs whereas host is up:

Code: Select all

2019-10-26 15:08:23.049 Status: (PING) Started.
2019-10-26 15:08:23.104 Status: (PING) Entering work loop.
2019-10-26 15:08:23.104 Status: (PING) Initialized version 3.1.1, author 'dnpwwo' 
 2019-10-26 15:09:03.129 (PING) Protocol set to: 'ICMP'.
2019-10-26 15:09:03.129 (PING) Transport set to: 'ICMP/IP', 192.168.0.1.
2019-10-26 15:09:03.129 (PING) Listen directive received, action initiation failed.
2019-10-26 15:09:03.129 (PING) Failed to connect to: 192.168.0.1, Description: open: Operation not permitted
2019-10-26 15:09:03.129 Error: handleListen Exception: 'open: Operation not permitted' failed connecting to '192.168.0.1'
2019-10-26 15:09:13.164 (PING) Heartbeating...
2019-10-26 15:09:13.164 (PING) Heartbeating '192.168.0.1'
2019-10-26 15:09:13.164 (PING) Protocol set to: 'ICMP'.
2019-10-26 15:09:13.164 (PING) Transport set to: 'ICMP/IP', 192.168.0.1.
2019-10-26 15:09:13.164 (PING) Listen directive received, action initiation failed.
2019-10-26 15:09:13.164 (PING) Failed to connect to: 192.168.0.1, Description: open: Operation not permitted
2019-10-26 15:09:13.164 Error: handleListen Exception: 'open: Operation not permitted' failed connecting to '192.168.0.1' 
Do you have an idea of the issue ?
User avatar
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by FearNaBoinne »

Did you follow the steps to set permission on the Domoticz' user to use the sockets for PINGing?
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
nmaster
Posts: 54
Joined: Saturday 16 August 2014 17:17
Target OS: Linux
Domoticz version: 3.6304
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by nmaster »

Where can I find these steps ?

I have no permission add for now.
User avatar
FearNaBoinne
Posts: 144
Joined: Tuesday 30 April 2019 10:08
Target OS: Linux
Domoticz version: 2021.1
Location: Sector 0
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by FearNaBoinne »

Which OS are you running on?

Try (as the domoticz user):
getcap /usr/bin/ping
... and post the output, just to check whether your domoticz user has the required rights to ping...

(The error seems to indicate it does not: Operation not permitted)
RasPi, Raspbian , Domoticz v2021.1, Z-Wave Stick, RFLink, RFXtrx433e, Hue, Tuya (Tasmota/Mosquitto with Discovery), ESP(easy), MySensors.org, OTGW
nmaster
Posts: 54
Joined: Saturday 16 August 2014 17:17
Target OS: Linux
Domoticz version: 3.6304
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by nmaster »

Im' runing Alpine linux.

With domoticz user, output of

$ getcap /bin/ping

Code: Select all

/bin/ping = cap_net_raw+ep
and ping command is working
tjabas
Posts: 562
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by tjabas »

i have installed this plugin and it seems to work good, but i get these extreme logs, why is that?

2020-01-04 22:35:31.044 (Pinger) Update 395154:'395154' (Annas telefon)
2020-01-04 22:35:31.057 (Pinger) Update 389910:'389910' (Annas telefon)
2020-01-04 22:35:31.071 (Pinger) Update 384991:'384991' (Annas telefon)
2020-01-04 22:35:31.084 (Pinger) Update 378576:'378576' (Annas telefon)
2020-01-04 22:35:31.097 (Pinger) Update 370727:'370727' (Annas telefon)
2020-01-04 22:35:31.110 (Pinger) Update 365181:'365181' (Annas telefon)
2020-01-04 22:35:31.124 (Pinger) Update 359829:'359829' (Annas telefon)
2020-01-04 22:35:31.137 (Pinger) Update 353896:'353896' (Annas telefon)
2020-01-04 22:35:31.150 (Pinger) Update 348566:'348566' (Annas telefon)
2020-01-04 22:35:31.163 (Pinger) Update 415175:'415175' (Annas telefon)
2020-01-04 22:35:31.177 (Pinger) Update 419673:'419673' (Annas telefon)
2020-01-04 22:35:31.191 (Pinger) Update 425256:'425256' (Annas telefon)
2020-01-04 22:35:31.205 (Pinger) Update 429661:'429661' (Annas telefon)
2020-01-04 22:35:31.221 (Pinger) Update 435310:'435310' (Annas telefon)
2020-01-04 22:35:31.239 (Pinger) Update 439675:'439675' (Annas telefon)
2020-01-04 22:35:31.254 (Pinger) Update 444522:'444522' (Annas telefon)
2020-01-04 22:35:31.267 (Pinger) Update 449011:'449011' (Annas telefon)
2020-01-04 22:35:31.280 (Pinger) Update 454312:'454312' (Annas telefon)
2020-01-04 22:35:31.293 (Pinger) Update 459272:'459272' (Annas telefon)
2020-01-04 22:35:31.306 (Pinger) Update 463477:'463477' (Annas telefon)
2020-01-04 22:35:31.320 (Pinger) Update 467747:'467747' (Annas telefon)
2020-01-04 22:35:31.333 (Pinger) Update 471815:'471815' (Annas telefon)
2020-01-04 22:35:31.346 (Pinger) Update 476160:'476160' (Annas telefon)
2020-01-04 22:35:31.359 (Pinger) Update 480957:'480957' (Annas telefon)
2020-01-04 22:35:31.372 (Pinger) Update 484939:'484939' (Annas telefon)
2020-01-04 22:35:31.385 (Pinger) Update 488711:'488711' (Annas telefon)
2020-01-04 22:35:31.399 (Pinger) Update 492520:'492520' (Annas telefon)
2020-01-04 22:35:31.412 (Pinger) Update 497119:'497119' (Annas telefon)
2020-01-04 22:35:31.425 (Pinger) Update 501653:'501653' (Annas telefon)
2020-01-04 22:35:31.438 (Pinger) Update 505021:'505021' (Annas telefon)
2020-01-04 22:35:31.451 (Pinger) Update 509384:'509384' (Annas telefon)
2020-01-04 22:35:31.464 (Pinger) Update 512717:'512717' (Annas telefon)
2020-01-04 22:35:31.477 (Pinger) Update 517436:'517436' (Annas telefon)
2020-01-04 22:35:31.490 (Pinger) Update 521976:'521976' (Annas telefon)
2020-01-04 22:35:31.503 (Pinger) Update 525562:'525562' (Annas telefon)
2020-01-04 22:35:31.515 (Pinger) Update 529239:'529239' (Annas telefon)
2020-01-04 22:35:31.529 (Pinger) Update 532661:'532661' (Annas telefon)
2020-01-04 22:35:31.542 (Pinger) Update 537199:'537199' (Annas telefon)
2020-01-04 22:35:31.556 (Pinger) Update 540463:'540463' (Annas telefon)
2020-01-04 22:35:31.569 (Pinger) Update 543642:'543642' (Annas telefon)
2020-01-04 22:35:31.582 (Pinger) Update 547284:'547284' (Annas telefon)
2020-01-04 22:35:31.595 (Pinger) Update 550531:'550531' (Annas telefon)
2020-01-04 22:35:31.609 (Pinger) Update 554181:'554181' (Annas telefon)
2020-01-04 22:35:31.622 (Pinger) Update 557641:'557641' (Annas telefon)
2020-01-04 22:35:31.635 (Pinger) Update 560794:'560794' (Annas telefon)
2020-01-04 22:35:31.648 (Pinger) Update 563817:'563817' (Annas telefon)
2020-01-04 22:35:31.661 (Pinger) Update 566948:'566948' (Annas telefon)
2020-01-04 22:35:31.675 (Pinger) Update 570770:'570770' (Annas telefon)
2020-01-04 22:35:31.688 (Pinger) Update 573573:'573573' (Annas telefon)
2020-01-04 22:35:31.701 (Pinger) Update 576452:'576452' (Annas telefon)
2020-01-04 22:35:31.714 (Pinger) Update 579447:'579447' (Annas telefon)
2020-01-04 22:35:31.727 (Pinger) Update 582676:'582676' (Annas telefon)
2020-01-04 22:35:31.740 (Pinger) Update 587072:'587072' (Annas telefon)
2020-01-04 22:35:31.753 (Pinger) Update 590545:'590545' (Annas telefon)
2020-01-04 22:35:31.767 (Pinger) Update 594148:'594148' (Annas telefon)
2020-01-04 22:35:31.780 (Pinger) Update 597831:'597831' (Annas telefon)
2020-01-04 22:35:31.793 (Pinger) Update 600676:'600676' (Annas telefon)
2020-01-04 22:35:31.806 (Pinger) Update 605117:'605117' (Annas telefon)
2020-01-04 22:35:31.819 (Pinger) Update 608621:'608621' (Annas telefon)
2020-01-04 22:35:31.832 (Pinger) Update 612175:'612175' (Annas telefon)
2020-01-04 22:35:31.846 (Pinger) Update 615779:'615779' (Annas telefon)
2020-01-04 22:35:31.859 (Pinger) Update 618928:'618928' (Annas telefon)
2020-01-04 22:35:31.873 (Pinger) Update 623054:'623054' (Annas telefon)
2020-01-04 22:35:31.886 (Pinger) Update 626643:'626643' (Annas telefon)
2020-01-04 22:35:31.899 (Pinger) Update 629857:'629857' (Annas telefon)
2020-01-04 22:35:31.912 (Pinger) Update 633114:'633114' (Annas telefon)
2020-01-04 22:35:31.925 (Pinger) Update 637263:'637263' (Annas telefon)
2020-01-04 22:35:31.938 (Pinger) Update 640524:'640524' (Annas telefon)
2020-01-04 22:35:31.952 (Pinger) Update 643287:'643287' (Annas telefon)
2020-01-04 22:35:31.965 (Pinger) Update 645948:'645948' (Annas telefon)
2020-01-04 22:35:31.978 (Pinger) Update 649480:'649480' (Annas telefon)
2020-01-04 22:35:31.991 (Pinger) Update 652546:'652546' (Annas telefon)
2020-01-04 22:35:32.004 (Pinger) Update 656422:'656422' (Annas telefon)
2020-01-04 22:35:32.017 (Pinger) Update 658989:'658989' (Annas telefon)
2020-01-04 22:35:32.030 (Pinger) Update 661237:'661237' (Annas telefon)
2020-01-04 22:35:32.045 (Pinger) Update 663644:'663644' (Annas telefon)
2020-01-04 22:35:32.061 (Pinger) Update 666381:'666381' (Annas telefon)
2020-01-04 22:35:32.078 (Pinger) Update 670438:'670438' (Annas telefon)
2020-01-04 22:35:32.095 (Pinger) Update 673067:'673067' (Annas telefon)
2020-01-04 22:35:32.111 (Pinger) Update 675321:'675321' (Annas telefon)
2020-01-04 22:35:32.125 (Pinger) Update 678508:'678508' (Annas telefon)
2020-01-04 22:35:32.137 (Pinger) Update 680046:'680046' (Annas telefon)
2020-01-04 22:35:32.151 (Pinger) Update 682261:'682261' (Annas telefon)
2020-01-04 22:35:32.164 (Pinger) Update 684077:'684077' (Annas telefon)
2020-01-04 22:35:32.179 (Pinger) Update 685435:'685435' (Annas telefon)
2020-01-04 22:35:32.195 (Pinger) Update 708722:'708722' (Annas telefon)

is it supposed to be like this?
cr1cr1
Posts: 16
Joined: Sunday 04 September 2016 14:08
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: France
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by cr1cr1 »

Hi,

I run Domoticz since 2016 on a RPi2 and have upgraded recently to a RPi 4 running Buster and Domoticz 2020.2.

I tried this Pinger pluging and :
- it crashed my Domoticz web server at each install and uninstall of the hardware
- it showed a cumulative value of the ping instead of an instantaneous one.
- it keeps repeating the same error message in the log :
2020-05-12 19:44:15.853 Error: (Pinger-ICMP) ----> Line 147 in '/home/pi/domoticz/plugins/Domoticz-Pinger-Plugin/plugin.py', function onMessage 2020-05-12 19:44:15.861 Error: (Pinger-ICMP) 'onMessage' failed 'AttributeError':''NoneType' object has no attribute 'Close''. 2020-05-12 19:44:15.861 Error: (Pinger-ICMP) ----> Line 185 in '/home/pi/domoticz/plugins/Domoticz-Pinger-Plugin/plugin.py', function onMessage`

I removed the plugin files and uninstalled the hardware.
FYI I have several other plugins (installed both manually or via PP-manager) that work flawlessly.

Is this Ping-ICMP plugin dead?
Domoticz on RPi2 - RFXCOM RFXtrx433E - Weather Station WMR200 - Z-WAVE.ME UZB - Fibaro FGR[M]222, FGFS101 - GR105n - Opus XT300 - téléinfo Elec.- Everspring SM103 & Vision ZD2102 - NAS Thecus N4800 - Logitech Harmony Ultimate - MXIII-G + Kodi :D
hendrik6073
Posts: 9
Joined: Wednesday 28 January 2015 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by hendrik6073 »

same here, would be nice to have this working...........
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by Number8 »

Same mess here. I tried to uninstall, the interface won't let me do it, instead it crashes DZ. What would be this instructions to remove it manually. I guess it is needed to edit database? I posted an issue in Github.
Debian buster on NUC and three RPi with buster.
manjh
Posts: 748
Joined: Saturday 27 February 2016 12:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: NL
Contact:

Re: Python Plugin: Network Pinger (Native ICMP)

Post by manjh »

I gave up on Pinger plugins, decided to create a small LUA routine myself. It calls a ping via os.execute.
Works OK, except it takes a long time when a target is not available. I tried the timeout setting but that makes no difference.
Beside that, I am happy.
In case someone is interested, here's the code:

Code: Select all

function Ping (IP)
    local handler = io.popen("ping -c 1 "..IP)
    local response = handler:read("*a")
    i, j = string.find(response, "Destination Host Unreachable")
    return (i == nil)
end
Call the function like this:

Code: Select all

        if Ping(DeviceArray[i][2]) then
            commandArray[DeviceArray[i][1]] = "On"
            -- print ("@@@@@@@@@@@@@@@ ping "..DeviceArray[i][2]..", result: on")
        else 
            commandArray[DeviceArray[i][1]] = "Off"
            -- print ("@@@@@@@@@@@@@@@ ping "..DeviceArray[i][2]..", result: off")
        end 
Where DeviceArray contains IP address as first element, and name of device to reflect the status as second element.

For timeout, I tried adding the "-W 1" parameter, but it then always returns true even for IP addresses that I know are not running.
Hans
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest