Monitorare il traffico di rete su Hyper-V non è più un problema
Il monitoraggio del traffico di rete sui dispositivi di rete si basa tradizionalmente sulle query SNMP. Attraverso comandi predefiniti questo protocollo riesce a generare le statistiche per la trasmissione di pacchetti di dati da una o più interfacce di rete.
Mentre le query sui dispositivi di rete vengono ancora eseguite tramite SNMP, nell’area dei server Microsoft Hyper-V è necessario l’adozione di altri approcci per generare tali statistiche. Uno dei motivi consiste nella configurazione della connessione di rete: ad esempio, molte interfacce di rete fisiche di un apparecchio Hyper-V appartengono ad un’interfaccia logica, che può anche distribuire il traffico di rete su più dispositivi di rete, ad esempio su diversi switch. Un’altra ragione per l’utilizzo di approcci alternativi è che Microsoft ha terminato la manutenzione e l’innovazione dei servizi SNMP sui loro sistemi operativi.
Schematicamente, un cablaggio di rete fisica potrebbe essere il seguente: Un host fisico Hyper-V dispone di due connessioni di rete fisiche attive che sono collegate alla rete tramite due switch.
Esempio di cablaggio di una rete fisica
Questa architettura viene ampliata da un livello logico (all’interno dell’infrastruttura Microsoft Hyper-V) ad un ulteriore livello: la scheda di rete virtuale Hyper-V. Questo forma l’interfaccia per l’infrastruttura Hyper-V per trasferire i pacchetti dati alla rete. Un esempio di questa infrastruttura potrebbe essere simile a questo esempio
Esempio di cablaggio di rete con interfaccia per l’infrastruttura Hyper-V
Qui si può vedere che non è possibile calcolare statistiche complessive di trasferimento, né sullo switch nè sul server stesso, considerando le interfacce fisiche. Esempio: se si aggrega tutto il traffico in entrata che arriva a “CoreSwitch 1”, si ottiene una panoramica dell’intera infrastruttura Hyper-V, ma non è possibile determinare il traffico generato da un singolo host Hyper-V, dato che il traffico è distribuito su più switch. È per questo motivo che è necessario misurare il traffico di rete, considerando l’interfaccia logica, nell’esempio ‘VM1’.
Per raggiungere questo obiettivo, è stato scelto un approccio basato sui comandi PowerShell, che chiama uno script su Hyper-V tramite NSClient ++. Questo script è basato sul comando “Get-NetAdapter” e fornisce le statistiche di trasferimento di tutte le interfacce di rete logiche tramite “Get-NetAdapterStatistics”. Queste statistiche consistono in un conteggio in byte e devono essere calcolate in un passaggio successivo in base agli intervalli trascorsi dall’ultima chiamata.
Il risultato del calcolo viene formattato in formato standard Nagios per la visualizzazione in NetEye.
La rappresentazione grafica viene eseguita nel grafico PNP4Nagios e nella versione più recente di NetEye anche in Grafana in base ai dati raccolti in InfluxDB.
Se desiderate avere lo script PowerShell e una breve guida per la sua configurazione di NSClient ++ (versione 0.4.x) potete scaricare il seguente file zip: netAdapterStatistics
After my graduation in Applied Computer Science at the Free University of Bolzano I decided to start my professional career outside the province. With a bit of good timing and good luck I went into the booming IT-Dept. of Geox in the shoe district of Montebelluna, where I realized how a big IT infrastructure has to grow and adapt to quickly changing requirements. During this experience I had also the nice possibility to travel the world, while setting up the various production and retail areas of this company. Arrived at Würth Phoenix I started developing on our monitoring solution NetEye. Today, in my position as Consulting an Project Manager I am continuously heading to implement our solutions to meet the expectation of your enterprise customers.
Author
Patrick Zambelli
After my graduation in Applied Computer Science at the Free University of Bolzano I decided to start my professional career outside the province. With a bit of good timing and good luck I went into the booming IT-Dept. of Geox in the shoe district of Montebelluna, where I realized how a big IT infrastructure has to grow and adapt to quickly changing requirements. During this experience I had also the nice possibility to travel the world, while setting up the various production and retail areas of this company. Arrived at Würth Phoenix I started developing on our monitoring solution NetEye. Today, in my position as Consulting an Project Manager I am continuously heading to implement our solutions to meet the expectation of your enterprise customers.
Choosing the right backup solution is critical for system administrators and IT professionals. The upcoming NetEye 4.41 version will bring an update to MariaDB, moving from version 10.3 to 10.11. This makes it especially timely to explore the opportunities offered Read More
In NetEye environments we use Tornado to collect events, elaborate on them, and send notifications based on them from a lot of sources (syslog, email, SNMP traps and so on). In this article I'd like to suggest a different use Read More
As technology continually evolves, keeping our software stack up to date is essential for performance, security, and access to new functionalities. In this post, I want to share how we upgraded MariaDB from version 10.3 to 10.11 as part of Read More
In some test or development environments, you may need to simulate the presence of GSM modems without having an actual physical device. This can be useful for example when testing monitoring checks, SMS management systems, or creating new notification rules. Read More
Just like last year, we had the wonderful opportunity to attend FOSDEM, the most important open source conference in Europe. This year was no exception, and among the many exciting talks, one that particularly caught my attention was Alex Stefanini’s Read More