<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Linux Forum &mdash; Nagios + syslog]]></title>
	<link rel="self" href="https://linuxforum.ru/extern.php?action=feed&amp;tid=24596&amp;type=atom" />
	<updated>2012-10-08T11:58:42Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=24596</id>
		<entry>
			<title type="html"><![CDATA[Re: Nagios + syslog]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=302056#p302056" />
			<content type="html"><![CDATA[<p>sed -i &#039;s/oldstring/newstring/g&#039;&nbsp; &nbsp;$ipdown_full ? или не туда?</p>]]></content>
			<author>
				<name><![CDATA[enjoy1288]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25818</uri>
			</author>
			<updated>2012-10-08T11:58:42Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=302056#p302056</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Nagios + syslog]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=302052#p302052" />
			<content type="html"><![CDATA[<p>Конечно сможет, ведь sed работает со строками, а любую переменную можно превратить в строки командой echo &quot;$переменная&quot;.</p>]]></content>
			<author>
				<name><![CDATA[Vascom]]></name>
				<uri>https://linuxforum.ru/profile.php?id=5339</uri>
			</author>
			<updated>2012-10-08T11:53:40Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=302052#p302052</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Nagios + syslog]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=302050#p302050" />
			<content type="html"><![CDATA[<p>sed разве сможет работать с переменными? или я не понял всей прелести sed ?</p>]]></content>
			<author>
				<name><![CDATA[enjoy1288]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25818</uri>
			</author>
			<updated>2012-10-08T11:52:07Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=302050#p302050</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Nagios + syslog]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=302049#p302049" />
			<content type="html"><![CDATA[<p>Ну тогда так:<br /></p><div class="codebox"><pre><code>ipdown=`/bin/cat /var/log/syslog/switches.log| grep &quot;%LINK-W-Down&quot; -с`
ipdown_full=`/bin/cat /var/log/syslog/switches.log| grep &quot;%LINK-W-Down&quot; | awk &#039;{print $4,$6,$5}&#039;| sort|uniq`
if [ &quot;$ipdown&quot; -ne &quot;0&quot; ]
then
    status=&quot;CRITICAL&quot;
fi</code></pre></div><p>И через sed в ipdown_full замени %LINK-W-Down на link down.</p><p>P.S. Это конечно всё на скорую руку, чтобы понятно было как и что делать.</p>]]></content>
			<author>
				<name><![CDATA[Vascom]]></name>
				<uri>https://linuxforum.ru/profile.php?id=5339</uri>
			</author>
			<updated>2012-10-08T11:49:35Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=302049#p302049</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Nagios + syslog]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=302047#p302047" />
			<content type="html"><![CDATA[<p>Да, работает, но не совсем то, хотелось бы, чтобы в нагиосе было оповещение типа <br />192,168,0,33 link down 1:18<br />192,168,0,44 link down 2:15 и т.д.</p>]]></content>
			<author>
				<name><![CDATA[enjoy1288]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25818</uri>
			</author>
			<updated>2012-10-08T11:46:55Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=302047#p302047</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Nagios + syslog]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=302043#p302043" />
			<content type="html"><![CDATA[<p>Так?<br /></p><div class="codebox"><pre><code>ipdown=`/bin/cat /var/log/syslog/switches.log| grep &quot;%LINK-W-Down&quot; -с`
if [ &quot;$ipdown&quot; -ne &quot;0&quot; ]
then
    status=&quot;CRITICAL&quot;
fi</code></pre></div><p>Ну и дальше с этой переменной делаешь что тебе надо.</p>]]></content>
			<author>
				<name><![CDATA[Vascom]]></name>
				<uri>https://linuxforum.ru/profile.php?id=5339</uri>
			</author>
			<updated>2012-10-08T11:35:49Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=302043#p302043</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Nagios + syslog]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=302040#p302040" />
			<content type="html"><![CDATA[<p>Вопрос в том, каким образом отправить статус CRITICAL при строке <br /> 192.168.0.22 %LINK-W-Down:&nbsp; 1:18&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />если данные 192,168,0,22 и 1:18 динамические, т.е. может быть<br />192.168.0.44 %LINK-W-Down:&nbsp; 2:21<br />192.168.0.66 %LINK-W-Down:&nbsp; 2:8&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; и так далее</p>]]></content>
			<author>
				<name><![CDATA[enjoy1288]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25818</uri>
			</author>
			<updated>2012-10-08T11:29:54Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=302040#p302040</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Nagios + syslog]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=302030#p302030" />
			<content type="html"><![CDATA[<p>Не совсем понятно в чём всё-таки вопрос.</p>]]></content>
			<author>
				<name><![CDATA[Vascom]]></name>
				<uri>https://linuxforum.ru/profile.php?id=5339</uri>
			</author>
			<updated>2012-10-08T10:36:30Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=302030#p302030</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Nagios + syslog]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=302021#p302021" />
			<content type="html"><![CDATA[<p>И снова здравсвтуйте<br />Есть сислог со свитчей dlink вида&nbsp; :<br /></p><div class="codebox"><pre><code>........
Oct  2 08:20:48 192.168.0.22 %LINK-W-Down:  1:18                                                                                                                                                                
Oct  2 08:20:49 192.168.0.22 %LINK-I-Up:  1:18  
..........</code></pre></div><p>Хотелось бы написать парсер для Nagios, который бы выводил предупреждение если статус порта будет Down<br />Но не могу придумать как правильно его распарсить, на скорую руку набросал скрипт : </p><div class="codebox"><pre><code>#!/bin/bash                                                                                                                                                                                                     
#set -x                                                                                                                                                                                                         
exit_state=3                                                                                                                                                                                                    
STATE_OK=0                                                                                                                                                                                                      
STATE_CRITICAL=2                                                                                                                                                                                                
##################################                                                                                                                                                                              
                                                                                  
                ipdown=`/bin/cat /var/log/syslog/switches.log| grep &quot;%LINK-W-Down&quot; | awk &#039;{print $4,$6,$5}&#039;| sort|uniq`                                                                                     
                echo $ipdown| tr &#039; &#039; &#039;\n&#039;  </code></pre></div><p>Скриптом я получаю в колонку :<br /></p><div class="codebox"><pre><code>192.168.0.22 
1:18
%LINK-W-Down:  </code></pre></div><p>Проблема заключается в том, как мне выводить предупреждение только по&nbsp; &lt;&lt;&nbsp; %LINK-W-Down:&nbsp; &gt;&gt;&nbsp; ? <br />Был вариант еще выводить результат парсинга&nbsp; в отдельный файл, например switch.tmp и его парсить на 3 переменные -&nbsp; IP, статус порта и номер порта, но тогда я потеряю связку между ними. Подскажите пжста в какую сторону думать</p>]]></content>
			<author>
				<name><![CDATA[enjoy1288]]></name>
				<uri>https://linuxforum.ru/profile.php?id=25818</uri>
			</author>
			<updated>2012-10-08T09:35:40Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=302021#p302021</id>
		</entry>
</feed>
