2

I'm writing a python script with the psutil module that monitors some of the running specs of my web servers, for example cpu usage, memory usage and disk usage. One information I want to get from the script is all the ip addresses associated with my network interface cards.

This is how I do it:

import psutil

ifcs = psutil.net_if_addrs()
IPs = []

for ifc in ifcs:
    for snic in ifcs[ifc]:
        IPs.append(snic.address)

My question is, what is the snic object refering to in the real world? It seems that each physical network card has a few snics attached to it. If I only want to get the snics with the IPv4 address, as those were the ones in real usage, how do I do it?

Thank you.

LightBlue
  • 21
  • 2
  • Good question. I don't understand what "snic" means. I created a issue https://github.com/giampaolo/psutil/issues/1273 – guettli May 04 '18 at 09:59

1 Answers1

2

It stands for system network interface card

See: https://github.com/giampaolo/psutil/issues/1273#issuecomment-386563319

guettli
  • 25,042
  • 81
  • 346
  • 663