Automatischer täglicher Server Check mit Ping. Es wird auf Erreichbarkeit getestet und im Fehlerfall eine Pushover Nachricht an das Handy versendet. Kann schnell und leicht erweitert werden. Einfach einen neuen inject Node mit Server URL und Zeitpunkt ergänzen.
Der Code des Flows
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
[ { "id": "57f20a8e.da9f5c", "type": "tab", "label": "Check Server", "disabled": false, "info": "" }, { "id": "59b9ce17.305c18", "type": "group", "z": "57f20a8e.da9f5c", "name": "Server Konfiguration", "style": { "fill": "#e3f3d3", "label": true }, "nodes": [ "4953dc84.0e17f4", "d57ef994.5fb108" ], "x": 34, "y": 99, "w": 372, "h": 142 }, { "id": "4953dc84.0e17f4", "type": "inject", "z": "57f20a8e.da9f5c", "g": "59b9ce17.305c18", "name": "Täglich um 7 Uhr: Check pi-org", "props": [ { "p": "payload" }, { "p": "host", "v": "pi-org", "vt": "str" } ], "repeat": "", "crontab": "00 07 * * *", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "str", "x": 210, "y": 140, "wires": [ [ "68b351bd.d04918" ] ], "icon": "node-red/timer.svg" }, { "id": "68b351bd.d04918", "type": "conf ping", "z": "57f20a8e.da9f5c", "name": "Ping Server", "host": "", "timeout": "10", "requests": "1", "x": 570, "y": 180, "wires": [ [ "94671663.6ebda", "df795b54.8baf7" ] ], "outputLabels": [ "ms" ] }, { "id": "b8edda1.bc8aea8", "type": "pushover", "z": "57f20a8e.da9f5c", "name": "Meldung per Pushover versenden", "device": "", "title": "Ping Meldung", "priority": 0, "sound": "echo", "url": "", "url_title": "", "html": false, "x": 1160, "y": 260, "wires": [] }, { "id": "94671663.6ebda", "type": "switch", "z": "57f20a8e.da9f5c", "name": "Ist der Server offline?", "property": "payload", "propertyType": "msg", "rules": [ { "t": "false" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 600, "y": 320, "wires": [ [ "f4a378f6.880978" ], [ "2befd736.b04af8" ] ], "outputLabels": [ "ja", "nein" ] }, { "id": "df795b54.8baf7", "type": "debug", "z": "57f20a8e.da9f5c", "name": "Ping Zeit in ms ausgeben", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1130, "y": 180, "wires": [] }, { "id": "f4a378f6.880978", "type": "function", "z": "57f20a8e.da9f5c", "name": "Nachricht erzeugen", "func": "var nachricht=\"Der Server \" + msg.host +\" ist nicht erreichbar.\";\nmsg.payload = nachricht;\nmsg.topic=nachricht;\n\nnode.status({fill:\"red\",shape:\"ring\",text:nachricht});\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 850, "y": 260, "wires": [ [ "b8edda1.bc8aea8" ] ] }, { "id": "d57ef994.5fb108", "type": "inject", "z": "57f20a8e.da9f5c", "g": "59b9ce17.305c18", "name": "Täglich um 7 Uhr: Check wenzlaff.de", "props": [ { "p": "payload" }, { "p": "host", "v": "wenzlaff.de", "vt": "str" } ], "repeat": "", "crontab": "00 07 * * *", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "str", "x": 230, "y": 200, "wires": [ [ "68b351bd.d04918" ] ], "icon": "node-red/timer.svg" }, { "id": "30c6ce0b.731daa", "type": "comment", "z": "57f20a8e.da9f5c", "name": "Server mit Ping auf Erreichbarkeit testen und versendet im Fehlerfall eine Pushover Nachricht", "info": "", "x": 360, "y": 40, "wires": [] }, { "id": "eebd651f.163b2", "type": "comment", "z": "57f20a8e.da9f5c", "name": "(c) 2020 Thomas Wenzlaff www.wenzlaff.info", "info": "", "x": 1110, "y": 40, "wires": [] }, { "id": "9311c782.a93cb", "type": "debug", "z": "57f20a8e.da9f5c", "name": "Ping erfolgreich", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 1100, "y": 360, "wires": [] }, { "id": "2befd736.b04af8", "type": "function", "z": "57f20a8e.da9f5c", "name": "Nachricht erzeugen", "func": "var nachricht=\"Der Server \" + msg.host +\" ist in \" + msg.payload + \" ms erreichbar.\";\nmsg.payload = nachricht;\nmsg.topic=nachricht;\n\nnode.status({fill:\"green\",shape:\"ring\",text:nachricht});\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "x": 850, "y": 360, "wires": [ [ "9311c782.a93cb" ] ] } ] |