LLDP Link Level Discovery Protocol on Windows and Linux

ldwinI need to know where are my computers connected without running around in the building, checking cables and reading not-so-easy-to-read cryptic labels. I’m not Central IT, so I don’t have access to the core switches. What can I do? First I build a list of Linux clients, like client01…client10, and Windows Clients. On then, I install the package lldpd. For CentOS 7.X, it is done like this:

yum install lldpd
systemctl enable lldpd.service 
systemctl start lldpd.service

You can now try it. For example I will show the neighbours:

root@client01 # lldpcli show neighbors
---------------------------------------------------
LLDP neighbors:
----------------------------------------------------
Interface: enXXX, via: LLDP, RID: 2, Time: YYY
Chassis:
ChassisID: mac AA:BB:CC:DD:EE:FF
SysName: SYS-SWITCH-CRYPTIC-NAME
SysDescr: My-Swit-Model-With-SW-Version
TTL: 120
MgmtIP: 111.222.333.444
Capability: Bridge, on
Port:
PortID: ifname 1
PortDescr: TP-1
--------------------------------------------------

Obviously I edited the output. We can grep the output, for example, on a for loop to get the SysName or PortDescr, once we are familiar with the ouput. What about Windows? For Windows, we can install the program above. You can find it here. By the way, the screen capture is from the blog entry. Now time to assemble the output on a web. Because I love web pannels 😀

Advertisements

Monitoring network traffic on Windows

I’m now trying to get a global number of bandwidth usage. The reason is quite complex, and it’s out of the scope of the post, but basically, I want to say we use 15 GB/s in total on the average, or something like that. Also I want to plot it, to see how the network demand is evolving. For that I need to record on a file CSV values like date,value. Let’s have a look on how to get that on Windows.

The natural network tool is netstat. Here you have a guide on netstat. We can use netstat for getting a lot of interesting information, like who’s logged in. We want to use it to get the Interface statistics. Try it out:

netstat -e

The given numbers are not human-readable. At least not for me. We wrap the command on a windows batch script and do some calculations with its output, so that we end up with the numbers I want.  The solution given here seems to work, but only for a while. I left the modified version of the solution offered running, but after sometime the stdout on my cmd shell was no more refreshed. Since I don’t want to debug it and I don’t need to use batch, I move on and search for a python network bandwith monitor. That solution kind of work. My modified version is here:

import time
import psutil
import sys
from time import gmtime, strftime
sys.stdout = open('running.csv', 'w')

def main():
   old_value = 0
   while True:
   new_value = psutil.net_io_counters().bytes_sent + 
               psutil.net_io_counters().bytes_recv
         if old_value:
               send_stat(new_value - old_value)
         old_value = new_value
         time.sleep(10), sys.stdout.flush()

def convert_to_gbit(value):
    return str(round(value/1024./1024./1024.*8,4))
def send_stat(value):
    print strftime("%Y-%m-%d-%H-%M,", gmtime()),
           convert_to_gbit(value)
main()

As usual with python, be careful with the indentation.  Some comments about my modifications. Number one: I round the value.  You may need less decimals, or more. Number two: I print the current date on the format I like. Number three: I write on a file, that I flush on each while loop. And if you have problems with psutil, you can learn how to import psutil here. Basically,

C:\>Python27\python.exe -m pip install psutil

Don’t forget that you have of course other proffesional solutions, if you just want to monitor one computer. I don’t want to monitor only one, and I don’t want to install “alien” software on my “delicated” windows servers. That’s why I go for this. Unfortunately, life is complicated, what can I say 😦

An ASCII version of Star Wars Episode IV

2018-10-13-image-4

This you need to check out! Open a command prompt, and type:

 telnet towel.blinkenlights.nl

Note that you need, of course, to have telnet. Found here while looking for windows command prompt shortcuts. The full article is very interesting, so don’t go directly to the end of it. Note 2: it works also on linux, if you have telnet installed. Have fun! 🙂

Windows 7 Update error 8007000e

snap227Back to work, I found out that one of the Windows 7 PCs that run VIP hardware crashed like the old computer that is indeed. Windows 7 is already 10 years old, but it’s still the weapon of choice for VIP hardware. The reason is clear, the development and upgrade of the drivers (and the software) is not an easy candy for the companies. I understand it very well.

Anyway, time for a Windows 7 complete reinstall in a computer that was previously running it already. Fortunately I keep the original disk and the original Product Key. I remove the useless old disk (it’s not even readable, and it makes funny noises when plugged) put a new SSD and go through the easy Windows 7 install. I give it the same PC name, and I configure the same user, so that there are no troubles for the hardware clients. After typing the Product Key, the total installation time is around one hour. Not so much. I can’t comment if it’s a long or a short time, I don’t have too much data about. It’s when I try to update the system to the latest patch that I find two issues.

Issue number one: the Product Key I entered during the install was not taken at the end as a valid one. Why is that? the hardware (that is check to validate the key) is the same. Maybe it was not taken at installation time? I try giving it in again and it works.

Issue number two: the above windows update error. I follow the solution that you can find here. The picture is also from there. The problem is, I can’t even open the browser to download the IE11! What now? I do manage to download an install Chrome, and with it, I get the desired IE11. Unfortunately after step 9 (the last reboot) I still get the update error. On the other hand, if I do afterwards what I found here, it works! So my recipe to get rid of the error is as follows:

  1. Install IE11. I got it from Chrome.
  2. Remove the two hot fixes KB2534111, KB2639308
  3. Download KB3102810, reboot, install the patch.
  4. Stop the Windows update service via services.msc, restart it.

Of course this is my solution, so try it under your own risk 🙂

Code 43 Error: Windows has stopped this device

img_57d76ca3c806eAy ay ay Windows! It is so nice but so picky… sometimes it doesn’t let you work with devices that were not with it from the very installation time. I found this Code 43 Error when I decided to add to my original server installation (that I performed myself after a lot of hassle with the fans) three partially new GeForce 1080 Ti. Since the server was not new, neither the cards, I googled quickly the error.

And here is the solution to the issue from drivereasy.com, from where I took the pic also. Basically it involves deinstalling the device and scanning for hardware changes. Unfortunately, the solution was not lasting for a long time, and I was forced to do it again and again, until I found out the source of my problem. That I will share with you. The server originally was not designed to consume so much power, so the issue was that one of the cards was not getting enough energy. Instead of filling up all the PCIe slots, I removed some things…until the system was able to cope with my 3 GPUs. Luckily I had extra PCIe cards in! Ay ay ay…

Dell P620 noisy running W.10

Just notes. I installed W.10 on a P620 from 2013 with 3 GPUs, just to find out the fans were making an unbearable noise under no load, that is, with an indle server. It looks like we could change the fanspeed offset. I tried to do as suggested:

/admin1-> racadm set system.thermalsettings.FanSpeedOffset 0
[Key=system.Embedded.1#ThermalSettings.1]
Object value modified successfully
/admin1-> Connection to XXX closed by remote host.
Connection to XXX closed.

However, the fans were still noisy. I rolled back the ILO, and repeat the procedure, but no luck. To know that I’m not the only one is not making me more happy. There are people who applied the solution given and didn’t manage to reach the desired fan speed…so I’m not very optimistic. There is also no spurious proccess that I can see on the task manager, and the two programs I’ve downloaded to try to control the fans (speedfan and hwinfo) don’t seem to see my fans at all, or don’t let me edit the given values.

I didn’t try this solution, instead, and since the time is gold, I simply hide the server away so that its noise is sheltered by a wall.  Quick and dirty, but that’s me.

A ddrescue on CentOS 7

Sorry no literature yet. I do not find time to write down my dreams, but they are there. I’ve been having headaches trying to recover a dying Windows 7 system with vital hardware running on it. Since I am a Linux person, first I try of course to do dd but I don’t manage even to read the disk. The Windows solution doesn’t seem to work neither: I tried analyzing the disk (Properties->Check) or repair disk sectors with CHKDSK and oddly enough, everything looks fine on the system disk. But I know the disk is damaged. There is a wikipedia entry about damaged disks reparation that I try:

dd if=/dev/old_disk of=/dev/new_disk conv=noerror,sync

The process finishes despite of the I/O errors but the cloned disk is useless, since I ignored the errors on the copy (noerror). They point to ddrescue as a solution, although from the text it looks like a Linux-only tool. Anyway, I want to try it. How do I run that, and how long it takes for a big disk?

 ## > ddrescue -f -n /dev/sdd /dev/sdc /root/rescue.log
GNU ddrescue 1.22
ipos: 1500 GB, non-trimmed: 0 B, current rate: 0 B/s
opos: 1500 GB, non-scraped: 1498 GB, average rate: 164 kB/s
non-tried: 0 B, bad-sector: 2048 B, error rate: 75302 kB/s
rescued: 1922 MB, bad areas: 4, run time: 3h 14m 40s
pct rescued: 0.12%, read errors: 22863560, remaining time: n/a
time since last successful read: 3h 14m 14s
Finished

I run it over a 1.5 TB disk, with the aim to end up with an usable clone. This first step took about 3 hours to be completed. Here is the meaning of all the ddrescue ouput, so you can check how long until it is done. By the way, it seems that there is no easy way to speed up the process. Now we try to copy only the errors with 3 retrials like this:

## > ddrescue -d -f -r3 /dev/sdd /dev/sdc /root/rescue2.log
GNU ddrescue 1.22
ipos: 256570 MB, non-trimmed: 0 B, current rate: 0 B/s
opos: 256570 MB, non-scraped: 1243 GB, average rate: 0 B/s
non-tried: 0 B, bad-sector: 256570 MB, error rate: 310 kB/s
rescued: 0 B, bad areas: 2, run time: 2d 21h 6m
pct rescued: 0.00%, read errors:524007765, remaining time: n/a
time since last successful read: n/a
Scraping failed blocks... (forwards)^C

Unfortunately, after 2 days, the disk copied is still not fully baked, and I give up. So I interrupt the run, and I go smartclt all over it. The output of the clone looks promising.

smartctl -a /dev/sdc
smartctl 5.40 2010-03-16 r3077 [x86_64-unknown-linux-gnu] 
(local build)
Copyright (C) 2002-10 by Bruce Allen, 
http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Model Family:     SAMSUNG SpinPoint F2 EG series
Device Model:     SAMSUNG HD502HI
Serial Number:    S1VZJ9CS712490
Firmware Version: 1AG01118
User Capacity:    500,107,862,016 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 3b
Local Time is:    Wed Feb  9 15:30:42 2011 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

I happily go with my clone to the PC, put it in, and start the computer, with the hope of reaching a happy Windows 7 running system. I’m not lucky this time, but by using a combination of system recovery options over my clone that I’m not sure about it (so I don’t post them) I do end up with something that seems to be stable enough. Be sure that I will edit this post if it’s not the case! And if it’s the case, have a nice day 🙂