Why yes, it probably is: “Single Pain of Glass”

Today via the dubious but ever-eager TechTarget.com vendor information dissemination engine, I received notice of the immediate availablility of an important “white paper”/marketing position statement:

Selection001a9414a9414a9414

How to gain a single-pain-of-glass view into your systems operations

 

 

 

 

 

 

 

 

Sounds unpleasant!  At least the headline writer slices right to the heart of the matter, etc., etc..

Cisco IOS regex behavior — the misunderstood underscore?

Many demonstrations of Cisco IOS regular expression use over-simplify or misstate the actual use and definition of the underscore wildcard _.  This may lead to unexpected behavior in some situations.

In practice, the underscore can often work in an expression as a stand in for “match spaces”, which is typically how it is used in Cisco regular expression examples.   In reality, it can match many other other characters and symbol representations than a space.

Here’s what the documentation says about the underscore:

Matches a comma (,), left brace ({), right brace (}), left parenthesis ( ( ), right parenthesis ( ) ), the beginning of the string, the end of the string, or a space.

(This is from http://www.cisco.com/c/en/us/td/docs/ios-xml/ios/fundamentals/configuration/15_sy/fundamentals-15-sy-book/cf-cli-search.html, but there are numerous Cisco documents with the definition.)

It may be worth testing on multiple Cisco OS platforms and versions, but my use so far been consistent with the documentation.

In IOS, a space inside parentheses with match a space, and in NX-OS, a space inside of a quotation mark will match a space.  IOS behavior with the grouping or delimiting characters (parens) will still work, but spaces represented between words will be the reliable matching construct that can be relied upon on.   NX-OS requires the use of quotation marks to treat multiple words as a group.

Server set-up: Fixing locale and unknown key issues on VPS / Ubuntu “cloud” images

Here are a couple of problems I’ve seen with newly created instances of virtual servers, and their solutions.

locale:

When running apt-get upgrade for the first time, many errors appeared regarding an “unset” locale.

My locale is US/English, so the fix was:

sudo locale-gen en_US en_US.UTF-8
dpkg-reconfigure locales

missing keys:

Errors regarding unknown or missing keys.

[MISSINGKEY] is the string in the error message.

apt-key adv --recv-key --keyserver keyserver.ubuntu.com [MISSINGKEY]

Trailing slash or no trailing slash with an rsync path argument?

Nicely illustrative explanation of trailing slash behavior in rsync:
devblog.virtage.com/…/to-trailing-slash-or-not-to-trailing-slash-to-rsync-path/

Essentially:

  • An rsync source path with no trailing slash will recreate the top-level directory of the source at the destination.
  • With a trailing slash the subdirectories of the source path are created directly in the target directory.

comparing rancid files on two different servers

Usually, I just use rsync to keep files in sync, but this runs through all of the files.

Starting on server #1, inside the rancid base directory (/var/lib/rancid for me),
with $LIST_OF_GROUPS from /etc/rancid/rancid.conf,
using ssh with port 2022 ,
$REMOTE = DNS name of remote server :

for i in $LIST_OF_GROUPS ; do echo $i ; rsync -n -i -e 'ssh -p 2022' /var/lib/rancid/$i/router.db $REMOTE:/var/lib/rancid/$i/router.db ; done

To run vimdiff to see or manually sync a single file:

vimdiff /var/lib/rancid/ABC/router.db scp://$REMOTE_SRV:2022//var/lib/rancid/ABC/router.db

Note that this uses 2022 as an alternate ssh port for scp (as called by vimdiff).

The automated sync operation is actually done from jenkins. This is probably not the ideal formula, but for self-documnetation purposes, here it is:

crontab on server1 to remote server2. (REMOTE_SRV = server2’s DNS name)
to copy files from server1 to remote server2.

@daily export JENKINS_HOME=http://JENKINS.brunhilda.edu:8080 ; java -jar /usr/share/jenkins/external-job-monitor/java/jenkins-core-*.jar "rancid_sync srv1 to srv2" rsync --exclude 'configs' --exclude 'bin' --exclude 'logs' --exclude 'CVS' --compress --itemize-changes -Cavh -e 'ssh -p 2022' --checksum $REMOTE_SRV:/var/lib/rancid/ /var/lib/rancid/

vim syntax highlighting, line numbers

vim syntax highlighting

:set filetype=html

or

:setf python

or

:set syntax=python

:show line

:set number

:set nonumber

” `:set list` will show all whitespaces as a character. Everything but a space will look different than its normal state, which means that if you still see a plain old space, it’s really a plain old space”

Ether@http://stackoverflow.com/questions/1675688/make-vim-show-all-white-spaces-as-a-character

Working with dates and timestamps in GNU Linux

With the GNU date command line utility.

Print time as seconds from the epoch, or, “seconds since 1970-01-01 00:00:00 UTC” :

$ date +%s
1365439166

Convert timestamp or epoch dates into familiar day and time :

$ date --date='@1365439166'
Mon Apr 8 11:39:26 CDT 2013

Usage from GNU coreutils 8.x, and may work elsewhere.

sort files by size

du -sh * | sort -h

Output should be sorted like this (K, M, G for Kilobytes, Megabytes, Gigabytes):

8.0K totem.txt
8.0K em.vlan.txt
20K dot.png
68K pid5367.log
104K dmesg.txt
384K hwinfo.txt
1.2M textarchive.tar.gz
2.9M Archive
78M minicom.cap
226M vorbis
688M 09283.ar
1.2G VirtualBox VMs
2.5G Downloads

du and sort from GNU coreutils 8.23   

streaming tar

Because I always forget the syntax:

tar cvf - tftpboot/ | ssh userone@10.11.12.13 "cd /home/userone/store_old/ ; tar xvpf - "

There are many variations, and this one includes the verbose flag. (-v)

system uptime

Juniper/JunOS M-series:

rem10> show system uptime
Current time: 2013-02-13 13:40:10 CST
System booted: 2013-02-13 03:07:33 CST (10:32:37 ago)
Protocols started: 2013-02-13 03:09:23 CST (10:30:47 ago)
Last configured: 2013-02-13 03:21:06 CST (10:19:04 ago) by nim42
1:40PM up 10:33, 1 user, load averages: 0.00, 0.02, 0.00

Next Page »