Monday, January 27, 2014

oh pesky x500 addresses

what do all those +XX mean?

_ = /
+28 = (
+29 = )
+2E = .
+20 = 
+40 = @
+2C = ,
+5F = _

oh wait.  those are ascii character codes.  in hex.
why?

OU=EXCHANGE+20ADMINISTRATIVE+20GROUP+20+28FYDIBOHF23SPDLT+29_CN=RECIPIENTS_CN=Him+40there+2Ecom36b@myplaceofwork.com
#550 5.1.1 RESOLVER.ADR.ExRecipNotFound; not found ##

that translates to:
Him@there.com36b@myplaceofwork.com

36b.  what is that?

who cares.

Wednesday, January 22, 2014

quick fast get curl for old sol

sol8

vi getus.sh ; chmod +x getus.sh ; ./getus.sh ; rm getus.sh ; curl

#!/bin/sh
wget http://localmirror/sunfreeware/sparc/8/curl-7.20.0-sol8-sparc-local.gz
wget http://localmirror/sunfreeware/sparc/8/libidn-1.22-sol8-sparc-local.gz
wget http://localmirror/sunfreeware/sparc/8/libssh2-1.3.0-sol8-sparc-local.gz
wget http://localmirror/sunfreeware/sparc/8/openssl-1.0.0e-sol8-sparc-local.gz
gunzip *.gz
for i in *local ; do pkgadd -d $i ; done
rm *local


sol9

vi getus.sh ; chmod +x getus.sh ; ./getus.sh ; rm getus.sh ; curl

#!/bin/sh
wget http://localmirror/sunfreeware/sparc/9/curl-7.23.1-sol9-sparc-local.gz
wget http://localmirror/sunfreeware/sparc/9/libidn-1.22-sol9-sparc-local.gz
wget http://localmirror/sunfreeware/sparc/9/libssh2-1.3.0-sol9-sparc-local.gz 
wget http://localmirror/sunfreeware/sparc/9/openssl-1.0.0e-sol9-sparc-local.gz
gunzip *.gz
for i in *local ; do pkgadd -d $i ; done
rm *local

sol10

vi getus.sh ; chmod +x getus.sh ; ./getus.sh ; rm getus.sh ; curl

#!/bin/sh
wget http://localmirror/sunfreeware/sparc/10/curl-7.20.0-sol10-sparc-local.gz
wget http://localmirror/sunfreeware/sparc/10/libidn-1.24-sol10-sparc-local.gz
wget http://localmirror/sunfreeware/sparc/10/libssh2-1.4.0-sol10-sparc-local.gz
wget http://localmirror/sunfreeware/sparc/10/openssl-1.0.0g-sol10-sparc-local.gz
gunzip *.gz
for i in *local ; do pkgadd -d $i ; done
rm *local

pesky multiple eth addresses in suse 10 with same mac

pesky multiple eth addresses in SuSE 10 with same MAC.

Navigate to the hotplug file in the /etc/sysconfig directory:

# cd /etc/sysconfig
Open the hotplug file in an editor.

Set HOTPLUG_PCI_QUEUE_NIC_EVENTS to yes:

HOTPLUG_PCI_QUEUE_NIC_EVENTS=yes
Run the command:

ifconfig -a
Make sure that the interface name to MAC address mapping remains same across the reboots.

For each ethernet interface displayed, do the following:
If a file named /etc/sysconfig/network/ifcfg-eth-id-mac, where mac is the hardware address of that interface, does not exist, then do the following:

Create the file.

If a file exists for the same network interface with the name /etc/sysconfig/network/ifcfg-ethX, then copy the contents of that file into the newly created file. The variable ethX represents the interface name.

Add the following line at the end of the file /etc/sysconfig/network/ifcfg-eth-id-mac.

PERSISTENT_NAME=ethX
where ethX is the interface name.

For example:

# ifconfig -a
eth0    Link encap:Ethernet  HWaddr 00:02:B3:DB:38:FE
        inet addr:10.212.99.30  Bcast:10.212.99.255
        Mask:255.255.254.0 
        inet6 addr: fe80::202:b3ff:fedb:38fe/64 Scope:Link
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:453500 errors:0 dropped:0 overruns:0 frame:0
        TX packets:8131 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:35401016 (33.7 Mb)  TX bytes:999899 (976.4 Kb)
        Base address:0xdce0 Memory:fcf20000-fcf40000

If a file named etc/sysconfig/network/ifcfg-eth-id-00:02:B3:DB:38:FE does not exist, do the following task:
Create the file.

If the file /etc/sysconfig/network/ifcfg-eth0 exists, then copy the contents of this file into etc/sysconfig/network/ifcfg-eth-id-00:02:B3:DB:38:FE.

Add the following to the end of the file named etc/sysconfig/network/ifcfg-eth-id-00:02:B3:DB:38:FE,

PERSISTENT_NAME=eth0

Perform the procedure for all the interfaces that the ifconfig -a command displays that you need across boots.

To configure interfaces to be up before starting LLT

# ifconfig eth0
eth0    Link encap:Ethernet  HWaddr 00:02:B3:DB:38:FE
Where eth0 is the sample network interface name. The output displays 00:02:B3:DB:38:FE as the interface's MAC address.

Navigate to the config file in the /etc/sysconfig/network directory:

# cd /etc/sysconfig/network
Open the config file in an editor.

Append the string eth-id-macaddress to the MANDATORY_DEVICES list in the config file. Separate each address with a space, for example:

MANDATORY_DEVICES="eth-id-00:02:B3:DB:38:FE"

Next, edit /etc/udev/rules.d/70-persistent-net.rules

Add the following:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:02:B3:DB:38:FE", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Finally, edit /etc/udev/30-net_persistent_names.rules and have the SYSFS address match the interface MAC.  Remove lines of interfaces that do not exist.
SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:02:B3:DB:38:FE", IMPORT="/lib/udev/rename_netiface %k eth0"

Reboot!

Friday, January 10, 2014

sudo no tty present and no askpass program specified ubuntu 10

i'm learning new things every day.

trying to do a little ssh bash -c action, i get this error:

sudo no tty present and no askpass program specified

at the top of the system's /etc/sudoers file, add the following:

Defaults visiblepw

cpan force

perl -MCPAN -e "CPAN::Shell->force(qw(install A::Broken::Something));"

ubuntu 10 & 14 & piping data to netcat

So, I decided to update a nice old system that does temperature graphing for us.
The first issue was the lack of various pms that the perl scripts required.
Once that was tackled, I found that the local device graph function was working.  But, my netcat grabs were not .  
So, yes, I could echo and printf my life away and get my values, but in a script, this:

my $values = `echo "GET /temp HTTP/1.0\n\n" |nc my.temp.sys 80 `;

Did not work.  Not at all.

So, I thought and thought and did a little digging, and sure enough there’s a registered bug with nc when one wants to pipe data to it.  
To get those values, here’s what the line’s to look like:

my $values = `echo "GET /temp HTTP/1.0\n\n" |nc my.temp.sys 80 -q -1`;

So, if you’re using newish ubuntus, 10+, now you know.

Monday, January 6, 2014

Annoy your cellphone carrying friends

carrier
sms-to-email address
T-Mobile
tendigitnumber@tmomail.net
Virgin Mobile
tendigitnumber@vmobl.com
ATT
tendigitnumber@txt.att.ne
tendigitnumber@mms.att.net
Sprint
tendigitnumber@messaging.sprintpcs.com
Verizon
tendigitnumber@vtext.com
Nextel
tendigitnumber@messaging.nextel.com

Friday, January 3, 2014

adding a data input to an rrd

sigh.

i need to add an additional data source to my rrd file.  in my specific case, 
a new temperature probe; probe 7.

i also managed to forget the specifics of the rrd.  that's okay.

# rrdtool info /var/stats/rrd/envmon/temp.rrd

filename = "temp.rrd"
rrd_version = "0003"
step = 60
last_update = 1388770922
ds[probe1].type = "GAUGE"
ds[probe1].minimal_heartbeat = 300
ds[probe1].min = 5.5000000000e+01
ds[probe1].max = 9.5000000000e+01

cool.  we have the step and type and heartbeat and min and max.

# cpan install RRD::Simple

script...

#!/usr/local/bin/perl 

use strict; 
use RRD::Simple (); 

my $rrd = RRD::Simple->new(); 
my $rrdfile=$ARGV[0]; 
my $source=$ARGV[1]; 
my $type=$ARGV[2]; 
chomp($type); 
$rrd->add_source($rrdfile, $source => $type); 

... script

usage: ./addSource.pl file.rrd ds GAUGE

e.g.:
# ./addSource.pl /var/stats/rrd/envmon/temp.rrd probe7 GAUGE:300:55:95
that wasn't so hard.