Hello and Thank you in advance.
I am trying to grep "dropped" from the command i run within the python. The command is a simple /sbin/ifconfig.
I have it being written to a file but would like to have it being kept in mem. Currently when i run the script i get the following.
RX packets:3702045 errors:0 dropped:0 overruns:0 frame:0
TX packets:3587203 errors:0 dropped:0 overruns:0 carrier:0
RX packets:310 errors:0 dropped:0 overruns:0 frame:0
TX packets:310 errors:0 dropped:0 overruns:0 carrier:0
I am trying to make a script to alert me if we drop packets. So if the number equals 0 we are fine if it is anything else besides 0 then it will alert me.
I know the script can be made with perl as well but i want to learn python.
ifconfig = os.popen('/sbin/ifconfig | grep dropped').read()
fname = open("/tmp/ifconfig.tmp",'w')