Posts

Comware shortcuts

interface GigabitEthernet 1/0/1 => interface g1/0/1 interface Ten-GigabitEthernet 1/0/25 => interface te1/0/25 Hotkeys: <comware-switch>display hotkey ----------------- HOTKEY -----------------             =Defined hotkeys= Hotkeys Command CTRL_G  display current-configuration CTRL_L  display ip routing-table CTRL_O  undo debugging all            =Undefined hotkeys= Hotkeys Command CTRL_T  NULL CTRL_U  NULL             =System hotkeys= Hotkeys Function CTRL_A  Move the cursor to the beginning of the current line. CTRL_B  Move the cursor one character left. CTRL_C  Stop current command function. CTRL_D  Erase current character. CTRL_E  Move the cursor to the end of the current line. CTRL_F  Move the cursor one character right. CTRL_H  Erase the characte...

VIM substitutions

Substitution of a text by another text within a single line (replace I by We): :s/I/We/g Case-insensitive: :s/I/We/gi Substitute helo for hello in the next 4 lines: :s/helo/hello/g 4

VMWare vSphere 6.0 web client via SSH tunnel

Hi, I just found a way to connect to a remote vCenter server via SSH tunnel, using the web client.  This has been tested on vSphere 6.0, it may need some modifications to work on other version. Let's define some information for this example: 192.168.x.x will be the IP address of the vSphere web client (vCenter) x.x.x.x will be the IP address of the SSH server localuser is the name of the user on the local machine (from which you execute the SSH command) remoteuser is the name of the username on the (remote) SSH server 5252 is the port on which the (remote) SSH server is listening The first thing to do is to execute this shell command to open an SSH connection and create tunnels: sudo ssh -i /home/localuser/.ssh/id_rsa -l remoteuser1 -L 443:192.168.x.x:443 -L 902:192.168.x.x:902 -L 903:192.168.x.x:903 -L 9443:192.168.x.x:9443 -p 5252 x.x.x.x Please not that we must use sudo because we're using ports =< 1024. Also note the -i , specifying  the path to my pr...

Dealing with an old Rancid installation

Your new device is not supported by your current rancid install?  There is usually a solution. Get the *rancid.in and *login.in files from the github repo (https://github.com/earendilfr/rancid/tree/master/bin) Put them in the bin directory of your rancid install, rename them to remove the .in at the end chown rancid.rancid and chmod +x to these files Make sure you make the mapping in bin/rancid-fe so that the vendor is known and rancid knows which rancid script use for this vendor Edit the *rancid file to set the perl path at the top Edit the *login file to set the expect path at the top Configure your .clogin for your device Add your device to router.db Test with rancid-run -r Check the logs

General linux performance troubleshooting

Here's a list of commands that you should execute and then share the output to someone who can help you figure out what resource is the bottleneck in your system. Note, it requires the  sysstat  and  procps  packages (ubuntu and RHEL and its derivatives): uptime vmstat 1 10 iostat -xN 2 10 mpstat -P ALL 3 10 pidstat 1 10 free -mw (or free -m, if your OS doesn't support -w)  uptime is to see the load averages on the system. vmstat is mostly used to tell if the system is swapping or not. If you see significant numbers in the 'si' and 'so' columns, your system is most likely swapping (using the hard drive as RAM), which usually slows performance a lot. iostat is mostly used to determine if your disk subsystem is not able to cope with the load. If you see one or more lines that shows 100 or close almost constantly, it is probably the case.  If it is your swap volume, you probably saw numbers in the 'si' and 'so' columns in the  vmsta...

General Linux performance troubleshooting

Here's a list of commands that you should execute and then share the output to someone who can help you figure out what resource is the bottleneck in your system. Note, it requires the sysstat and  procps packages (ubuntu and RHEL and its derivatives): vmstat 1 10 iostat -xN 2 10 mpstat -P ALL 3 10 The first one is mostly used to tell if the system is swapping or not. If you see numbers in the 'si' and 'so' columns, your system is most likely swapping (using the hard drive as RAM), which usually slows performance a lot. The second one is mostly used to determine if your disk subsystem is not able to cope with the load. If you see one or more lines that shows 100 or close almost constantly, it is probably the case.  If it is your swap volume, you probably saw numbers in the 'si' and 'so' columns in the  vmstat  output. The third one shows the % of the CPU time used by different functions of the server. I'll explain the most used one...

ksar2!

After publishing my last post, I found out that many forks of kSar have been created. I didn't spend too much time comparing them, but ksar2  looks promising. Have fun!

Using kSar with Red Hat Enterprise (or CentOS) 7

Hi, I really like using kSar for troubleshooting on Linux, but it doesn't work out-of-the-box with version 7 of Red Hat Enterprise Linux or its derivatives (CentOS, Scientific Linux, etc.).  It just doesn't work with the standard " sar -a " command, so one of my colleague had a bit of free time and found the combination of arguments that makes it work. It looks like there is one of the options that are included in -a was not included in previous versions, and kSar cannot process the additional output. Here's the command line that works: sar -bBdqrRSuvwWyp -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL The 'p' is, however, optional. I add it to have pretty names for disks instead of dev2-0, dev253, etc. On a side note, if you want to have better results, change the frequency at which the sar cronjob runs (in /etc/cron.d/sysstat , change the '*/10' by just '*'). Also, if you want to see 'waiting for I/O' data with RHEL 7, go in...

Another interesting package - ps_mem

I find it hard to see what's using the RAM in a server and ps_mem can help.  It lets you know the memory usage of applications. I haven't found how to install it on Ubuntu, but on Red Hat and derivatives, it's available in the EPEL repo.  You can use it by simply executing the ps_mem command, which gives this kind of output: [root@vps1 ~]# ps_mem  Private  +   Shared  =  RAM used       Program   8.0 KiB +  24.0 KiB =  32.0 KiB       agetty (2)   4.0 KiB +  30.0 KiB =  34.0 KiB       xinetd   4.0 KiB +  49.5 KiB =  53.5 KiB       lvmetad   0.0 KiB +  73.5 KiB =  73.5 KiB       saslauthd (2)   8.0 KiB +  89.0 KiB =  97.0 KiB       pmdadm  16.0 KiB + 142.5 KiB = 158.5 KiB       systemd-udevd 128.0 KiB +  90.0 KiB =...

ncdu (NCurses Disk Usage)

Image
I discovered an utility a few weeks ago and I thought it would be worth sharing. This utility is especially useful when you are looking for files that take a lot of disk space on your system.  As an example, I received a Nagios notification saying that /var had less than 15% free.  I logged on the system to see what is taking too much space. In the past, I would have use the du command (du -hs /var/*, then du -hs /var/log/* and so on), but I used ncdu.  I cd'd into /var, then ran 'ncdu'. Here are screen shots of an example (different of what happened yesterday): This is what we see when we start ncdu in /var: We can use the arrows up and down to select a folder and use the left and right arrows to go up/down the tree. In this case, I simply used the right-hand side arrow a few times until I got to the folder that contains the most data: That's already great, but that's before digging into the help (using ?).  The options are (version 1.13): Sortin...

Subversion + HTTP with AD authentication, local authorization, on RHEL7

I wanted our users to be able to user their AD credentials for SVN access. I first thought about putting everything in AD, including two groups for each repo (one read, one write), but I ended up only using AD for authentication, leaving the permissions to a local file since there is only one SVN server. That is how the apache conf file looks like: <VirtualHost *:443>   ServerName servername.domain   ## Vhost docroot   DocumentRoot "/var/www/html"   ## Directories, there should at least be a declaration for /var/www/html   <Location "/repos">     Require valid-user     Require ldap-user     Dav svn     AuthType Basic     AuthName "Use your Windows Credentials"     AuthBasicProvider file ldap     AuthUserFile /etc/httpd/conf/auth-conf-svn     AuthLDAPURL "ldap://DC1/dc=example,dc=domain?sAMAccountName?sub?(objectClass=*)"     AuthLDAPBindDN "...

How to download EPEL packages that are retired

I always enable the EPEL (Extra Packages for Enterprise Linux)   yum repository on my Red Hat (and similar) systems. However, some of the EPEL packages that I use freqently have been recently orphaned, then retired as per EPEL's policy . I found a way to download them manually.  Of course they're not updated but for these packages, I don't mind.  One example is nmon.  I'll show you how to manually download nmon even though it's retired. You have two options. The first one is to go there: http://buildlogs.cdn.centos.org/c7-epel.a64/ (for RHEL7-x64). The second is: First go to this  URL . At the top, enter "nmon" in the search box, then press Enter. Search for the version you want.  In my case, it is the EL6 version, so I clicked on it, and it sent me to this  URL On that page, there are download links for the source RPM and all the different arch.  In my case, the arch is x86_64, so I just had to click on the  download link ....

Using Helium to copy data to another phone

Note; if you're using a Lollipop phone, look at the "Tap & Go" feature. One very nice feature of the BlackBerry smartphones were the ability to perform a "real" full backup of your phone.  This way, you can either reset to factory settings or change phone without losing a single bit of data.  Now that we're using Android phones at work, I had to find an alternative and of course, it would not have to require the phones to be rooted. I decided to try Helium (https://play.google.com/store/apps/details?id=com.koushikdutta.backup&hl=en) and it did a good job.  However, I haven't found a good tutorial on how to use the free version.  I don't mind spending 5$ for a great application, but I thought I'd try the free version first.  The local backups were quite easy to do, but since my goal was to transfer the data to another phone, it was getting quite complex.  You cannot use cloud-based storage for your backups with the free version and you...

KeePass enforced configuration

I don't know why but despite all of my searches, I haven't been able to find a good tutorial on how to deploy KeePass with an enforced configuration (set parameters that users cannot change). First, deployment: You can deploy the .msi and the related files using GPO, for example. But there is an easier way: simply copy the KeePass folder that contains the .exe to a network share.  Make sure only admins (only admin accounts, not your regular account). have write access to this share, all other users read-only. To do that you can install KeePass on your computer temporarily an copy the folder that is in the Program Files folder. Second, configuration enforcement: execute the local version of KeePass that you installed for step one.  Set the parameters as you would like them, then close KeePass.  A configuration file will be created in C:\Users\$username\AppData\Roaming\KeePass\KeePass.config.xml.  You can create a copy of this file that you will name KeeP...

PC Engines APU plan

I recently decided to upgrade my home firewall ( pfSense on a PC Engines WRAP) by something more recent.  The new APU system from PC Engines looked quite good so I ordered one unit of the 4-gig model.  When I received it, I tried a few things with it but lacked time.  The next time I worked on it, it was dead.  I create an RMA, returned the unit, and got a working one about 3 weeks later.  My original plan was just to upgrade pfSense and run it on more recent hardware.  My WRAP was kind of slow in the WebGUI (not that bad, I don't edit the configuration every day) and I don't think it could do a good job for an OpenVPN setup.  I looked around and also found other options for small factor computers but I decided to go with the APU when I saw that its processor had virtualization extensions.  I thought that I could try running another system, side-by-side with the firewall, allowing me to have a server that would always be on (I currently run cac...

Expect ugly output

Trying to install Talend using the installer and got this error: (main.tcl:32009): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='latin' Funny...

HP releases latest Service Pack for Proliant (SPP) 2014.09

HP has released its latest Service Pack for Proliant,  the integrated firmware and software bundle which it will support for the next year. New stuff: Support for (at least some) Gen9 servers Support for new Proliant options Includes VMware driver support Support for RHEL7 http://h17007.www1.hp.com/us/en/enterprise/servers/products/service_pack/spp/index.aspx

New puppet book that I recently reviewed

Hi, If you're looking for a book about puppet reporting and monitoring, you should have a look at this one:  http://bit.ly/1qbSxKC

How to convert a file to a pbx-friendly format (8kHz, mono, PCM ulaw) with Audacity

In Audacity Edit – preferences – import/export – When exporting tracks to an audio file – use custom mix (done once) Open source file (mp3 or flac) Select Project Rate (bottom left) → 8000 File, export First time only: Select “Other uncompressed files” Click on “Options…” Choose Header → WAV (Microsoft), Encoding → U-Law On the Advanced Mixing Options, select 1 channel and add the unmapped channel to Channel 1 by clicking on the unmapped channel (it will get red borders) and then click on Channel: 1. Click OK Click OK at the “Edit Metadata” window Right-click on the output file, properties, summary, Advanced, make sure that: Channels = 1 (mono) Sample rate = 8kHz Format = CCITT u-Law

New Puppet Book

This is a book that was released a couple of weeks ago.  You can find my name in the list of technical reviewers  Puppet Beginner's Guide .