{"id":795,"date":"2019-11-11T08:35:41","date_gmt":"2019-11-11T05:35:41","guid":{"rendered":"https:\/\/ipcalc.co\/blog\/?p=795"},"modified":"2019-11-11T08:36:57","modified_gmt":"2019-11-11T05:36:57","slug":"kak-poluchat-soobshheniya-ot-zabbix-sebe-na-telefon-cherez-sms","status":"publish","type":"post","link":"https:\/\/ipcalc.co\/blog\/kak-poluchat-soobshheniya-ot-zabbix-sebe-na-telefon-cherez-sms\/","title":{"rendered":"\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 Zabbix \u0441\u0435\u0431\u0435 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0447\u0435\u0440\u0435\u0437 SMS?"},"content":{"rendered":"<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 Zabbix \u0441\u0435\u0431\u0435 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0447\u0435\u0440\u0435\u0437 SMS?<\/p>\n<p>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0443 SMS \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"http:\/\/rocketsms.by\/\">sms \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438 \u043e\u0442 RocketSMS.by<\/a>.<\/p>\n<p>1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <em>sms_gate.php<\/em> \u0432 <strong>\/usr\/lib\/zabbix\/alertscripts<\/strong> \u0438\u043b\u0438 \u0432 \u043f\u0430\u043f\u043a\u0443 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 <strong>zabbix_server.conf<\/strong>, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <strong>AlertScriptsPath<\/strong>.<\/p>\n<pre class=\"lang:php\">&lt;?php\r\nif (count($argv)&lt;3) {\r\n   die (\"Usage: \".$argv[0].\" recipientmobilenumber \\\"subject\\\" \\\"message\\\"\\n\");\r\n}\r\n\r\n$to = str_replace('+', '', trim($argv[1]));\r\n$message = trim($argv[2]);\r\n\r\nif ( $message == \"\" || !is_numeric($to) ) {\r\n   die(\"missing params!\\n\");\r\n}\r\n\r\n$message = [\r\n\"username\" =&gt; \"\u041b\u043e\u0433\u0438\u043d\",\r\n\"password\" =&gt; md5(\"\u041f\u0430\u0440\u043e\u043b\u044c\"),\r\n\"phone\" =&gt; $to,\r\n\"text\" =&gt; $message\r\n];\r\n\r\n$messageQuery = http_build_query($message);\r\n\r\ncurl_setopt($curl,CURLOPT_URL, 'http:\/\/api.rocketsms.by\/simple\/send');\r\ncurl_setopt($curl,CURLOPT_RETURNTRANSFER, true);\r\ncurl_setopt($curl,CURLOPT_POST, true);\r\ncurl_setopt($curl,CURLOPT_POSTFIELDS, $messageQuery);\r\n\r\n$result = @json_decode(curl_exec($curl), true);\r\n\r\nif($result &amp;&amp; isset($result['id'])) {\r\n   echo\"Message has been sent. MessageID=\".$result['id'];\r\n} elseif($result &amp;&amp; isset($result['error'])) {\r\n   echo\"Error occurred while sending message. ErrorID=\".$result['error'];\r\n} else {\r\n   echo\"Service error\";\r\n}\r\n\r\n?&gt;\r\n<\/pre>\n<p>2. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/p>\n<pre class=\"lang:adddarkplain\">chmod +x \/usr\/lib\/zabbix\/alertscripts\/sms_gate.php\r\nchown zabbix \/usr\/lib\/zabbix\/alertscripts\/sms_gate.php\r\n<\/pre>\n<p>3. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e SMS \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f<\/p>\n<pre class=\"lang:adddarkplain\">php \/usr\/lib\/zabbix\/alertscripts\/sms_gate.php \u041d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 (\u0411\u0435\u0437 \u0432\u0441\u044f\u043a\u0438\u0445 \u0437\u043d\u0430\u043a\u043e\u0432 + \u0438\u0442\u0434) \"Test Message\"\r\n<\/pre>\n<p>4. \u0412 Zabbix \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 <em>Administration<\/em> &gt; <em>Media Types<\/em> \u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 <strong>Media type<\/strong> \u0441 \u0442\u0438\u043f\u043e\u043c Script \u0438 \u0438\u043c\u0435\u043d\u0435\u043c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 SMSGate. \u0412 \u043f\u043e\u043b\u0435 <strong>Script Name<\/strong> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442 <em>sms_gate.php<\/em>, \u0430 \u0432 <strong>Script parameters<\/strong> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u044b <em>{ALERT.SENDTO}, {ALERT.MESSAGE}<\/em>.<\/p>\n<p><span itemprop=\"image\" itemscope itemtype=\"https:\/\/schema.org\/ImageObject\"><img itemprop=\"url image\" loading=\"lazy\" class=\"aligncenter size-full wp-image-802\" src=\"https:\/\/ipcalc.co\/blog\/wp-content\/uploads\/2019\/11\/zbx.png\" alt=\"\" width=\"823\" height=\"352\" srcset=\"https:\/\/ipcalc.co\/blog\/wp-content\/uploads\/2019\/11\/zbx.png 823w, https:\/\/ipcalc.co\/blog\/wp-content\/uploads\/2019\/11\/zbx-300x128.png 300w, https:\/\/ipcalc.co\/blog\/wp-content\/uploads\/2019\/11\/zbx-768x328.png 768w\" sizes=\"(max-width: 823px) 100vw, 823px\" \/><meta itemprop=\"width\" content=\"823\"><meta itemprop=\"height\" content=\"352\"><\/span><\/p>\n<p>5. \u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 Administration &gt; Users, \u0432\u044b\u0431\u0435\u0440\u0435\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 Media. \u041d\u0430\u0436\u043c\u0438\u0442\u0435 Add, \u0432 \u043f\u043e\u043b\u0435 Type \u0432\u044b\u0431\u0435\u0440\u0435\u0442\u0435 \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442, \u0430 \u0432 \u043f\u043e\u043b\u0435 Send to \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 Zabbix \u0441\u0435\u0431\u0435 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0447\u0435\u0440\u0435\u0437 SMS? \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0443 SMS \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c sms \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438 \u043e\u0442 RocketSMS.by. 1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 sms_gate.php \u0432&#8230;<\/p>\n","protected":false},"author":1,"featured_media":805,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,45],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 Zabbix \u0441\u0435\u0431\u0435 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0447\u0435\u0440\u0435\u0437 SMS? - IPCalc Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ipcalc.co\/blog\/kak-poluchat-soobshheniya-ot-zabbix-sebe-na-telefon-cherez-sms\/\" \/>\n<meta property=\"og:locale\" content=\"ru_RU\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 Zabbix \u0441\u0435\u0431\u0435 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0447\u0435\u0440\u0435\u0437 SMS? - IPCalc Blog\" \/>\n<meta property=\"og:description\" content=\"\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 Zabbix \u0441\u0435\u0431\u0435 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0447\u0435\u0440\u0435\u0437 SMS? \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0443 SMS \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c sms \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438 \u043e\u0442 RocketSMS.by. 1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 sms_gate.php \u0432...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ipcalc.co\/blog\/kak-poluchat-soobshheniya-ot-zabbix-sebe-na-telefon-cherez-sms\/\" \/>\n<meta property=\"og:site_name\" content=\"IPCalc Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-11T05:35:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-11-11T05:36:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ipcalc.co\/blog\/wp-content\/uploads\/2019\/11\/zabbix_logo_500x131.png\" \/>\n\t<meta property=\"og:image:width\" content=\"500\" \/>\n\t<meta property=\"og:image:height\" content=\"131\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0430\u0432\u0442\u043e\u0440\u043e\u043c\">\n\t<meta name=\"twitter:data1\" content=\"admin\">\n\t<meta name=\"twitter:label2\" content=\"\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f\">\n\t<meta name=\"twitter:data2\" content=\"1 \u043c\u0438\u043d\u0443\u0442\u0430\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ipcalc.co\/blog\/#website\",\"url\":\"https:\/\/ipcalc.co\/blog\/\",\"name\":\"IPCalc Blog\",\"description\":\"\\u041f\\u043e\\u043b\\u0437\\u0435\\u043d\\u044b\\u0435 \\u0441\\u043a\\u0440\\u0438\\u043f\\u0442\\u044b, \\u043a\\u043e\\u043d\\u0444\\u0438\\u0433\\u0438 \\u0438 \\u043c\\u043d\\u043e\\u0433\\u043e\\u0435 \\u0434\\u0440\\u0443\\u0433\\u043e\\u0435\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/ipcalc.co\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"ru-RU\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ipcalc.co\/blog\/kak-poluchat-soobshheniya-ot-zabbix-sebe-na-telefon-cherez-sms\/#primaryimage\",\"inLanguage\":\"ru-RU\",\"url\":\"https:\/\/ipcalc.co\/blog\/wp-content\/uploads\/2019\/11\/zabbix_logo_500x131.png\",\"width\":500,\"height\":131},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ipcalc.co\/blog\/kak-poluchat-soobshheniya-ot-zabbix-sebe-na-telefon-cherez-sms\/#webpage\",\"url\":\"https:\/\/ipcalc.co\/blog\/kak-poluchat-soobshheniya-ot-zabbix-sebe-na-telefon-cherez-sms\/\",\"name\":\"\\u041a\\u0430\\u043a \\u043f\\u043e\\u043b\\u0443\\u0447\\u0430\\u0442\\u044c \\u0441\\u043e\\u043e\\u0431\\u0449\\u0435\\u043d\\u0438\\u044f \\u043e\\u0442 Zabbix \\u0441\\u0435\\u0431\\u0435 \\u043d\\u0430 \\u0442\\u0435\\u043b\\u0435\\u0444\\u043e\\u043d \\u0447\\u0435\\u0440\\u0435\\u0437 SMS? - IPCalc Blog\",\"isPartOf\":{\"@id\":\"https:\/\/ipcalc.co\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ipcalc.co\/blog\/kak-poluchat-soobshheniya-ot-zabbix-sebe-na-telefon-cherez-sms\/#primaryimage\"},\"datePublished\":\"2019-11-11T05:35:41+00:00\",\"dateModified\":\"2019-11-11T05:36:57+00:00\",\"author\":{\"@id\":\"https:\/\/ipcalc.co\/blog\/#\/schema\/person\/995e074baefb3871a51b718fd5de412a\"},\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ipcalc.co\/blog\/kak-poluchat-soobshheniya-ot-zabbix-sebe-na-telefon-cherez-sms\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ipcalc.co\/blog\/#\/schema\/person\/995e074baefb3871a51b718fd5de412a\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/ipcalc.co\/blog\/#personlogo\",\"inLanguage\":\"ru-RU\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/937f7cf83eb4581f64861b93fe484e16?s=96&d=mm&r=g\",\"caption\":\"admin\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/posts\/795"}],"collection":[{"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/comments?post=795"}],"version-history":[{"count":8,"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/posts\/795\/revisions"}],"predecessor-version":[{"id":806,"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/posts\/795\/revisions\/806"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/media\/805"}],"wp:attachment":[{"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/media?parent=795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/categories?post=795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ipcalc.co\/blog\/wp-json\/wp\/v2\/tags?post=795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}