Extend snmpd to add detailed CPU statistics, per cpu

I needed to export detailed CPU statistics from Linux servers using SNMP. While UCD-SNMP-MIB export some detailed stats, it only does it for the whole system. I may have missed something easier though :-) So here is a BASH script, put it in /etc/snmp/percpustats: #!/bin/bash /bin/grep "^$1 " /proc/stat | sed -e 's/^cpu[0-9]* *//' | tr ' ' '\n' Make it executable: chmod +x /etc/snmp/percpustats This simple script takes a single argument, which is the cpu id you want to look at....

April 13, 2017

Unetlab: create a QEMU image

So you have your Unified Networking Lab (UNL) server running and you want to use arbitrary QEMU images with it. Here is how to create one. All UNL data is stored under /opt/unetlab , images are stored under /opt/unetlab/addons and QEMU images are a folder deeper under /opt/unetlab/addons/qemu . UNL expects to find images within directories named according to some scheme. The directory names must start with some keywords followed by anything you want....

March 18, 2016

Microsoft Windows 7 PPTP issues: spurious ICMP protocol-unreachable sent

I was recently confronted to a strange issue with a PPTP VPN connection to a central site. Some users could connect and some others could not. They all used Windows 7 with SP1, configured the same way, and all computers were behind NAT/PAT routers but not necessarily on the same site. On the VPN server, the only information I could get was this log stating the GRE protocol was unreachable:...

February 23, 2016

Ubuntu 14.04 and USB to Serial ch341 (chinese device from Ebay)

You can find pretty cheap USB to Serial devices on Ebay. I bought one and received a device using a chip ch341. Unfortunately, the drive is bugged in Ubuntu 12.04 and 14.04. Fortunately, there is patch to fix it. Here is how to recompile the module to enjoy these devices. $ sudo apt-get source linux-source-3.13.0 linux-headers-$(uname -r) $ cd /tmp $ tar -xjf /usr/src/linux-source-3.13.0.tar.bz2 $ cd linux-source-3.13.0/ $ make oldconfig $ make prepare $ make scripts $ cp -v /usr/src/linux-headers-$(uname -r)/Module....

December 31, 2015

Update GNS3 server on GNS3 IOU VM

GNS3 Sourceforge account provides an OVA image ready to run gns3-server for those who want to use Cisco IOS on Unix images . However, at the time of this writing, the gns3-server version is outdated (1.3.3). The client must have the same version as the server to be able to connect to it. Here is how you can update the gns3-server inside the image. Note that you need Internet access for the update....

September 29, 2015

Migrate Debian 6+ to another server with minimal downtime

Recently I had to migrate services from a running Debian server to another one, with minimal downtime of services. I usually do this to P2V or V2V Linux systems, as this allows me to resize the new virtual machine to meet the services requirements (adjust disk size, inodes, partitionning, etc.). I have done this several times in the past on systems with Grub 1 but this is the first time with Grub 2, so I thought I’d share my process....

March 13, 2015

SNOM phones and presence monitoring

If you have issues with your SNOM phones and presence monitoring (the little LEDs that display when another extension is ringing or busy), then maybe this will help. We had this problem at work. When we checked the SIP traces, we could see our server was sending SIP NOTIFY packets to tell the phone “hey your collegue phone is ringing!”, but the phone: (very old firmware) either answered with a 200 OK but did not blink the LED; (latest firmware) or it answered a 481 Call/Transaction Does Not Exist and still did not blink the LED....

January 31, 2015

Nagios and LSI RAID cards

To monitor the status of a LSI RAID card, say for example a Dell PERC card, you will need to install NRPE, sudo, mpt-status and check_mpt.sh . Install sudo and NRPE via your package manager. You can grab mpt-status via apt if you use Debian/Ubuntu or here if you use CentOS. You can grab check_mpt.sh here. First, load the module mptctl if it’s not done already: modprobe mptctl To have the module loaded at boot, you can use your distribution specific behavior....

January 27, 2015

VMware and Windows poor TCP performance

I have had a strange issue lately with Windows servers on VMware vSphere 5.1 hosts. Throughput of TCP connections between some virtual machines were very very slow, barely 10 mbit/s . The behavior was easily reproducible : just start an iperf connection between a Windows Server 2008 and a Windows 2012 server, and you get 10 mbit/s . Moving both virtual machines on the same ESXi host, or on different hosts, did not change anything....

October 23, 2014

Using Windows domain resources while VPN is active with different credentials

If you are frustrated to get your Domain account locked while you are logged on a VPN with different credentials than your Domain credentials, then this is for you. Edit the file %userprofile%\AppData\Roaming\Microsoft\Network\Connections\Pbk\rasphone.pbk with your favorite text editor. All the VPN connections managed by Windows are defined in that file. Search the string UseRasCredentials=1 and replace it with UseRasCredentials=0 for each VPN connection that gets you locked out (or just replace all of them if you are lazy)....

October 23, 2014