{"id":257,"date":"2012-07-03T13:58:00","date_gmt":"2012-07-03T13:58:00","guid":{"rendered":"http:\/\/blog.successionua.com\/?p=257"},"modified":"2012-07-03T13:58:00","modified_gmt":"2012-07-03T13:58:00","slug":"%d0%bf%d1%80%d0%be%d0%b2%d0%b5%d1%80%d0%ba%d0%b0-%d0%b7%d0%b0%d0%b4%d0%b0%d0%bd%d0%b8%d0%b9-%d0%bf%d0%bb%d0%b0%d0%bd%d0%b8%d1%80%d0%be%d0%b2%d1%89%d0%b8%d0%ba%d0%b0-windows-scheduler-%d0%b2-nagios","status":"publish","type":"post","link":"https:\/\/geckich.space\/?p=257","title":{"rendered":"\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 Windows Scheduler \u0432 Nagios"},"content":{"rendered":"<div dir=\"ltr\" style=\"text-align: left;\">\u041f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b \u0440\u0430\u0437 \u0432 \u0434\u0435\u043d\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0430 \u0434\u0430\u0442\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u043b\u0430 \u043e\u0442\u0447\u0435\u0442\u0438\u043a \u043f\u043e \u043f\u043e\u0447\u0442\u0435.<\/p>\n<p>\u0422\u0430\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u0417\u0434\u0435\u0441\u044c \u043e\u043f\u0438\u0448\u0443 \u0441\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044f \u0431\u0443\u0434\u0443 NRPE \u0434\u043b\u044f Windows, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432 NSC++ \u043a\u043b\u0438\u0435\u043d\u0442\u0435 (0.3.\u0445 \u0432\u0435\u0440\u0441\u0438\u044f). NRPE \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043b\u044e\u0431\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0442 \u043d\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b &#8211; \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0432\u0441\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \ud83d\ude09 \u041a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c NRPE \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u044f \u043f\u0438\u0441\u0430\u043b \u0432<a href=\"http:\/\/geckich.blogspot.com\/2012\/06\/nagios-nrpe.html\" target=\"_blank\" rel=\"noopener noreferrer\"> \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u0414\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Python 3. \u041f\u043e\u0447\u0435\u043c\u0443? \u0412\u043e 1-\u0445 \u044f \u0437\u043d\u0430\u044e \u044d\u0442\u043e\u0442 \u044f\u0437\u044b\u043a \ud83d\ude42 \u0430 \u0432\u043e 2-\u0445, \u044f \u0434\u043e\u043b\u0433\u043e \u043c\u0443\u0447\u0430\u043b\u0441\u044f \u0441 PowerShell, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0438\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 CSV \u0438 \u043c\u043d\u0435 \u0442\u0430\u043a \u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u0412 \u0438\u0442\u043e\u0433\u0435, \u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u0442\u043e\u043b\u0441\u0442\u044b\u0439 \u043d\u0430 \u043c\u0440\u0430\u043a\u043e\u0431\u0435\u0441\u043d\u0443\u044e \u043f\u0440\u0438\u0431\u043b\u0443\u0434\u0443 \u0438 \u0437\u0430\u044e\u0437\u0430\u043b \u043f\u0440\u0430\u0432\u043e\u0441\u043b\u0430\u0432\u043d\u044b\u0439 \u043f\u0438\u0442\u043e\u043d, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0442\u043e\u0436\u0435 \u0431\u044b\u043b\u0430 \u043f\u0430\u0440\u0430 \u0433\u0440\u0430\u0431\u043b\u0435\u0439, \u043d\u043e \u0433\u0443\u0433\u043b \u043f\u043e\u043c\u043e\u0433 \u0438\u0445 \u0440\u0435\u0448\u0438\u0442\u044c \ud83d\ude42<\/p>\n<p>\u0418\u0442\u0430\u043a. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0418\u0434\u0435\u043c \u043d\u0430&nbsp;<a href=\"http:\/\/python.org\/download\/\">http:\/\/python.org\/download\/<\/a>&nbsp;\u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c 3\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0438\u0442\u043e\u043d\u0430 \u0434\u043b\u044f Windows, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c (\u0414\u0430\u043b\u0435\u0435, \u0414\u0430\u043b\u0435\u0435&#8230; \u0413\u043e\u0442\u043e\u0432\u043e \ud83d\ude42 ).<\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 NSC++ \u0438 \u0432&nbsp;\u0441\u0435\u043a\u0446\u0438\u044e&nbsp;<b>[External Scripts]<\/b> \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c:<\/p>\n<p><b><span style=\"color: #e69138;\">check_scheduler=C:Python32python.exe &#8220;C:Program FilesNSClient++scriptsscript.py&#8221;<\/span><\/b><\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0431\u0441\u043d\u043e \u0438 \u043f\u0438\u0448\u0435\u043c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0435\u0446 (\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b\u0438\u043a, \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0438 \u041f\u041a\u041c \/ Edit with IDLE):<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #202020; border-width: .1em .1em .1em .8em; border: solid gray; overflow: auto; padding: .2em .6em; width: auto;\">\n<pre style=\"line-height: 125%; margin: 0;\"><span style=\"color: #6ab825; font-weight: bold;\">import<\/span> <span style=\"color: #447fcf; text-decoration: underline;\">csvimport<\/span> <span style=\"color: #447fcf; text-decoration: underline;\">sys<\/span><br \/><span style=\"color: #6ab825; font-weight: bold;\">import<\/span> <span style=\"color: #447fcf; text-decoration: underline;\">os<\/span><br \/><span style=\"color: #999999; font-style: italic;\">##Deleting old log<\/span><br \/><span style=\"color: #d0d0d0;\">os.system(<\/span><span style=\"color: #ed9d13;\">'del \"log.csv\"'<\/span><span style=\"color: #d0d0d0;\">)<\/span><br \/><span style=\"color: #999999; font-style: italic;\">##Performing schtasks command<\/span><br \/><span style=\"color: #d0d0d0;\">os.system(<\/span><span style=\"color: #ed9d13;\">'schtasks \/query \/fo CSV \/v &gt;&gt; \"log.csv\"'<\/span><span style=\"color: #d0d0d0;\">)<\/span><br \/><span style=\"color: #999999; font-style: italic;\">##Clean bad characters inserted by schtasks<\/span><br \/><span style=\"color: #d0d0d0;\">fi<\/span> <span style=\"color: #d0d0d0;\">=<\/span> <span style=\"color: #24909d;\">open<\/span><span style=\"color: #d0d0d0;\">(<\/span><span style=\"color: #ed9d13;\">'log.csv'<\/span><span style=\"color: #d0d0d0;\">,<\/span> <span style=\"color: #ed9d13;\">'rb'<\/span><span style=\"color: #d0d0d0;\">)<\/span><br \/><span style=\"color: #d0d0d0;\">data<\/span> <span style=\"color: #d0d0d0;\">=<\/span> <span style=\"color: #d0d0d0;\">fi.read()<\/span><br \/><span style=\"color: #d0d0d0;\">fi.close()<\/span><br \/><span style=\"color: #d0d0d0;\">fo<\/span> <span style=\"color: #d0d0d0;\">=<\/span> <span style=\"color: #24909d;\">open<\/span><span style=\"color: #d0d0d0;\">(<\/span><span style=\"color: #ed9d13;\">'log.csv1'<\/span><span style=\"color: #d0d0d0;\">,<\/span> <span style=\"color: #ed9d13;\">'wb'<\/span><span style=\"color: #d0d0d0;\">)<\/span><br \/><span style=\"color: #d0d0d0;\">fo.write(data.replace(b<\/span><span style=\"color: #ed9d13;\">'x00'<\/span><span style=\"color: #d0d0d0;\">,<\/span> <span style=\"color: #d0d0d0;\">b<\/span><span style=\"color: #ed9d13;\">''<\/span><span style=\"color: #d0d0d0;\">))<\/span><br \/><span style=\"color: #d0d0d0;\">fo.close()<\/span><br \/><span style=\"color: #999999; font-style: italic;\">##Opening cleaned CSV<\/span><br \/><span style=\"color: #d0d0d0;\">ifile<\/span>  <span style=\"color: #d0d0d0;\">=<\/span> <span style=\"color: #24909d;\">open<\/span><span style=\"color: #d0d0d0;\">(<\/span><span style=\"color: #ed9d13;\">'log.csv1'<\/span><span style=\"color: #d0d0d0;\">,<\/span> <span style=\"color: #ed9d13;\">\"r\"<\/span><span style=\"color: #d0d0d0;\">)<\/span><br \/><span style=\"color: #d0d0d0;\">reader<\/span> <span style=\"color: #d0d0d0;\">=<\/span> <span style=\"color: #d0d0d0;\">csv.reader(ifile,<\/span> <span style=\"color: #d0d0d0;\">delimiter=<\/span><span style=\"color: #ed9d13;\">','<\/span><span style=\"color: #d0d0d0;\">,<\/span> <span style=\"color: #d0d0d0;\">quotechar=<\/span><span style=\"color: #ed9d13;\">'\"'<\/span><span style=\"color: #d0d0d0;\">,<\/span> <span style=\"color: #d0d0d0;\">quoting=csv.QUOTE_ALL)<\/span><br \/><span style=\"color: #999999; font-style: italic;\">##Extracting needed data<\/span><br \/><span style=\"color: #6ab825; font-weight: bold;\">for<\/span> <span style=\"color: #d0d0d0;\">row<\/span> <span style=\"color: #6ab825; font-weight: bold;\">in<\/span> <span style=\"color: #d0d0d0;\">reader:<\/span><br \/>    <span style=\"color: #6ab825; font-weight: bold;\">if<\/span> <span style=\"color: #d0d0d0;\">(row[<\/span><span style=\"color: #3677a9;\">1<\/span><span style=\"color: #d0d0d0;\">]<\/span> <span style=\"color: #d0d0d0;\">==<\/span> <span style=\"color: #ed9d13;\">\"rdc_106\"<\/span><span style=\"color: #d0d0d0;\">)<\/span> <span style=\"color: #6ab825; font-weight: bold;\">or<\/span> <span style=\"color: #d0d0d0;\">(row[<\/span><span style=\"color: #3677a9;\">1<\/span><span style=\"color: #d0d0d0;\">]<\/span> <span style=\"color: #d0d0d0;\">==<\/span> <span style=\"color: #ed9d13;\">\"rdc_108\"<\/span><span style=\"color: #d0d0d0;\">)<\/span> <span style=\"color: #6ab825; font-weight: bold;\">or<\/span> <span style=\"color: #d0d0d0;\">(row[<\/span><span style=\"color: #3677a9;\">1<\/span><span style=\"color: #d0d0d0;\">]<\/span> <span style=\"color: #d0d0d0;\">==<\/span> <span style=\"color: #ed9d13;\">\"rdc_115\"<\/span><span style=\"color: #d0d0d0;\">)<\/span> <span style=\"color: #6ab825; font-weight: bold;\">or<\/span> <span style=\"color: #d0d0d0;\">(row[<\/span><span style=\"color: #3677a9;\">1<\/span><span style=\"color: #d0d0d0;\">]<\/span> <span style=\"color: #d0d0d0;\">==<\/span> <span style=\"color: #ed9d13;\">\"rdc_116\"<\/span><span style=\"color: #d0d0d0;\">):<\/span><br \/>        <span style=\"color: #6ab825; font-weight: bold;\">print<\/span> <span style=\"color: #d0d0d0;\">(row[<\/span><span style=\"color: #3677a9;\">1<\/span><span style=\"color: #d0d0d0;\">]+<\/span><span style=\"color: #ed9d13;\">\" : \"<\/span><span style=\"color: #d0d0d0;\">+row[<\/span><span style=\"color: #3677a9;\">5<\/span><span style=\"color: #d0d0d0;\">])<\/span><br \/><span style=\"color: #d0d0d0;\">ifile.close()<\/span><br \/><\/pre>\n<\/div>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0442\u0430\u043a\u043e\u0439:<\/p>\n<ul style=\"text-align: left;\">\n<li>\u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0439 \u043b\u043e\u0433 \u0447\u0442\u043e\u0431 \u043d\u0435 \u043c\u0435\u0448\u0430\u043b<\/li>\n<li>\u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439&nbsp;schtasks \/query \/fo CSV \/v &gt;&gt; &#8220;log.csv&#8221; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 CSV \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u043b\u043e\u0433-\u0444\u0430\u0439\u043b<\/li>\n<li>\u043e\u0447\u0438\u0449\u0430\u0435\u043c \u0444\u0430\u0439\u043b\u0438\u043a \u043e\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043d\u0435\u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u044b\u0445 null \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0440\u0430\u043a\u043e\u0441\u043e\u0444\u0442\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 Excel \u0437\u0430\u0447\u0435\u043c-\u0442\u043e \u043f\u0438\u0445\u0430\u044e\u0442 \u0432 \u0444\u0430\u0439\u043b\u0438\u043a CSV,<br \/>\n\u0430 \u043f\u0438\u0442\u043e\u043d \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0430\u0442\u043a\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b<\/li>\n<li>\u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u043b\u044f TaskName \u0438 Last Run Time \u0434\u043b\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u043d\u0430\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0439.<\/li>\n<\/ul>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043b\u0443\u0436\u0431\u0443 NSClient++. \u0412\u0441\u0451, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u043f\u0443\u0442\u0430\u043b\u0438 \u0441 \u043f\u0443\u0442\u044f\u043c\u0438, \u0442\u043e \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d.<br \/>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0451 \u0434\u0430\u0436\u0435 \u043f\u043e\u043f\u0440\u043e\u0449\u0435. \u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b \u043a\u043e\u043c\u0430\u043d\u0434&nbsp;<b>\/usr\/local\/nagios\/etc\/objects\/commands.cfg<\/b> \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u043a\u043e\u043d\u0435\u0446:<\/p>\n<p><b><span style=\"color: #e69138;\">define command{<\/span><\/b><br \/><b><span style=\"color: #e69138;\">&nbsp; &nbsp; &nbsp; &nbsp; command_name &nbsp; &nbsp;check_scheduler<\/span><\/b><br \/><b><span style=\"color: #e69138;\">&nbsp; &nbsp; &nbsp; &nbsp; command_line &nbsp; &nbsp;$USER1$\/check_nrpe -H $HOSTADDRESS$ -c check_scheduler<\/span><\/b><br \/><b><span style=\"color: #e69138;\">&nbsp; &nbsp; &nbsp; &nbsp; }<\/span><\/b><\/p>\n<div><\/div>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0438\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435\u0446 \u043d\u0430 bash, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0447\u0435\u043a\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e \u043f\u043e\u0447\u0442\u0435. \u041c\u043d\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u0447\u0435\u043a, \u043f\u043e\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0445\u043e\u0441\u0442\u0430.<\/p>\n<p><b><span style=\"color: #e69138;\">#!\/bin\/bash<\/span><\/b><br \/><b><span style=\"color: #e69138;\">#\u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0439 \u043b\u043e\u0433 \u0447\u0442\u043e\u0431 \u043d\u0435 \u043c\u0435\u0448\u0430\u043b<\/span><\/b><br \/><b><span style=\"color: #e69138;\">rm \/home\/user\/daily_log<\/span><\/b><br \/><b><span style=\"color: #e69138;\">#\u0442\u0443\u0442 \u043f\u0438\u0448\u0435\u043c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u0447\u0435\u043a\u0438 \u0438 \u0432\u0441\u0451 \u0442\u0430\u043a\u043e\u0435<\/span><\/b><br \/><b><span style=\"color: #e69138;\">echo &#8221; `date ` nn Daily report for Super-duper server.nn [Disk space on D:]&#8221; &gt;&gt; \/home\/user\/daily_log<\/span><\/b><span style=\"color: #e69138;\"><b>&gt;<\/b><\/span><br \/><b><span style=\"color: #e69138;\">\/usr\/local\/nagios\/libexec\/check_nt -H 192.168.1.4 -p 12489 -v USEDDISKSPACE -l d -d SHOWALL &gt;&gt; \/home\/user\/daily_log<\/span><\/b><br \/><b><span style=\"color: #e69138;\">echo &#8220;n [Processes state:]&#8221; &gt;&gt; \/home\/user\/daily_log<\/span><\/b><br \/><b><span style=\"color: #e69138;\">\/usr\/local\/nagios\/libexec\/check_nt -H&nbsp;192.168.1.41 -p 12489 -v PROCSTATE -l someprocess.exe -d SHOWALL &gt;&gt; \/home\/user\/daily_log<\/span><\/b><br \/><span style=\"color: #e69138; font-weight: bold;\">\/usr\/local\/nagios\/libexec\/check_nrpe -H&nbsp;192.168.1.4&nbsp;-p 5666 -c check_scheduler &gt;&gt; \/home\/user\/<\/span><span style=\"color: #e69138;\"><b>daily_log<\/b><\/span><br \/><b><span style=\"color: #e69138;\">cat \/home\/user\/daily_log | mail -s &#8220;Report for Super-duper&#8221; -c copy_mail@domain.com recipient@domain.com&nbsp;<\/span><\/b><\/p>\n<p><b><span style=\"color: #e69138;\">chmod +x&nbsp;\/home\/user\/daily_report.sh<\/span><\/b><br \/><b><span style=\"color: #e69138;\"><br \/><\/span><\/b>\u0418 \u043f\u0438\u0445\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u0438\u043a \u0432 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043d\u0430 \u043d\u0443\u0436\u043d\u043e\u0435 \u043d\u0430 \u0432\u0440\u0435\u043c\u044f <b>crontab -e<\/b> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 6-45 \u043f\u043e \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u0434\u043d\u044f\u043c):<\/p>\n<p><b><span style=\"color: #e69138;\">45 6 * * 1-5<span style=\"white-space: pre;\"> <\/span>sh \/home\/user\/daily_report.sh<\/span><\/b><\/p>\n<p>\u0423\u0441\u0451. \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u043f\u043e\u0436\u0438\u043d\u0430\u0435\u043c \u043f\u043b\u043e\u0434\u044b \u0441\u0432\u043e\u0435\u0433\u043e \u0442\u0440\u0443\u0434\u0430.<\/p><\/div>\n<div>http:\/\/geckich.blogspot.com\/<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b \u0440\u0430\u0437 \u0432 \u0434\u0435\u043d\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0430 \u0434\u0430\u0442\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u043b\u0430 \u043e\u0442\u0447\u0435\u0442\u0438\u043a \u043f\u043e \u043f\u043e\u0447\u0442\u0435. \u0422\u0430\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u0417\u0434\u0435\u0441\u044c \u043e\u043f\u0438\u0448\u0443 \u0441\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044f \u0431\u0443\u0434\u0443 NRPE \u0434\u043b\u044f Windows, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432 NSC++ \u043a\u043b\u0438\u0435\u043d\u0442\u0435 (0.3.\u0445 \u0432\u0435\u0440\u0441\u0438\u044f). NRPE \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043b\u044e\u0431\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c &hellip; <a href=\"https:\/\/geckich.space\/?p=257\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 Windows Scheduler \u0432 Nagios<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-257","post","type-post","status-publish","format-standard","hentry","category-linux"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/posts\/257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geckich.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=257"}],"version-history":[{"count":0,"href":"https:\/\/geckich.space\/index.php?rest_route=\/wp\/v2\/posts\/257\/revisions"}],"wp:attachment":[{"href":"https:\/\/geckich.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geckich.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geckich.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}