<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Data Bunch</title>
	<atom:link href="http://databunch.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://databunch.wordpress.com</link>
	<description>Small tips by a Linux apprentice.</description>
	<lastBuildDate>Thu, 23 Sep 2010 19:58:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='databunch.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Data Bunch</title>
		<link>http://databunch.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://databunch.wordpress.com/osd.xml" title="Data Bunch" />
	<atom:link rel='hub' href='http://databunch.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Tutorial de minha autoria para instalação e configuração do MON #in #linux #debian</title>
		<link>http://databunch.wordpress.com/2010/09/23/tutorial-de-minha-autoria-para-instalacao-e-configuracao-do-mon-in-linux-debian/</link>
		<comments>http://databunch.wordpress.com/2010/09/23/tutorial-de-minha-autoria-para-instalacao-e-configuracao-do-mon-in-linux-debian/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 19:58:05 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=47</guid>
		<description><![CDATA[mon, linux, debian, monitoring servers<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=47&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span class="mw-headline">MON -&gt; Ferramenta para monitorar a disponibilidade de serviços</span></strong></p>
<p>O programa <strong>mon</strong> é utilizado para monitorar (remotamente ou localmente) serviços e disparar ações conforme os eventos.<br />
Mon possui vários scripts monitores e alerts.<br />
Os scripts podem ser complexos a ponto de executarem queries pré-definidas em bancos de dados remotos ou também enviar emails de alerta ao sysadmin.<br />
Os scripts têm seus diretórios pré-definidos:</p>
<pre> /usr/lib/mon/mon.d -&gt; armazena os scripts monitores (.monitor), que executam a checagem de algum serviço
 /usr/lib/mon/alert.d -&gt; armazena os scripts alert (.alert), responsáveis por executar alguma ação quando identificado o problema (subir um daemon,
 reiniciar um serviço, etc).</pre>
<p><strong>Configurando o MON</strong></p>
<p><strong><span class="mw-headline">Instalando</span></strong></p>
<pre> aptitude install mon
 /etc/init.d/mon stop</pre>
<p><strong>Configurando o arquivo /etc/mon/mon.cf</strong></p>
<pre> serverbind = localhost
 trapbind = localhost
 cfbasedir = /etc/mon
 alertdir= /usr/lib/mon/alert.d
 mondir = /usr/lib/mon/mon.d
 maxprocs = 20
 histlength = 100
 randstart = 60s</pre>
<pre> hostgroup localnode localhost</pre>
<pre> watch localhost
       service http
               description Monitoramento do apache
               interval 1m
               monitor http.monitor -p 80 -t 10 -o localhost
               period wd {Mon-Sun}
                       alert apache2.alert
                       alert file.alert -d /var/log/mon http.alert.log</pre>
<p><strong>Explicando o mon.cf</strong></p>
<p>O arquivo /etc/mon/mon.cf é onde se define que servidores fazem bind, por quais portas e que rotinas de monitoramento são executadas, em que intervalo de tempo e o que acontece em caso de problemas.</p>
<p><strong><span class="mw-headline">hostgroup</span></strong></p>
<pre> Define um nome de grupo de hosts a serem monitorados.
 localhost =&gt; nome do grupo monitorado
 localhost =&gt; nome do servidor pertencente ao grupo localhost, definido dentro do hostgroup (cláusula de definição)</pre>
<p><strong><span class="mw-headline">watch</span></strong></p>
<pre> Define quais serviços serão monitorados. O nome definido no parâmetro <strong>service</strong> dentro do watch deve ser o nome do script monitor, sem a extensão .monitor e deve constar no
 mondir, definido acima.
 Ou seja, em /usr/lib/mon/mon.d deve existir um script chamado http.monitor (neste exemplo).</pre>
<p><strong><span class="mw-headline">service</span></strong></p>
<pre> Este parâmetro é exatamente o nome do script existente sob /usr/lib/mon/mon.d, sem a extensão .monitor</pre>
<p><strong><span class="mw-headline">description</span></strong></p>
<pre> Permite fornecer uma descrição para a checagem sendo realizada. Para controle pessoal do usuário.</pre>
<p><strong><span class="mw-headline">interval</span></strong></p>
<pre> Intervalo de tempo entre as checagens. 1m = 1 minuto. 1h = 1 hora, e assim por diante.</pre>
<p><strong><span class="mw-headline">period</span></strong></p>
<pre> Período em que a checagem deve ser executada. É possível especificar horários ou períodos diferenciados. A sintaxe correta de como o período desejado
 pode ser especificado pode ser consultada na página de manual do módulo Perl Time::Period, acessível através do comando <em>man Time::Period</em>
 O timeperiod não pode ser setado para dias iguais. Por exemplo: wd {Mon-Mon}</pre>
<p><strong><span class="mw-headline">alert</span></strong></p>
<pre> Esta cláusula permite especificar alertas a serem gerados quando o script monitor retornar um valor diferente de zero (quando retornar um erro).
 O script definido nesta cláusula deve estar no alertdir setado acima. Neste caso, em /usr/lib/mon/alert.d/
 A cláusula file.alert é um script que gera um arquivo de log no endereço setado e com o nome de arquivo definido. Neste caso:
 /var/log/mon/http.alert.log</pre>
<p><strong><span class="mw-headline">Permissões</span></strong></p>
<p>Para usar o mon como monitoramento de serviços como apache, é necessário habilitar o usuário mon, criado na instalação, como pertencente ao grupo root.<br />
Para fazer isto, edite o arquivo /etc/group:</p>
<pre> vim /etc/group
 Acrescente à linha que contiver este conteúdo <em>root:x:0:</em>, o usuário mon. Ficará assim: <strong>root:x:0:mon</strong></pre>
<pre> Ou execute o comando: usermod -o -G root mon</pre>
<p><strong><span class="mw-headline">Permissões &#8211; /etc/passwd</span></strong></p>
<p>Caso editando o /etc/group não resolva e continuem ocorrendo erros de permissão ao executar os alerts, edite o arquivo /etc/passwd:</p>
<pre> mon:x:0:0::/var/lib/mon:/bin/false</pre>
<p><strong><span class="mw-headline">Reiniciando o mon</span></strong></p>
<p>Após configurar o aplicativo, reinicie o programa:</p>
<pre> /etc/init.d/mon restart</pre>
<p>Para testar se o mon está funcionando corretamente, pode-se usar o comando abaixo:</p>
<pre> monshow --detail localhost,http</pre>
<p>localhost é o nome do servidor e http é o nome do serviço, podendo ser qualquer outro configurado no mon.</p>
<p><strong><span class="mw-headline">Exemplo de erro</span></strong></p>
<pre> server: localhost
      time: Wed Sep 22 17:04:09 2010
      state: scheduler running
 Error: localhost/http not a valid service</pre>
<p><strong><span class="mw-headline">Exemplo de sucesso</span></strong></p>
<pre>    server: localhost
      time: Wed Sep 22 17:07:49 2010
     state: scheduler running
 Detail for group localhost service http
 description
 -----------
   Monitoramento do apache
 summary
 -------
 hosts
 -----
   localhost
 -----DETAIL-----
 -----DETAIL-----
 opstatus: untested (7)
  exitval: undef
   depend:
  monitor:
 last check: 14874 days, 20:07 ago
 next_check: in 17s</pre>
<p><strong><span class="mw-headline">Modelo de alert para reiniciar o apache</span></strong></p>
<pre> Nome do arquivo: apache2.alert</pre>
<pre> #!/bin/bash

 PID="/var/log/mon/apache.alert.pid"

 # Validando se o processo jah estah em execucao
 if [ -f "$PID" ] ; then
       echo "Processo ja estah em execucao com PID [`cat $PID`]"
       exit 0
 fi

 # Iniciando execucao do script
 while [ ! -z "`/bin/pidof httpd`" ] ; do
       echo "$$" &gt; $PID
       /etc/init.d/apache2 stop
       sleep 2
 done

 # Iniciando o apache
 /etc/init.d/apache2 start
 rm -f "$PID"</pre>
<p>// </p>
<p><!-- Served in 0.248 secs. --></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=47&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2010/09/23/tutorial-de-minha-autoria-para-instalacao-e-configuracao-do-mon-in-linux-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
		<item>
		<title>RRDs, Nagios&#8230; a vida de sempre. #in #Linux #nagios #snmp</title>
		<link>http://databunch.wordpress.com/2010/06/30/rrds-nagios-a-vida-de-sempre-in-linux-nagios-snmp/</link>
		<comments>http://databunch.wordpress.com/2010/06/30/rrds-nagios-a-vida-de-sempre-in-linux-nagios-snmp/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 15:35:44 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=43</guid>
		<description><![CDATA[Já faz uma cara que não posto aqui. Me falta tempo. Desde que comecei monitorar os servidores da empresa (e subsidiárias, agregadas e afins), é só correria. Devo ter montado uns 20 plugins pro Nagios, pra monitoramentos específicos, SNMP, RRDs, MRTGs, etc. Devo ter montado umas 40 rotinas para clientes, em shellscript, perl e MySQL. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=43&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Já faz uma cara que não posto aqui. Me falta tempo. Desde que comecei monitorar os servidores da empresa (e subsidiárias, agregadas e afins), é só correria.</p>
<p>Devo ter montado uns 20 plugins pro Nagios, pra monitoramentos específicos, SNMP, RRDs, MRTGs, etc.</p>
<p>Devo ter montado umas 40 rotinas para clientes, em shellscript, perl e MySQL.</p>
<p>Devo ter respondido uns 450 mil emails. Atendido outras 900 mil ligações.</p>
<p>Reclamando ? Jamais.</p>
<p>Amo meu emprego.</p>
<p>E vamo correndo. Hoje já tenho mais uma rotina brutal pra montar.</p>
<p>Mexer em gigas de tabelas de bancos de dados, monta scripts, explain neles, testa, dá errado, refaz, o cliente enche, você se concentra e no fim, sim, sai sim.</p>
<p>Gambiarra jamais, irmão, irmã.</p>
<p>Faça as coisas direito.</p>
<p>Até.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=43&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2010/06/30/rrds-nagios-a-vida-de-sempre-in-linux-nagios-snmp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
		<item>
		<title>mp3gain em linha de comando #in #linux #cli</title>
		<link>http://databunch.wordpress.com/2010/06/06/mp3gain-em-linha-de-comando-in-linux-cli/</link>
		<comments>http://databunch.wordpress.com/2010/06/06/mp3gain-em-linha-de-comando-in-linux-cli/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 00:54:17 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=39</guid>
		<description><![CDATA[Linux, mp3gain, cli, shell<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=39&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Para equalizar o áudio de seus mp3, o Mp3Gain é um ótimo software. Melhor ainda é a simplicidade em normalizar suas músicas via linha de comando.</p>
<p>Fácil, basta usar um find pra relacionar as músicas recursivamente e o mp3gain -r pra normalizar o volume de todas elas.</p>
<p>Exemplo:</p>
<p>﻿﻿find /diretorio  -name *.mp3 -exec mp3gain -r {} +</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=39&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2010/06/06/mp3gain-em-linha-de-comando-in-linux-cli/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
		<item>
		<title>Aperfeiçoando o código. #in #linux #shellscript</title>
		<link>http://databunch.wordpress.com/2010/04/14/aperfeicoando-o-codigo-in-linux-shellscript/</link>
		<comments>http://databunch.wordpress.com/2010/04/14/aperfeicoando-o-codigo-in-linux-shellscript/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 15:44:04 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=36</guid>
		<description><![CDATA[linux, nagios, shellscript, perl<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=36&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ultimamente tenho montado algumas rotinas automáticas para integrações com clientes. Normalmente monto em shellscript.</p>
<p>Com o uso diário da linguagem e aplicação de conceitos aplicados à programação, para otimizar e facilitar manutenção no código, vejo que eu mesmo estou programando muito melhor nessa linguagem.</p>
<p>O dia-a-dia realmente é um excelente professor.</p>
<p>Já para o Nagios, monto plugins mais em Perl que em shellscript. Em Perl preciso capturar o conceito de hash e array, que ainda me traz confusão.</p>
<p>Mas eu chego lá !</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=36&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2010/04/14/aperfeicoando-o-codigo-in-linux-shellscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
		<item>
		<title>Meus primeiros 2 plugins para o Nagios #linux #nagios #debian #shellscript</title>
		<link>http://databunch.wordpress.com/2010/01/14/meus-primeiros-2-plugins-para-o-nagios-linux-nagios-debian-shellscript/</link>
		<comments>http://databunch.wordpress.com/2010/01/14/meus-primeiros-2-plugins-para-o-nagios-linux-nagios-debian-shellscript/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 19:20:09 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=34</guid>
		<description><![CDATA[Montei 2 plugins para o Nagios. Um checa se os IPs informados como parâmetro estão listados em uma série de RBLs e o outro plugin baixa um arquivo do SNDS (SmartNetworkDataServices &#8211; serviço do Hotmail), para verificação de bloqueios de IPs naquele provedor (de longe, o mais crítico). Depois de muita briga, os plugins finalmente [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=34&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Montei 2 plugins para o Nagios. Um checa se os IPs informados como parâmetro estão listados em uma série de RBLs e o outro plugin baixa um arquivo do SNDS (SmartNetworkDataServices &#8211; serviço do Hotmail), para verificação de bloqueios de IPs naquele provedor (de longe, o mais crítico).</p>
<p>Depois de muita briga, os plugins finalmente ficaram prontos. Ambos em shell script.</p>
<p>Palhinha dos dois:</p>
<p>#!/bin/bash</p>
<p>log_file=&#8221;/endereco_do_arquivo_de_log&#8221;<br />
pid_file=&#8221;/endereco_do_arquivo_de_pid&#8221;<br />
rbls=&#8221;/endereco_do_arquivo_de_rbls (.rblcheckrc)&#8221;<br />
stored_logs=&#8221;/endereco_do_arquivo_temporario_de_logs&#8221;</p>
<p># Funcoes de ajuda, mensagens de log, remocao de arquivo de PID e envio de email</p>
<p>help(){<br />
echo &#8220;echo &#8220;echo &#8220;Usage $0 -c \&#8221;&lt;ADDRESS&gt;[[/]&lt;NETMASK&gt;][ &lt;ADDRESS&gt;[[/]&lt;NETMASK&gt;]]&gt;\&#8221;"</p>
<address>
<address> }log_msg(){</p>
<p>msg=&#8221;[`date`] PID $$: $1&#8243;<br />
echo $msg &gt;&gt; $log_file<br />
if [ "$DEBUG" -a "$2" != 1 ]; then<br />
echo $msg<br />
fi<br />
}</p>
<p>kill_pid(){<br />
rm -f $pid_file<br />
}</p>
<p>notification(){<br />
echo -e &#8220;$1&#8243; &#8220;$2&#8243; | mail -e -s &#8220;$3&#8243; $4<br />
}</p>
<p># Valida se os programas necessarios estao instalados<br />
err=&#8221;"<br />
ipcalc=$(which ipcalc)		|| err=&#8221;ipcalc&#8221;;<br />
rblcheck=$(which rblcheck)	|| err=&#8221;rblcheck&#8221;;<br />
sed=$(which sed)		|| err=&#8221;sed&#8221;;<br />
cut=$(which cut)		|| err=&#8221;cut&#8221;;<br />
cat=$(which cat)		|| err=&#8221;cat&#8221;;<br />
rm=$(which rm)			|| err=&#8221;rm&#8221;;<br />
mail=$(which mail)		|| err=&#8221;mail&#8221;;<br />
rm=$(which rm)			|| err=&#8221;rm&#8221;;<br />
if [ ! -z "$err" ]; then<br />
log_msg &#8220;Comando nao encontrado: $err&#8221;<br />
kill_pid<br />
exit 0<br />
fi</p>
<p># Valida se arquivo de rbls existe<br />
if [ ! -f $rbls ] ; then<br />
log_msg &#8220;Arquivo de rbls $rbls nao encontrado&#8221;<br />
kill_pid<br />
exit 0<br />
fi</p>
<p># Extracao de argumentos na linha de comando<br />
while getopts c:d:e: OPTION ; do<br />
case $OPTION in<br />
c)<br />
CLASS=$OPTARG<br />
;;<br />
d)<br />
DEBUG=1<br />
;;<br />
e)<br />
EMAIL=$OPTARG<br />
;;<br />
esac</p>
<p>done</p>
<p># Valida parametros obrigatorios<br />
if [ -z "$CLASS" ]; then<br />
help;<br />
kill_pid<br />
exit 0<br />
fi</p>
<p>#Verifica se o plugin ja esta em execucao<br />
if [ -f $pid_file ] ; then<br />
pid=$(cat $pid_file)<br />
if [[ "$pid" =~ [0-9]+ ]] ; then<br />
return=$(ps -p $pid | wc -l)<br />
if [ $return -gt 1 ] ; then<br />
log_msg &#8220;Plugin ja esta em execucao com PID $pid&#8221;<br />
kill_pid<br />
exit 0<br />
fi<br />
fi<br />
fi</p>
<p>#Armazena o ID do processo no arquivo de PID<br />
echo $$ &gt; $pid_file</p>
<p># Calcula intervalo de IPs fornecidos<br />
listed=0<br />
cat /dev/null &gt; $stored_logs<br />
for str in $CLASS; do<br />
# Valida IP/classe<br />
if [ ! $str =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\(\/[0-9]+\)?$ ]; then<br />
log_msg &#8220;Formato de IP invalido&#8221;<br />
kill_pid<br />
exit 0<br />
fi</p>
<p># Verifica se possui mascara de rede<br />
if [[ $str =~ .*\/.* ]]; then<br />
log_msg &#8220;Iniciando execucao do script para $str&#8230;&#8221;<br />
hostmin=$(ipcalc -b $str|grep HostMin|sed &#8216;s/[^\.0-9]*//g&#8217;)<br />
hostmax=$(ipcalc -b $str|grep HostMax|sed &#8216;s/[^\.0-9]*//g&#8217;)<br />
else<br />
hostmin=$str<br />
hostmax=$str<br />
fi</p>
<p># Obtem o IP inicial e final para aplicar o loop<br />
from=$(echo $hostmin|cut -d&#8217;.&#8217; -f4)<br />
to=$(echo $hostmax|cut -d&#8217;.&#8217; -f4)<br />
initial=$(echo $hostmin|sed &#8216;s/[0-9]*$//g&#8217;)</p>
<p># Consulta cada IP<br />
for i in $(seq $from $to) ; do<br />
log_msg &#8220;Consultando IP $initial$i&#8221; 1<br />
result=`rblcheck -c $(cat $rbls) $initial$i | grep &#8220;$initial$i listed&#8221;`<br />
if [ ! -z "$result" ]; then<br />
listed=1<br />
log_msg &#8220;$result&#8221;<br />
echo &#8220;$result&#8221; &gt;&gt; $stored_logs<br />
fi<br />
done<br />
done</p>
<p># Retorno<br />
if [[ $listed == 1 ]] ; then<br />
cat $stored_logs<br />
notification &#8220;Resultado da checagem de IPs: \n\n&#8221; &#8220;`cat $stored_logs`&#8221; &#8220;RBLCHECK WARNING&#8221; $EMAIL<br />
kill_pid<br />
rm -f $stored_logs<br />
exit 0<br />
else<br />
result=&#8221;OK. Nenhum IP bloqueado.&#8221;<br />
echo &#8220;$result&#8221; &gt;&gt; $stored_logs<br />
notification &#8220;Resultado da checagem de IPs: \n\n&#8221; &#8220;`cat $stored_logs`&#8221; &#8220;RBLCHECK IS OK&#8221; $EMAIL<br />
kill_pid<br />
rm -f $stored_logs<br />
exit 0<br />
fi</p>
<p>log_msg &#8220;$result&#8221;<br />
[ $DEBUG ] || echo $result</p>
<p>E SNDSCHECK:</p>
<p>#!/bin/bash</p>
<p>ADDR=&#8221;https://endereco_do_arquivo_de_IPs_bloqueados&#8221;</p>
<p>DEST=&#8221;/endereco_local_do_arquivo_de_IPs_bloqueados&#8221;<br />
LOG=&#8221;/endereco_do_arquivo_de_logs&#8221;<br />
ERR=&#8221;/endereco_do_arquivo_de_erros&#8221;<br />
STORED_LOGS=&#8221;/endereco_do_arquivo_de_logs_temporarios&#8221;<br />
PID_FILE=&#8221;/endereco_do_arquivo_de_pid&#8221;</p>
<p>log_msg(){<br />
msg=&#8221;[ `/bin/date` ] $1&#8243;<br />
echo &#8220;$msg&#8221; &gt;&gt; $LOG<br />
}</p>
<p>log_err(){<br />
msg=&#8221;[ `/bin/date` ] $1&#8243;<br />
echo &#8220;$msg&#8221; &gt;&gt; $ERR<br />
}</p>
<p>help(){<br />
echo &#8220;Usage $0 -e &lt;EMAIL&gt;&#8221;<br />
}</p>
<p>kill_pid(){<br />
rm -f $PID_FILE<br />
}</p>
<p>remove_file(){<br />
rm -f $DEST$FILE<br />
}</p>
<p># Extracao de argumentos na linha de comando<br />
while getopts e: OPTION ; do<br />
case $OPTION in<br />
e)<br />
EMAIL=$OPTARG<br />
;;<br />
esac<br />
done</p>
<p># Validando dependencias<br />
erro=&#8221;"<br />
wget=$(which wget)	|| err=&#8221;wget&#8221;;<br />
cat=$(which cat)	|| err=&#8221;cat&#8221;;<br />
date=$(which date)	|| err=&#8221;date&#8221;;<br />
mail=$(which mail)	|| err=&#8221;mail&#8221;;<br />
if [ ! -z $erro ] ; then<br />
log_err &#8220;Aplicativo nao encontrado: $erro&#8221;<br />
exit $STATE_CRITICAL<br />
fi</p>
<p>if [ ! -d $DEST ] ; then<br />
log_err &#8220;Diretorio de destino nao encontrado: $DEST&#8221;<br />
exit $STATE_CRITICAL<br />
fi</p>
<p># Valida parametros do script<br />
if [ ! $EMAIL ] ; then<br />
help;<br />
exit $STATE_CRITICAL<br />
fi</p>
<p># Valida se processo ja esta em execucao<br />
if [ -f $PID_FILE ] ; then<br />
pid=$(cat $PID_FILE)<br />
if [[ "$PID_FILE" =~ [0-9]+ ]] ; then<br />
retorno=$(ps -e $pid | wc -l)<br />
if [ $retorno -gt 1 ] ; then<br />
log_err &#8220;Plugin ja esta em execucao com PID $pid&#8221;<br />
echo &#8220;Plugin ja esta em execucao com PID $pid&#8221;<br />
kill_pid<br />
exit $STATE_WARNING<br />
fi<br />
fi<br />
fi</p>
<p>#Armazena o ID do processo no arquivo de PID<br />
echo $$ &gt; $PID_FILE</p>
<p># Download do arquivo<br />
if ! wget -q &#8211;no-verbose -T 60 &#8211;no-check-certificate -P $DEST $ADDR ; then<br />
log_err &#8220;Erro ao baixar arquivo.&#8221;<br />
echo &#8220;Erro ao baixar arquivo.&#8221;<br />
exit $STATE_CRITICAL<br />
fi</p>
<p># Retencao dos IPs<br />
listed=0<br />
FILE=$(ls $DEST | grep ipStatus)<br />
IPS=$(cat $DEST$FILE | cut -d , -f 1,2 | sed -r &#8220;s/,/\n/g&#8221; | sort | uniq)<br />
if [ ! -z "$IPS" ] ; then<br />
blocked=1<br />
fi</p>
<p># Retorno para o Nagios<br />
if [[ $blocked == 1 ]] ; then<br />
echo $IPS | sed -r &#8220;s/ /\n/g&#8221; &gt; $STORED_LOGS<br />
cat $STORED_LOGS<br />
echo -e &#8220;Os IPs abaixo estao bloqueados no Hotmail: \n\n&#8221; &#8220;`echo $IPS | sed -r &#8216;s/ /\n/g&#8217;`&#8221; | mail -e -s &#8220;SNDSCheck WARNING&#8221; $EMAIL<br />
exit $STATE_WARNING<br />
else<br />
IPS=&#8221;Nao ha IPs bloqueados no Hotmail.&#8221;<br />
echo $IPS<br />
echo -e &#8220;$IPS&#8221; | mail -e -s &#8220;SNDSCheck is OK&#8221; $EMAIL<br />
exit $STATE_OK<br />
fi</p>
<p>kill_pid<br />
remove_file</p>
</address>
</address>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=34&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2010/01/14/meus-primeiros-2-plugins-para-o-nagios-linux-nagios-debian-shellscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
		<item>
		<title>Limpeza de cache #linux #linux #linux</title>
		<link>http://databunch.wordpress.com/2009/12/09/limpeza-de-cache-linux-linux-linux/</link>
		<comments>http://databunch.wordpress.com/2009/12/09/limpeza-de-cache-linux-linux-linux/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 12:14:01 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=31</guid>
		<description><![CDATA[Script para limpeza de cache, com cálculo de utilização de memória RAM. O script só faz o drop_cache se a memória utilizada for superior a algum valor. #!/bin/sh # # Salve este script no diretório /etc/cron.hourly e dê permissão # de execução a ele. Desse modo a cada hora sera verificada se a # porcentagem [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=31&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Script para limpeza de cache, com cálculo de utilização de memória RAM. O script só faz o drop_cache se a memória utilizada for superior a algum valor.</p>
<div id="_mcePaste">#!/bin/sh</div>
<div id="_mcePaste">#</div>
<div id="_mcePaste"># Salve este script no diretório /etc/cron.hourly e dê permissão</div>
<div id="_mcePaste"># de execução a ele. Desse modo a cada hora sera verificada se a</div>
<div id="_mcePaste"># porcentagem de memória utilizada pelo sistema atingiu o valor definido</div>
<div id="_mcePaste"># na variável &#8216;percent&#8217;. Caso positivo, o script informará ao kernel</div>
<div id="_mcePaste"># que este deverá alterar o valor da opção &#8216;drop_caches&#8217; para 3.</div>
<div id="_mcePaste">#</div>
<div id="_mcePaste"># Mais detalhes: &#8216;man proc&#8217; -&gt; /proc/sys/vm/drop_caches.</div>
<div id="_mcePaste">PATH=&#8221;/bin:/usr/bin:/usr/local/bin&#8221;</div>
<div id="_mcePaste"># Porcentagem máxima de uso da memória, antes de executar a limpeza:</div>
<div id="_mcePaste"># Obs.: Altere conforme sua necessidade.</div>
<div id="_mcePaste">percent=40</div>
<div id="_mcePaste"># Quantidade de memória RAM no sistema:</div>
<div id="_mcePaste">ramtotaloriginal=`grep -F &#8220;MemTotal:&#8221; &lt; /proc/meminfo | awk &#8216;{print $2}&#8217;`</div>
<div id="_mcePaste">ramtotal=`calc $ramtotaloriginal/1024`</div>
<div id="_mcePaste">echo &#8220;Quantidade de memoria RAM no sistema:&#8221; $ramtotal &#8220;MB&#8221;</div>
<div id="_mcePaste"># Quantidade de RAM livre:</div>
<div id="_mcePaste">ramlivreoriginal=`grep -F &#8220;MemFree:&#8221; &lt; /proc/meminfo | awk &#8216;{print $2}&#8217;`</div>
<div id="_mcePaste">ramlivre=`calc $ramlivreoriginal/1024`</div>
<div id="_mcePaste">echo &#8220;Quantidade de memoria RAM livre:&#8221; $ramlivre &#8220;MB&#8221;</div>
<div id="_mcePaste"># RAM utilizada pelo sistema:</div>
<div id="_mcePaste">ramusadaoriginal=`expr $ramtotaloriginal &#8211; $ramlivreoriginal`</div>
<div id="_mcePaste">ramusada=`calc $ramusadaoriginal/1024`</div>
<div id="_mcePaste">echo &#8220;Quantidade de memoria RAM utilizada:&#8221; $ramusada &#8220;MB&#8221;</div>
<div id="_mcePaste"># Porcentagem de RAM utilizada pelo sistema:</div>
<div id="_mcePaste">putil=`expr $ramusadaoriginal \* 100 / $ramtotaloriginal`</div>
<div id="_mcePaste">echo &#8220;Porcentagem de memoria RAM utilizada pelo sistema:&#8221; $putil&#8221;%&#8221;</div>
<div id="_mcePaste"># Checando porcentagem:</div>
<div id="_mcePaste">echo &#8220;Checando porcentagem&#8230;&#8221;</div>
<div id="_mcePaste">if [ $putil -gt $percent ]</div>
<div id="_mcePaste">then</div>
<div id="_mcePaste">echo &#8220;Sincronizando os dados cacheados na memoria com o(s) disco(s)&#8230;&#8221;</div>
<div id="_mcePaste">sync</div>
<div id="_mcePaste">echo &#8220;Dropando cache&#8230;&#8221;</div>
<div id="_mcePaste">echo 3 &gt; /proc/sys/vm/drop_caches</div>
<div id="_mcePaste">else</div>
<div id="_mcePaste">echo &#8220;Remove-se as variaveis da memoria e finaliza-se o script&#8230;&#8221;</div>
<div id="_mcePaste">echo unset $percent% $ramtotal&#8221;MB&#8221; $ramlivre&#8221;MB&#8221; $ramusada&#8221;MB&#8221; $putil%</div>
<div id="_mcePaste">exit $?</div>
<div id="_mcePaste">fi</div>
<div id="_mcePaste"># Fim</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=31&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2009/12/09/limpeza-de-cache-linux-linux-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
		<item>
		<title>Configurando servidores, montando benchmarks, instalando MediaWiki&#8230; tudo ao mesmo tempo agora.</title>
		<link>http://databunch.wordpress.com/2009/11/20/configurando-servidores-montando-benchmarks-instalando-mediawiki-tudo-ao-mesmo-tempo-agora/</link>
		<comments>http://databunch.wordpress.com/2009/11/20/configurando-servidores-montando-benchmarks-instalando-mediawiki-tudo-ao-mesmo-tempo-agora/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 10:49:49 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=29</guid>
		<description><![CDATA[Estou configurando 9 servidores via ssh, montando estatísticas de concorrência de processos, instalando MediaWiki no servidor local. E ainda tentarei montar um shell script com um roteiro de instalações de pacotes, para o setup dos servidores. Belo feriado.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=29&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Estou configurando 9 servidores via ssh, montando estatísticas de concorrência de processos, instalando MediaWiki no servidor local.</p>
<p>E ainda tentarei montar um shell script com um roteiro de instalações de pacotes, para o setup dos servidores.</p>
<p>Belo feriado.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=29&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2009/11/20/configurando-servidores-montando-benchmarks-instalando-mediawiki-tudo-ao-mesmo-tempo-agora/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
		<item>
		<title>Perl versus Windows Live ID.</title>
		<link>http://databunch.wordpress.com/2009/11/12/perl-versus-windows-live-id/</link>
		<comments>http://databunch.wordpress.com/2009/11/12/perl-versus-windows-live-id/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 10:28:20 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=26</guid>
		<description><![CDATA[Briga de foice num quarto escuro com sebo passado no chão. Como sempre, Microsoft dificultando as coisas. Tentando montar um script que faça log on no SNDS da Microsoft, acesse algumas URLs, e deslogue. Quem disse que consigo ?<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=26&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Briga de foice num quarto escuro com sebo passado no chão.</p>
<p>Como sempre, Microsoft dificultando as coisas.</p>
<p>Tentando montar um script que faça log on no SNDS da Microsoft, acesse algumas URLs, e deslogue.</p>
<p>Quem disse que consigo ?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=26&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2009/11/12/perl-versus-windows-live-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
		<item>
		<title>RBLCHECK completo &#8211; checagem de IPs com shell script</title>
		<link>http://databunch.wordpress.com/2009/11/03/rblcheck-completo-checagem-de-ips-com-shell-script/</link>
		<comments>http://databunch.wordpress.com/2009/11/03/rblcheck-completo-checagem-de-ips-com-shell-script/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 20:03:53 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=22</guid>
		<description><![CDATA[Completando o pôst em que falo sobre o rblcheck, montei um shell script para fazer a checagem e tratamento de ocorrência (caso seja encontrado algum IP listado em algum dos rbls checados). ORIGIN=&#8221;/home/endereco_do_arquivo/arquivo_de_ips.ext&#8221; RESULTS=&#8221;/home/endereco_do_arquivo_de_resultados/arquivo_de_resultados.ext&#8221; start_rblcheck() { msg &#8220;Iniciando execucao&#8230;&#8221; msg &#8220;Validando dependencias&#8230;&#8221; if [ ! -x /usr/bin/rblcheck ] ; then msg &#8220;/urs/bin/rblcheck nao instalado&#8221; exit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=22&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Completando o pôst em que falo sobre o rblcheck, montei um shell script para fazer a checagem e tratamento de ocorrência (caso seja encontrado algum IP listado em algum dos rbls checados).</p>
<p>ORIGIN=&#8221;/home/endereco_do_arquivo/arquivo_de_ips.ext&#8221;<br />
RESULTS=&#8221;/home/endereco_do_arquivo_de_resultados/arquivo_de_resultados.ext&#8221;</p>
<p>start_rblcheck() {<br />
msg &#8220;Iniciando execucao&#8230;&#8221;</p>
<p>msg &#8220;Validando dependencias&#8230;&#8221;</p>
<p>if [ ! -x /usr/bin/rblcheck ] ; then<br />
msg &#8220;/urs/bin/rblcheck nao instalado&#8221;<br />
exit 0<br />
fi</p>
<p>if [ ! -f $ORIGIN ] ; then<br />
msg &#8220;$ORIGIN nao encontrado&#8221;<br />
exit 0<br />
fi</p>
<p>msg &#8220;Dependencias validadas com sucesso&#8230;&#8221;</p>
<p>msg &#8220;Rblcheck iniciado&#8230;&#8221;</p>
<p>while read IPS ; do<br />
RBL=`/usr/bin/rblcheck $IPS|grep &#8220;$IPS listed by&#8221;`<br />
if [ ! -z "$RBL" ] ; then<br />
msg &#8220;$RBL&#8221;<br />
fi<br />
done &lt; $ORIGIN &gt; $RESULTS</p>
<p>msg &#8220;Execucao finalizada&#8221;.&#8221;\n&#8221;<br />
msg &#8220;Arquivo de resultados salvo em $RESULTS&#8221;<br />
}</p>
<p>msg() {<br />
echo &#8220;[ `date` ] $1&#8243;<br />
}</p>
<p>case $1 in<br />
start)<br />
start_rblcheck;<br />
;;<br />
*)<br />
echo &#8220;Script para checagem de IPs pelo RBLCHECK&#8221;<br />
echo &#8220;Usage: $0 start&#8221;<br />
exit 1<br />
;;<br />
esac</p>
<p>No script há um arquivo contendo os IPs a serem checados. Há o destino do arquivo de resultados. O restante do script valida se o rblcheck está instalado, se o arquivo de IPs e a pasta de destino existem.</p>
<p>Depois o script faz a checagem dos IPs (linha a linha no arquivo) e, para cada linha onde houver um IP listado, ele insere esta saída no arquivo de resultados.</p>
<p>Finito.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=22&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2009/11/03/rblcheck-completo-checagem-de-ips-com-shell-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
		<item>
		<title>Conversão de IP em representação numérica (e vice-versa) no MySQL</title>
		<link>http://databunch.wordpress.com/2009/10/27/conversao-de-ip-em-representacao-numerica-e-vice-versa-no-mysql/</link>
		<comments>http://databunch.wordpress.com/2009/10/27/conversao-de-ip-em-representacao-numerica-e-vice-versa-no-mysql/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 17:12:24 +0000</pubDate>
		<dc:creator>Osimar Medeiros</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://databunch.wordpress.com/?p=18</guid>
		<description><![CDATA[MySQL, Linux, Debian, Ubuntu, databases, SNDS, SenderScore<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=18&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Para quem costuma utilizar os serviços de monitoramento online de IPs, tipo SNDS da Microsoft, ou SenderScore, é bom saber que muitas vezes, ao consultar um IP, a URL da página exibe uma info que você pode não reconhecer.</p>
<p>Por exemplo: https://postmaster.live.com/snds/dataIP.aspx?ip=3141348145</p>
<p>Veja que o parâmetro (a representação numérica) representa um IP. E como faz-se para saber que IP é este ?</p>
<p>No MySQL, faça:</p>
<p>SELECT inet_ntoa(3141348145);</p>
<p>Veja o resultado da query:</p>
<p>mysql&gt; SELECT inet_ntoa(3141348145);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| inet_ntoa(3141348145) |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
| 187.61.43.49          |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+<br />
1 row in set (0.02 sec)</p>
<p>O IP é 187.61.43.49.</p>
<p>Para fazer o contrário, também é possível:</p>
<p>mysql&gt; SELECT inet_aton(&#8217;187.61.43.49&#8242;);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| inet_aton(&#8217;187.61.43.49&#8242;) |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
|                3141348145 |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.01 sec)</p>
<p>Para o IP é necessário encapsulá-lo com aspas.</p>
<p>Caso precise consultar muitos IPs simultaneamente, você pode gerar as URLs, com o uso do CONCAT, ainda no MySQL.</p>
<p>Veja:</p>
<p>mysql&gt; SELECT CONCAT(&#8220;http://url_a_ser_concatenada?&#8221;,mtaIPs_ip) FROM mtaPoolsIPs LIMIT 5;<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| CONCAT(&#8220;http://url_a_ser_concatenada?&#8221;,mtaIPs_ip) |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| http://url_a_ser_concatenada?187.61.28.10         |<br />
| http://url_a_ser_concatenada?187.61.28.100        |<br />
| http://url_a_ser_concatenada?187.61.28.101        |<br />
| http://url_a_ser_concatenada?187.61.28.102        |<br />
| http://url_a_ser_concatenada?187.61.28.103        |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
5 rows in set (0.01 sec)</p>
<p>De modos que sua tarefa diária de consulta de IPs se torna muito mais automatizada que fazer tudo à mão&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/databunch.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/databunch.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/databunch.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/databunch.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/databunch.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/databunch.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/databunch.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/databunch.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/databunch.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/databunch.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/databunch.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/databunch.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/databunch.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/databunch.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=databunch.wordpress.com&amp;blog=10085736&amp;post=18&amp;subd=databunch&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://databunch.wordpress.com/2009/10/27/conversao-de-ip-em-representacao-numerica-e-vice-versa-no-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/988d19cf99a164f9e56a2bf4f2b59344?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Osimar Medeiros</media:title>
		</media:content>
	</item>
	</channel>
</rss>
