{"id":214273,"date":"2014-03-01T13:02:03","date_gmt":"2014-03-01T09:02:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=214273"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=214273","title":{"rendered":"<span class=\"post_title\">\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043e\u043d\u043b\u0430\u0439\u043d<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0411\u044b\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u0446\u0435\u043b\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. <br \/>  \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 Nagios \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 4 \u0440\u0430\u0437\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c ( \u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c 7-15 \u043c\u0438\u043d\u0443\u0442 \u0434\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0430 \u043f\u0438\u0441\u044c\u043c\u0430). <br \/>  \u041d\u043e \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0431\u0435\u0434\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u00ab\u0432\u0441\u0435 \u043e\u043a\u00bb \u0432 \u043b\u044e\u0431\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044f \u043d\u0435 \u0437\u0430 \u043a\u043e\u043c\u043f\u043e\u043c \u0438 \u043d\u0435 \u043b\u0430\u0437\u0438\u0442\u044c \u0432 \u043f\u043e\u0447\u0442\u0443 \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437. <\/p>\n<h5>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b<\/h5>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d7f\/381\/970\/d7f381970f4fefd15aa7ae1591beac4e.gif\"\/><br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u044f \u043d\u0430\u043a\u0438\u0434\u0430\u043b \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 perl \u2014 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"perl\">#!\/usr\/bin\/perl use strict; use Data::Dumper;  use CGI; use Nagios::Scrape; use HTML::Template; use POSIX qw(strftime);  my $foo = Nagios::Scrape-&gt;new(username =&gt; 'nagiosadmin', password =&gt; YOUR_PASSWORD, url =&gt;  'http:\/\/127.0.0.1\/nagios\/cgi-bin\/status.cgi'); my @service_alerts = $foo-&gt;get_service_status(); my @host_alerts = $foo-&gt;get_host_status();   my $status = @service_alerts + @host_alerts; my $t = HTML::Template-&gt;new( filehandle =&gt; \\*DATA, die_on_bad_params =&gt; 0 ); my $pubDate = POSIX::strftime( &quot;%a, %d %b %Y %H:%M:00 +0400&quot;, localtime ); $t-&gt;param( service_alerts =&gt; \\@service_alerts , host_alerts =&gt; \\@host_alerts , status =&gt; $status , pd =&gt; $pubDate  );  print &quot;Content-type: application\/xml  \\n\\n&quot;; print $t-&gt;output();  __DATA__ &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;rss xmlns:atom=&quot;http:\/\/www.w3.org\/2005\/Atom&quot; version=&quot;2.0&quot;&gt; &lt;channel&gt; &lt;pubDate&gt;&lt;TMPL_VAR NAME=&quot;pd&quot;&gt;&lt;\/pubDate&gt; &lt;link&gt;http:\/\/ya.ru&lt;\/link&gt; &lt;TMPL_UNLESS status&gt;                 &lt;title&gt;OK&lt;\/title&gt;                 &lt;description&gt;OK - all&lt;\/description&gt;                 &lt;item&gt;                         &lt;title&gt;ALL OK&lt;\/title&gt;                         &lt;description&gt;                                 ALL OK &lt;TMPL_VAR NAME=&quot;pd&quot;&gt;                         &lt;\/description&gt;                         &lt;link&gt;http:\/\/ya.ru&lt;\/link&gt;                 &lt;\/item&gt; &lt;TMPL_ELSE&gt;                 &lt;title&gt;NOT OK&lt;\/title&gt;                 &lt;description&gt;NOT OK&lt;\/description&gt; &lt;\/TMPL_UNLESS&gt; &lt;TMPL_LOOP service_alerts&gt;         &lt;item&gt;                 &lt;title&gt;SERVICE alert - &lt;TMPL_VAR NAME=&quot;host&quot;&gt;&lt;\/title&gt;                 &lt;description&gt;                         &lt;TMPL_VAR NAME=&quot;information&quot;&gt;; attempts - &lt;TMPL_VAR NAME=&quot;attempts&quot;&gt;; service_type - &lt;TMPL_VAR NAME=&quot;service&quot;&gt;; Downtime - &lt;TMPL_VAR NAME=&quot;duration&quot;&gt;;                         LastCheck - &lt;TMPL_VAR NAME=&quot;time&quot;&gt;;                 &lt;\/description&gt;                 &lt;link&gt;http:\/\/ya.ru&lt;\/link&gt;         &lt;\/item&gt; &lt;\/TMPL_LOOP&gt; &lt;TMPL_LOOP  host_alerts&gt;         &lt;item&gt;                 &lt;title&gt;HOST  alert - &lt;TMPL_VAR NAME=&quot;host&quot;&gt;&lt;\/title&gt;                 &lt;description&gt;                         &lt;TMPL_VAR NAME=&quot;information&quot;&gt;; attempts - &lt;TMPL_VAR NAME=&quot;attempts&quot;&gt;; Downtime - &lt;TMPL_VAR NAME=&quot;duration&quot;&gt;;                         LastCheck - &lt;TMPL_VAR NAME=&quot;time&quot;&gt;;                 &lt;\/description&gt;                 &lt;link&gt;http:\/\/ya.ru&lt;\/link&gt;         &lt;\/item&gt; &lt;\/TMPL_LOOP&gt;  &lt;\/channel&gt; &lt;\/rss&gt; <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435:  <\/p>\n<ol>\n<li>\u041f\u043e\u043b\u043e\u0436\u0438\u043b \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 \/var\/www\/cgi-bin <\/li>\n<li>\u0423\u043a\u0430\u0437\u0430\u043b \u0441\u0432\u043e\u0438 \u043b\u043e\u0433\u0438\u043d\u044b \u0438 \u043f\u0430\u0440\u043e\u043b\u0438 \u043e\u0442 nagios<\/li>\n<li>\u0414\u0430\u043b \u0435\u043c\u0443 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435:\n<pre><code class=\"bash\">chmod 750 nagios_status_rss.cgi<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u043b \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043c\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0430\u043d\u0434\u0440\u043e\u0438\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=de.j4velin.rssWidget&amp;hl=ru\">Simple RSS Widget<\/a>.<br \/>  Simple RSS Widget \u2014 \u0432\u044b\u0432\u0435\u043b \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u044d\u043a\u0440\u0430\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b. <br \/>  \u0418 \u0442\u0430\u043a \u0436\u0435 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043a \u043d\u0435\u043c\u0443, \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437 \u0432 \u043c\u0438\u043d\u0443\u0442\u043a\u0443. <\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u0412\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u0433\u043e\u0442\u043e\u0432. <\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043c\u043d\u0435 \u0437\u0432\u043e\u043d\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u044f \u0432 \u043e\u0444\u0444\u043b\u0430\u0439\u043d\u0435 \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u00ab\u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u00bb, \u0442\u043e \u044f \u0437 \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438\u043b\u0438 \u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/214273\/\"> http:\/\/habrahabr.ru\/post\/214273\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0411\u044b\u043b\u0430 \u0443 \u043c\u0435\u043d\u044f \u0446\u0435\u043b\u044c \u0432 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. <br \/>  \u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 Nagios \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 4 \u0440\u0430\u0437\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c ( \u0412 \u0441\u0440\u0435\u0434\u043d\u0435\u043c 7-15 \u043c\u0438\u043d\u0443\u0442 \u0434\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0430 \u043f\u0438\u0441\u044c\u043c\u0430). <br \/>  \u041d\u043e \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0431\u0435\u0434\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u00ab\u0432\u0441\u0435 \u043e\u043a\u00bb \u0432 \u043b\u044e\u0431\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u044f \u043d\u0435 \u0437\u0430 \u043a\u043e\u043c\u043f\u043e\u043c \u0438 \u043d\u0435 \u043b\u0430\u0437\u0438\u0442\u044c \u0432 \u043f\u043e\u0447\u0442\u0443 \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437. <\/p>\n<h5>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u044b \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b<\/h5>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d7f\/381\/970\/d7f381970f4fefd15aa7ae1591beac4e.gif\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-214273","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/214273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=214273"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/214273\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=214273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=214273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}