<?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/"
	>

<channel>
	<title>Temporini Matteo &#187; monitor risorse</title>
	<atom:link href="http://www.temporini.net/category/monitor-risorse/feed" rel="self" type="application/rss+xml" />
	<link>http://www.temporini.net</link>
	<description>It&#039;s time to fix!</description>
	<lastBuildDate>Tue, 07 Sep 2010 06:56:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Monitoring System</title>
		<link>http://www.temporini.net/monitoring-system</link>
		<comments>http://www.temporini.net/monitoring-system#comments</comments>
		<pubDate>Mon, 03 May 2010 10:53:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Matteo]]></category>
		<category><![CDATA[Temporini]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[monitor risorse]]></category>
		<category><![CDATA[mrtg]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[monitoring system]]></category>
		<category><![CDATA[munin]]></category>

		<guid isPermaLink="false">http://www.temporini.net/?p=358</guid>
		<description><![CDATA[<p>Tempo fa scrissi un articolo su come monitorare lo stato di un server, tramite mrtg e rrd.</p>
<p>Il sistema era un po&#8217; macchinoso, richiedeva un po&#8217; di tempo per la configurazione e a volte su alcune macchina era abbastanza complicato da configurare. Ora grazie a Munin possiamo dimenticarci tutto questo.</p>
<p>Tramite un semplicissimo</p>
<p>apt-get install munin-node munin</p>
<p>possiamo installare questo [...]]]></description>
			<content:encoded><![CDATA[<p>Tempo fa scrissi un <a title="Configurazione snmp" href="http://www.temporini.net/configurazione-snmp" target="_blank">articolo su come monitorare</a> lo stato di un <a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>, tramite mrtg e rrd.</p>
<p>Il sistema era un po&#8217; macchinoso, richiedeva un po&#8217; di tempo per la configurazione e a volte su alcune macchina era abbastanza complicato da configurare. Ora grazie a <a title="http://munin-monitoring.org/" href="http://munin-monitoring.org/" target="_blank">Munin</a> possiamo dimenticarci tutto questo.</p>
<p>Tramite un semplicissimo</p>
<p><code>apt-get install <a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a>-node <a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a></code></p>
<p>possiamo installare questo simpatico tool che ci permetterà di monitorare la nostra macchina.</p>
<p>Una volta installato dobbiamo solo editare il seguente file</p>
<p><code>nano /etc/<a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a>/<a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a>.conf</code></p>
<p>e cambiare le seguenti linee ( o accomodarle alle nostre esigenze )</p>
<p><code>dbdir   /var/lib/<a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a><br />
htmldir /var/www/<a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a><br />
logdir  /var/log/<a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a><br />
rundir  /var/run/<a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a></code></p>
<p><code># a simple host tree<br />
[localhost.localdomain]<br />
address 127.0.0.1<br />
use_node_name yes</code></p>
<p>Qua sostituiamo i percorsi come ci interessano, nello specifico facciamo attenzione a htmldir che è la directory del nostro webserver apache, e il parametro localhost.localdomain con l&#8217;hostname del nostro <a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.</p>
<p>Qua sotto vediamo l&#8217;immagine di inizio di <a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a> accessibile all&#8217;indirizzo http://hostname/<a href="http://www.temporini.net/tag/munin" class="st_tag internal_tag" rel="tag" title="Posts tagged with munin">munin</a> e la schermata di utilizzo della cpu</p>
<p><a href="http://www.temporini.net/wp-content/uploads/2010/05/munin1.png"><img class="alignleft size-medium wp-image-360" title="Munin start Page" src="http://www.temporini.net/wp-content/uploads/2010/05/munin1-300x64.png" alt="" width="300" height="64" /></a><a href="http://www.temporini.net/wp-content/uploads/2010/05/munin2.png"><img class="alignright size-medium wp-image-361" title="Muninc Cpu Usage" src="http://www.temporini.net/wp-content/uploads/2010/05/munin2-300x125.png" alt="Muninc Cpu Usage" width="300" height="125" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.temporini.net/monitoring-system/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configurazione snmp</title>
		<link>http://www.temporini.net/configurazione-snmp</link>
		<comments>http://www.temporini.net/configurazione-snmp#comments</comments>
		<pubDate>Wed, 20 Jun 2007 09:21:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CPU]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Memoria]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[RAM]]></category>
		<category><![CDATA[Snmp]]></category>
		<category><![CDATA[Swap]]></category>
		<category><![CDATA[TCP]]></category>
		<category><![CDATA[demoni]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[file system]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[monitor risorse]]></category>
		<category><![CDATA[mrtg]]></category>
		<category><![CDATA[ncftp]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[servizi]]></category>

		<guid isPermaLink="false">http://www.temporini.net/archives/27</guid>
		<description><![CDATA[<p>Questa breve guida spiega (o almeno ci prova) come configurare il servizio di snmp su un server linux, per il monitoraggio delle risorse. Provvede poi a integrare i dati raccolti tramite grafici generati con Mrtg.</p>
<p>Questa guida è stata sviluppata su sistemi Fedora Core 5, ma è facilmente adattabile (se non addirittura direttamente applicabile) anche ad altri [...]]]></description>
			<content:encoded><![CDATA[<p>Questa breve guida spiega (o almeno ci prova) come configurare il servizio di <strong>snmp</strong> su un <a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a> <strong>linux</strong>, per il <strong>monitoraggio delle risorse</strong>. Provvede poi a integrare i dati raccolti tramite grafici generati con <strong><a href="http://oss.oetiker.ch/mrtg/" title="MRTG - Tobi Oetiker's MRTG">Mrtg</a></strong>.</p>
<p>Questa guida è stata sviluppata su sistemi <strong>Fedora Core 5</strong>, ma è facilmente adattabile (se non addirittura direttamente applicabile) anche ad altri sistemi (<a href="http://www.debian.org" title="Debian -- il Sistema Operativo Universale"><strong>Debian</strong></a>, <strong><a href="http://www.slackware.org" title="The Slackware Linux Project">Slackware</a> </strong>con piccole modifiche inereti al sistema di pacchettizzazione).</p>
<p><em><strong>1. Installazione e configurazione Snmpd</strong></em></p>
<p>Per prima cosa provvediamo a installare il servizio <strong>snmpd </strong>tramite i pacchetti disponibili della nostra distribuzione:<br />
<em>[root@localhost ~] yum install net-snmp-utils net-snmp</em></p>
<p>per Debian i pacchetti si installano con il seguente comando</p>
<p><em>[root@localhost ~] apt-get install snmpd snmp</em></p>
<p>A questo punto controllate se il demone <strong>snmpd </strong>è stato lanciato<br />
<em>[root@localhost ~] ps -aux | grep snmpd</em></p>
<p>dovreste visualizzare qualcosa tipo</p>
<p><em>root   5512  0.0  2.3  5872 3012 pts/0    S    22:04   0:00 /usr/sbin/snmpd</em></p>
<p>Se il demone non è in esecuzione provare a lanciarlo a mano con il seguente comando</p>
<p><em>[root@localhost ~] /etc/init.d/snmpd restart</em></p>
<p>e ricontrollate il suo stato.</p>
<p>Per aggiungere lo script all&#8217;avvio della macchina basta eseguire<br />
<em>[root@localhost ~] chkconfig &#8211;level 345 snmpd on</em></p>
<p>Ora il demone snmpd è correttamente in esecuzione, proviamo a controllarne il corretto funzionamento tramite una semplice query sulle interfacce di rete:</p>
<p><em>[root@ns9 ~]# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndexIP-MIB::ipAdEntIfIndex.81.208.101.XXX = INTEGER: 2IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1<br />
IP-MIB::ipAdEntIfIndex.192.168.0.XXX = INTEGER: 3<br />
[root@ns9 ~]#</em></p>
<p>Se tutto funziona correttamente, allora il demone è correttamente configurato, se doveste avere qualche problema, è meglio controllare il file di configurazione /etc/snmp/snmpd.conf</p>
<p>All&#8217;interno di questo file modifichiamo questa linea<br />
<em> com2sec notConfigUser  default       public</em></p>
<p>e sostituiamola con quella di seguito adattando ovviamente le subnet come preferite.</p>
<p><em> com2sec local     localhost           public<br />
com2sec mynetwork 192.168.0.0/24      public</em></p>
<p>Scendendo ancora nel file cercate la stringa</p>
<p><em>group   notConfigGroup v1           notConfigUser<br />
group   notConfigGroup v2c           notConfigUser</em></p>
<p>e sostituitela con</p>
<p><em>group MyRWGroup v1         local<br />
group MyRWGroup v2c        local<br />
group MyRWGroup usm        local<br />
group MyROGroup v1         mynetwork<br />
group MyROGroup v2c        mynetwork<br />
group MyROGroup usm        mynetwork</em></p>
<p>Cerchiamo ora la stringa seguente</p>
<p><em>view    systemview     included      system</em></p>
<p>e sostituiamola con</p>
<p><em>view all    included  .1                               80</em></p>
<p>Abbiamo quasi finito&#8230; cercate la stringa</p>
<p><em>access  notConfigGroup &#8220;&#8221;      any       noauth    exact  systemview none none</em></p>
<p>e sostituitela con</p>
<p><em>access MyROGroup &#8220;&#8221;      any       noauth    exact  all    none   none<br />
access MyRWGroup &#8220;&#8221;      any       noauth    exact  all    all    none</em></p>
<p>Ed ora l&#8217;ultima stringa da modificare<br />
<em>syslocation Unknown (edit /etc/snmp/snmpd.conf)<br />
syscontact Root root@localhost (configure /etc/snmp/snmp.local.conf)</em></p>
<p>queste stringhe sono delle brevi stringhe descrittive per l&#8217;identificazione del vostro sistema, fondamentalmente potete scriverci cosa volete io ho messo questo</p>
<p><em>syslocation Linux (FEDORA_FC5), localhost<br />
syscontact matteo@temporini.net</em></p>
<p>Bene ora se tutto è andato per il verso giusto, riavviate il demone snmp (/etc/init.d/snmpd restart) e provate a fare nuovamente la query (snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex) che a questo punto non dovrebbe darvi problemi.</p>
<p><em><strong>2. Installazione e configurazione MRTG</strong></em></p>
<p>Installiamo <strong>mrtg </strong>con il comando</p>
<p><em>[root@localhost ~]# yum install mrtg</em></p>
<p>analogamente per <strong>debian </strong></p>
<p><em>[root@localhost ~]# apt-get install mrtg</em></p>
<p>A questo punto presuppongo che abbiate un <strong>webserver </strong>correttamente funzionante (io uso <a href="http://www.apache.org" title="The Apache Software Foundation">Apache</a> ma non vi sono problemi a utilizzarne altri come <strong>ISS </strong>o <strong>Lighthttpd</strong>).</p>
<p>Presupponiamo che la root di <strong>apache </strong>stia in /var/www/html/ andiamo a creare la cartella che conterrà i nostri dati</p>
<p><em>[root@localhost ~]# mkdir -p /var/www/html/mymrtg/</em></p>
<p>ora eseguiamo il seguente comando per generare automaticamente il file di configurazione di <strong>mrtg</strong></p>
<p><em>[root@localhost ~]# cfgmaker &#8211;global &#8216;WorkDir: /var/www/html/mymrtg&#8217; &#8211;output /etc/mrtg/mymrtg.cfg public@localhost</em></p>
<p>e creiamo l&#8217;index.html del nostro sistema di monitoraggio</p>
<p><em>[root@localhost ~]# indexmaker &#8211;output=/var/www/html/mymrtg/index.html /etc/mrtg/mymrtg.cfg</em></p>
<p>(N.B.= &#8212; sono due trattini (-) vicini ma sembrano una linea unica se fate il cut &#038; paste fate attenzione)</p>
<p>Ora è tutto pronto non ci resta che eseguie <strong>mrtg </strong>indicandogli il file di configurazione da utilizzare</p>
<p><em>[root@localhost ~]# env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg &#8211;logging /var/log/mrtg.log</em></p>
<p>In ambiente <strong>fedora </strong>è necessaria la stringa env LANG=C, su altri sistemi probabilmente questa variabile di ambiente è già settata in questo modo per cui potrebbe bastare solamente</p>
<p><em>[root@localhost ~]# /usr/bin/mrtg /etc/mrtg/mymrtg.cfg &#8211;logging /var/log/mrtg.log</em></p>
<p>A questo punto non rimane che vedere il risultato di tutto il nostro lavoro andando al seguente indirizzo http://www.your.com/mymrtg/ o http://localhost/mymrtg/</p>
<p>L&#8217;ultimo step da seguire consiste nel mettere in <strong>crontab </strong>l&#8217;esecuzione dello script di aggiornamento di <strong>mrtg</strong>, il modo più semplice per farlo è con il comando</p>
<p><em>[root@localhost ~]# crontab -e</em></p>
<p>Vi si aprirà una finestra e qui inseriteci</p>
<p><em>*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg &#8211;logging /var/log/mrtg.log</em></p>
<p>lo script verrà lanciato ogni 5 minuti, in tal modo i campionamenti verranno aggiornati sui nostri grafici in ogni 5 minuti. Qualora voleste avere stime più precise potete diminuire il tempo di campionamento ad 1 minuto ad esempio ottenendo così risultati più accurati.</p>
<p><em><strong>3. Ulteriori risorse da monitorare</strong></em></p>
<p>Quanto sino ad ora visto, permette di creare un piccolo sistema di monitoraggio per la banda utilizzata dai vari dispositivi di rete, in un tempo realtivamente ristretto e con una buona accuratezza (questo dipende ovviamente dall&#8217;intervallo di campionamento che si sceglie).</p>
<p>La domanda a questo punto che uno potrebbe porsi è &#8220;ma posso monitorare solo la banda o anche altre risorse?&#8221;.</p>
<p>Ovviamente la risposta è si, è possibile monitorare altri risorse di sistema, cosa che si è resa molto utile per identificare anomalie nei sitemi e risolverle (es.: utilizzi intensivi della cpu da parte di particolari processi in determinate ore della giornata).</p>
<p>Riporterò ora delle piccole porzioni di codice da aggiungere al file /etc/mrtg/myrtgc.cfg per aggiungere queste funzionalità.</p>
<p>3.1 Monitoraggio dell&#8217;utilizzo di <strong>CPU</strong></p>
<p><em>#<br />
# CPU Monitoring<br />
# (Scaled so that the sum of all three values doesn&#8217;t exceed 100)<br />
#</em></p>
<p><em>Target[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]:ssCpuRawUser.0&amp;ssCpuRawUser.0:public@localhost + ssCpuRawSystem.0&amp;ssCpuRawSystem.0:public@localhost + ssCpuRawNice.0&amp;ssCpuRawNice.0:public@localhost<br />
Title[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]: <a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">Server</a> CPU Load<br />
PageTop[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]: &lt;H1&gt;CPU Load &#8211; System, User and Nice Processes&lt;/H1&gt;<br />
MaxBytes[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]: 100<br />
ShortLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]: %<br />
YLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]: CPU Utilization<br />
Legend1[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]: Current CPU percentage load<br />
LegendI[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]: Used<br />
LegendO[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]:<br />
Options[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]: growright,nopercent<br />
Unscaled[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.cpu]: ymwd </em></p>
<p>3.2 Monitoraggio dell&#8217;utilizzo della <strong>memoria </strong>totale rispetto a quella disponibile</p>
<p><em>#<br />
# Memory Monitoring (Total Versus Available Memory)<br />
#</em></p>
<p><em>Target[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: memAvailReal.0&amp;memTotalReal.0:public@localhost<br />
Title[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: Free Memory<br />
PageTop[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: &lt;H1&gt;Free Memory&lt;/H1&gt;<br />
MaxBytes[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: 100000000000<br />
ShortLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: B<br />
YLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: Bytes<br />
LegendI[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: Free<br />
LegendO[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: Total<br />
Legend1[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: Free memory, not including swap, in bytes<br />
Legend2[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: Total memory<br />
Options[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: gauge,growright,nopercent<br />
kMG[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.memory]: k,M,G,T,P,X</em></p>
<p>3.3  Percentuale di utilizzo della <strong>Memoria</strong></p>
<p><em>#<br />
# Memory Monitoring (Percentage usage)<br />
#<br />
Title[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: Percentage Free Memory<br />
PageTop[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: &lt;H1&gt;Percentage Free Memory&lt;/H1&gt;<br />
Target[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: ( memAvailReal.0&amp;memAvailReal.0:public@localhost ) * 100 / ( memTotalReal.0&amp;memTotalReal.0:public@localhost )<br />
options[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: growright,gauge,transparent,nopercent<br />
Unscaled[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: ymwd<br />
MaxBytes[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: 100<br />
YLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: Memory %<br />
ShortLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: Percent<br />
LegendI[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: Free<br />
LegendO[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: Free<br />
Legend1[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: Percentage Free Memory<br />
Legend2[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.mempercent]: Percentage Free Memory</em></p>
<p>3.4. Nuove connessioni <strong>TCP</strong></p>
<p><em>#<br />
# New TCP Connection Monitoring (per minute)<br />
#</em></p>
<p><em>Target[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: tcpPassiveOpens.0&amp;tcpActiveOpens.0:public@localhost<br />
Title[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: Newly Created TCP Connections<br />
PageTop[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: &lt;H1&gt;New TCP Connections&lt;/H1&gt;<br />
MaxBytes[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: 10000000000<br />
ShortLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: c/s<br />
YLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: Conns / Min<br />
LegendI[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: In<br />
LegendO[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: Out<br />
Legend1[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: New inbound connections<br />
Legend2[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: New outbound connections<br />
Options[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.newconns]: growright,nopercent,perminute</em></p>
<p>3.5 Connessioni <strong>TCP </strong>stabilite</p>
<p><em>#<br />
# Established TCP Connections<br />
#</em></p>
<p><em>Target[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]: tcpCurrEstab.0&amp;tcpCurrEstab.0:public@localhost<br />
Title[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]: Currently Established TCP Connections<br />
PageTop[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]: &lt;H1&gt;Established TCP Connections&lt;/H1&gt;<br />
MaxBytes[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]: 10000000000<br />
ShortLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]:<br />
YLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]: Connections<br />
LegendI[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]: In<br />
LegendO[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]:<br />
Legend1[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]: Established connections<br />
Legend2[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]:<br />
Options[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.estabcons]: growright,nopercent,gauge</em></p>
<p>3.6 Utilizzo del <strong>disco</strong></p>
<p>L&#8217;utilizzo di questo parametro di monitoraggio richiede l&#8217;inserimento nel file /etc/snmp/snmpd.conf del seguente codice</p>
<p><em>disk /</em></p>
<p>con conseguente riavvio del demone snmpd<br />
<em>#<br />
# Disk Usage Monitoring<br />
#</em></p>
<p><em>Target[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.disk]: dskPercent.1&amp;dskPercent.1:public@localhost<br />
Title[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.disk]: Disk Partition Usage<br />
PageTop[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.disk]: &lt;H1&gt;Spazio su disco utilizzato&lt;/H1&gt;<br />
MaxBytes[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.disk]: 100<br />
ShortLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.disk]: %<br />
YLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.disk]: Utilization<br />
LegendI[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.disk]: Partizione /<br />
Options[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.disk]: gauge,growright,nopercent<br />
Unscaled[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.disk]: ymwd</em></p>
<p>3.7 Carichi della <strong>CPU</strong></p>
<p><em>#<br />
# Load Average<br />
#</em></p>
<p><em>Target[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]: laLoadInt.2&amp;laLoadInt.3:public@localhost<br />
MaxBytes[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]: 5000<br />
Title[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]: Load Average * 100<br />
PageTop[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]:&lt;h1&gt;Load Average * 100&lt;/h1&gt;<br />
YLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]: Load Average<br />
ShortLegend[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]:<br />
Legend1[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]: Load average 5 min<br />
Legend2[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]: Load average 15 min<br />
LegendI[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]:  5min load avg<br />
LegendO[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]:  15min load avg<br />
Options[<a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a>.loadavg]: nopercent,growright,noinfo,gauge</em></p>
<p><strong>4. Monitoraggio del traffico email di Postfix </strong></p>
<p>Un discorso a parte va fatto per quanto riguarda il monitoraggio sull&#8217;invio e la ricezione di email tramite <strong>postfix</strong>.</p>
<p>Grazie alla documentazione trovata in rete mi è stato possibile implmentare un sistema che permette di contare il numero di email inviate e ricevute dal <a href="http://www.temporini.net/tag/server" class="st_tag internal_tag" rel="tag" title="Posts tagged with server">server</a> di posa, nell&#8217;arco di tempo dell&#8217;intervallo di campionamento (i famosi 5 minuti). Questo viene  realizzato tramite il richiamo, da parte di <strong>mrtg</strong>, di alcuni script esterni che fanno quanto richiesto, una volta raccolti i dati vengono processati da mrtg per la generazione dei grafici.</p>
<p>Questi script che bisogna utilizzaresono scritti in perl per cui dovete installare alcuni moduli in perl tramite <strong>cpan</strong>, prima di fare questo installate <strong>ncftp </strong>che viene utilizzato da perl per scaricare i file, questo semplicemente usando il comando</p>
<p><em>[root@localhost ~]# yum install ncftp</em></p>
<p>analogamente per <strong>debian </strong></p>
<p><em>[root@localhost ~]# apt-get install ncftp</em></p>
<p>a questo punto lanciate il comando cpan e dopo aver risposto a un po&#8217; di domande, che vi chiederà lui per la corretta configurazione di della shell del <strong>perl </strong>(solitamente basta dare invio a tutte prendendo i parametri di default), eseguite il comando</p>
<p><em>[root@localhost ~]# cpan<br />
Terminal does not support AddHistory.</em></p>
<p><em>cpan shell &#8212; CPAN exploration and modules installation (v1.7602)<br />
ReadLine support available (try &#8216;install Bundle::CPAN&#8217;)</em></p>
<p><em>cpan&gt; install File::Tail</em></p>
<p>una volta finita l&#8217;installazione di questo moduletto possiamo caricare i file in <strong>perl</strong>, son tre semplici file che dovete mettere in /usr/local/bin con i permessi di esecuzione</p>
<p><a href="http://www.temporini.net/wp-content/uploads/mrtg-mailstats.pl" title="mrtg-mailstats.pl">mrtg-mailstats.pl</a><br />
<a href="http://www.temporini.net/wp-content/uploads/mailstats.pl" title="mailstats.pl">mailstats.pl</a><br />
<a href="http://www.temporini.net/wp-content/uploads/update-mailstats.pl" title="update-mailstats.pl">update-mailstats.pl</a></p>
<p>A questo punto non ci rimane che lanciare il processo  update-mailstats.pl (script che si occupa di tenere costantemente monitorato il traffico del <strong>mailserver</strong>) con il comando</p>
<p><em>[root@localhost ~]# /usr/local/bin/update-mailstats.pl &amp;</em></p>
<p>con il comando mailstats.pl è possibile vedere le statistiche in tempo reale sul numero totale di messaggi inviati e ricevuti come nel seguente esempio</p>
<p><em>[root@localhost ~]# mailstats.pl<br />
RECEIVED:smtp 98057<br />
SENT:local 235<br />
SENT:smtp 54423<br />
SENT:virtual 42947<br />
[root@localhost ~]#  </em></p>
<p>Aggiungiamo nel file /etc/mrtg/mymrtg.cfg il seguente codice</p>
<p><em>#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;#<br />
# MRTG mail cfg:  Postfix mailstats plotting with MRTG          #<br />
#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;#<br />
Target[postfix]: `/usr/local/bin/mrtg-mailstats.pl`<br />
Options[postfix]: gauge, growright<br />
Title[postfix]: Postfix Statistics<br />
PageTop[postfix]: &lt;H1&gt;Postfix Statistics&lt;/H1&gt;<br />
MaxBytes[postfix]: 1000000<br />
WithPeak[postfix]: dwmy<br />
YLegend[postfix]: No. of messages<br />
ShortLegend[postfix]: messages<br />
LegendI[postfix]:  Incoming:<br />
LegendO[postfix]:  Outgoing:<br />
#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;#</em></p>
<p>rigeneriamo l&#8217;index di <strong>mrtg </strong>con il comando</p>
<p><em>[root@localhost ~]# indexmaker &#8211;output=/var/www/html/mymrtg/index.html /etc/mrtg/mymrtg.cfg</em></p>
<p>e abbiamo finito <img src='http://www.temporini.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Ora dovreste vedere, man mano che i valori vengono campionati, i grafici anche sulle mail in ingresso e in uscita di postfix. Una tecnica simile penso sia molto semplice da utilizzare anche per altri programmi e risorse.</p>
<p>Se avete suggerimenti, scritiche miglioramenti, script o teniche per il monitoraggio di altre risorse di sistema, contattatemi.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.temporini.net/configurazione-snmp/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
