VMware tools on Ubuntu 12.04 LTS from Repository


Task for today, equip a couple of dozen VM’s with VMware Tools. I hate manual labor so I hacked up this little script.

Make sure current VMware tools or open-vm tools are uninstalled and purged otherwise this will crap out.

# Fetch the key

apt-get install python-software-properties –yes
wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub
apt-key add VMWARE-PACKAGING-GPG-RSA-KEY.pub
rm VMWARE-PACKAGING-GPG-RSA-KEY.pub

# Add the Repo to APT, and remove sources (we remove all sources, but you can specify to remove only
# VMware sources (since they are not published and will end up in an error)

apt-add-repository ‘deb http://packages.vmware.com/tools/esx/5.0latest/ubuntu precise main’ && wait
# We dont want any sources by default
sed -i ‘s/deb-src/#deb-src/g’ /etc/apt/sources.list

 

# Install the tools

apt-get update &&
# Check Kernel version, we use 12.04 LTS ONLY, esx-nox is NO GFX support, as it should be
apt-get install vmware-tools-esx-kmods-3.2.0-23-generic vmware-tools-esx-nox –yes &&
apt-get upgrade –yes && wait

 

Ce’st ca, all done.

Cisco 7961 headaches


Man, I never liked Cisco stuff, and after today my esteem for the SF router and switch giant has dropped another notch.  Why?. well try to get a Cisco 7961 (or 7960 for that matter) work in Asterisk, then you’ll understand. So to ease the burden of some of you out there that try to do the same, here is the Asterisk  / FreePBX template that finally made it work for me.

We used the freely available SIP41.8-4-3S fimware, just create yourself an account on Cisco support and fetch it, we tried some of the 9 versions without any luck, so stick to the 8 versions i’d say, works just fine.

Also as other blogs outline in great detail, <natEnabled>false</natEnabled> seem to be quite important :),

well good luck…

<?xml version="1.0" ?>
<device>
 <deviceProtocol>SIP</deviceProtocol>
 <sshUserId>root</sshUserId>
 <sshPassword>KHGSHJGD##J</sshPassword>
 <devicePool>
 <dateTimeSetting>
 <dateTemplate>{$date_template}</dateTemplate>
 <timeZone>China Standard/Daylight Time</timeZone>
 <ntps>
 <ntp>
 <name>192.168.1.10</name>
 <ntpMode>Unicast</ntpMode>
 </ntp>
 </ntps>
 </dateTimeSetting>
 <callManagerGroup>
 <members>
 <member priority="0">
 <callManager>
 <processNodeName>{$server.ip.1}</processNodeName>
 <ports>
 <sipPort>5060</sipPort>
 </ports>
 </callManager>
 </member>
 </members>
 </callManagerGroup>
 </devicePool>
 <sipProfile>
 <natEnabled>false</natEnabled>
 <natAddress></natAddress>
 <sipProxies>
 <registerWithProxy>true</registerWithProxy>
 <outboundProxy>{$outbound_host.line.1}</outboundProxy>
 <outboundProxyPort>{$outbound_port.line.1}</outboundProxyPort>
 <backupProxy>{$server_host.line.1}</backupProxy>
 <backupProxyPort>{$server_port.line.1}</backupProxyPort>
 </sipProxies>
 <preferredCodec>{$preferredcodec}</preferredCodec>
 <phoneLabel>{$displayname.line.1}</phoneLabel>
 <stutterMsgWaiting>1</stutterMsgWaiting>
 <callStats>true</callStats>
 <silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
 <disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>
 <startMediaPort>16384</startMediaPort>
 <stopMediaPort>32766</stopMediaPort>
 <sipLines>
{line_loop}
 <line button="{$line}">
 <featureID>9</featureID>
 <featureLabel>{$username}</featureLabel>
 <proxy>{$server_host}</proxy>
 <port>{$server_port}</port>
 <name>{$username}</name>
 <authName>{$username}</authName>
 <authPassword>{$secret}</authPassword>
 <messageWaitingLampPolicy>3</messageWaitingLampPolicy>
 <messagesNumber>{$voicemail_extension}</messagesNumber>
 <forwardCallInfoDisplay>
 <callerName>true</callerName>
 <callerNumber>true</callerNumber>
 <redirectedNumber>false</redirectedNumber>
 <dialedNumber>true</dialedNumber>
 </forwardCallInfoDisplay>
 </line>
{/line_loop}
 </sipLines>
 <dialTemplate>dialplan.xml</dialTemplate>
 </sipProfile>
 {$image_name}
 {$tonescheme}
 <vendorConfig>
 <disableSpeaker>false</disableSpeaker>
 <disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
 <pcPort>1</pcPort>
 <settingsAccess>1</settingsAccess>
 <garp>0</garp>
 <voiceVlanAccess>0</voiceVlanAccess>
 <videoCapability>0</videoCapability>
 <autoSelectLineEnable>0</autoSelectLineEnable>
 <webAccess>0</webAccess>
 <spanToPCPort>1</spanToPCPort>
 <loggingDisplay>1</loggingDisplay>
 <loadServer></loadServer>
 </vendorConfig>
</device>

Cacti script to get temperatures from an ILO device.


We wanted to experiment with different airflow scenarios in our DC and did not want to get in to expensive data center power management tools, so we decided to use a simple cacti server and the ILO temperature measurements from servers in certain spots in the racks to get a historic graph of inflow air temperatures, you get the idea.

But man!, Cacti can be a pain in the butt!, and so can be the HP/ILO SNMP implementation. As you might have noticed the SNMP/OID does not push out measured temperature sensors, sigh.. To get around this hurdle we had to hack up a quick script, and since it took me quite some time to google all components together i’d thought why not put them here for others to enjoy, saving the world some time here.

Our setup, a simple vanilla Ubuntu 12.04 LTS VM,  with Cacti from the Ubuntu Repo (0.8.7i), I assume I don’t need to explain how to set this up. So to get stuff working, first we get the HP Lights-Out XML PERL Scripting Sample (I fetched this one) for Linux, untar and install.

Copy out the files Get_EmHealth.xml and locfg.pl to the /usr/share/cacti/site/scripts folder, chown them to root (as Cacti runs its scripts as root)

Add your ILO credentials to the EmHealth.xml, I could go as far as parameterizing them for Cacti to provide, but since we use the same across all ILO’s in a separate management network, i did not bother

<RIBCL VERSION=”2.21″>
<LOGIN USER_LOGIN=”your user name” PASSWORD=”your password“>
<SERVER_INFO MODE=”read”>
<GET_EMBEDDED_HEALTH />
</SERVER_INFO>
</LOGIN>
</RIBCL>

Next, I created this little PERL script

$command = “/usr/bin/perl -X /usr/share/cacti/site/scripts/locfg.pl -s $ARGV[0] -f /usr/share/cacti/site/scripts/Get_EmHealth.xml”;

#$command = “/usr/bin/perl -X /usr/share/cacti/site/scripts/locfg.pl -s 192.168.3.104 -f /usr/share/cacti/site/scripts/Get_EmHealth.xml”;

$output = `$command`;

@lines = split(/\n/,$output);

foreach $line(@lines){
if (index ($line ,”LOCATION VALUE”) != -1) {
$line =~ s/\s+/_/g;
if ($line =~ /”(.+?)”/) { print”$1:”;}}
if (index ($line ,”CURRENTREADING VALUE”) != -1) {
if ($line =~ /”(.+?)”/) { print”$1 “;}}
}

What this basically does is parse the XML (ish) output from locfg.pl, find the Location Value and CurrentReading Value (which are sensors and values) and write them out as a valid Cacti script return string for by DL385g5 this is:

CPU:62 CPU_1:50 CPU_2:44 Memory_a:57 Memory_b:46 System:62 Ambient:21

As you can see I also trip out all spaces and replace them by underscores to keep the output valid for Cacti. So now we can run this script in a Cacti Data Input Method, see this link on how to do that, and as long as we provide the EXACT output fields, we will get values back to push in to RDD. I am only interested in the Ambient sensors, but maybe you like to graph more..

Hope this helps someone save some time

 

Cheers

 

-Fault