linux

Puppet: Icinga SSH client module

Enable Pluginsync on client
sed -i '/\[main\]/a\pluginsync=true\' /etc/puppet/puppet.conf

create Nullmailer module
http://www.panticz.de/Puppet-Nullmailer-module

create module structure
mkdir -p /etc/puppet/modules/icinga_ssh_client/manifests
mkdir -p /etc/puppet/modules/icinga_ssh_client/files

download module definiction
<?php
$URL="https://raw.githubusercontent.com/panticz/puppet/master/modules/icinga_ssh_client/init.pp";
echo "wget -q $URL -O /etc/puppet/modules/icinga_ssh_client/manifests/init.pp";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

add include to your client in /etc/puppet/manifests/site.pp
node "client1.local" inherits default {
...
include icinga_ssh_client
include nullmailer
...
}

Example: /etc/puppet/modules/icinga_ssh_client/files/id_rsa.pub
ssh-rsa ADAAB3NzaC3yc2EAAAADAEulgMUFyT9y2DaZYXHUdLWvkE9TKE+OVO8jYhmGG2BMmL5Ad3D+flpTMQfpp7EVJg2vTBSiVG4kCVicvb nagios@icinga

# (auto) create new host / object on icinga
cat /etc/icinga/objects/puppet.cfg
define host {
host_name puppet
address 192.168.1.173
use generic-host
hostgroups debian
}

TODO
# (auto) remove old hosts from /var/lib/nagios/.ssh/known_hosts on icinga
# (auto) import new host to /var/lib/nagios/.ssh/known_hosts on icinga

# add raid check
#apt-get install -y hddtemp
#wget -q "http://exchange.nagios.org/components/com_mtree/attachment.php?link_id=341&cf_id=24" -O /usr/lib/nagios/plugins/check_hddtemp
#chmod go+x /usr/lib/nagios/plugins/check_hddtemp

Links
http://serverfault.com/questions/411245/puppetlabs-file-line-type-not-working
http://serverfault.com/questions/238708/adding-lines-to-etc-profile-with-puppet

Debian: Install Puppet on client

Install Puppet client (agent)
<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.puppet-client.sh";
echo "wget $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

enabling pluginsync
sed -i '/\[main\]/a\pluginsync=true\' /etc/puppet/puppet.conf
sed -i '/\[main\]/a\runinterval=10\' /etc/puppet/puppet.conf

test connection to pupet server
puppet agent --test
OR
puppet agent --test --server puppet.lab --waitforcert 60 --verbose
#--no-daemonize

change update interwal in seconds (default 30min.)
vi /etc/puppet/puppet.conf
[main]
runinterval=300

puppet version
puppet --version

Links
http://docs.puppetlabs.com/learning/agent_master_basic.html

Puppet

Installation
1. Install and configure Puppet on server (/etc/puppet/fileserver.conf)
http://www.panticz.de/install-puppet-server-puppetmaster
2. On client: Install Puppet client
http://www.panticz.de/install-puppet-client
3. On client: apply for certificate (puppet agent --test)
4. On server: confirm certificate (puppet cert sign dev2.lab)
5. On server: configure modules (/etc/puppet/modules/MODULE_NAME/manifests/init.pp)
6. On server: prepare files (/etc/puppet/modules/MODULE_NAME/files)
7. Configure clients (/etc/puppet/manifests/site.pp)

IpFire

http://wiki.ipfire.org/de/addons/net-snmp/start - SNMP Daemon for IpFire

Edit Cron jobs on IpFire
fcrontab -e
/etc/init.d/fcron restart

# force update dyndns every day
#9 2 * * 0 [ -f "/var/ipfire/red/active" ] && /usr/local/bin/setddns.pl -f
0 19 * * * [ -f "/var/ipfire/red/active" ] && /usr/local/bin/setddns.pl -f

Upgrade
pakfire update
pakfire upgrade

Install Addons
pakfire install -y iftop

Update XEN VM
mount /dev/vg1/fw-boot /mnt/

# add XEN boot entry in GRUB configuration

Pogoplug: Install Debian

Install Debian
# connect to PogoPlug
ssh root@192.168.2.155
ceadmin

# prepare USB flash (1GB root, 256MB swap)
printf "o\nn\np\n1\n\n+1G\nn\np\n2\n\n+256M\nt\n2\n82\nw\n" | fdisk /dev/sda

# download and execute debian installation script
cd /tmp
wget http://projects.doozan.com/debian/dockstar.debian-squeeze.sh
chmod +x dockstar.debian-squeeze.sh
export PATH=$PATH:/usr/sbin:/sbin
./dockstar.debian-squeeze.sh
ok

# login to new debian intallation
ssh root@192.168.1.X
pass: root

# change root password
passwd

Configure netconsole

lyc - Linux Yamaha receiver control (over serial / RS232 interface)

Yamaha RX-V3800 and some older models like DSP-AX1 are great AV-Receiver, but unfortunately they have no control / web interface to manage it from outside. With a USB-Serial adapter connected to the reciver RS-232 interface, a computer or router and lyc you can control the reciver. In addition, a web interface can be created with wlyc to provide a web access to all network devices like PC, smartphone or tablet.

GitHub repository
https://github.com/panticz/lyc

Download binary
http://dl.panticz.de/lyc/i386/lyc - i386 compiled
http://dl.panticz.de/lyc/ar9132/lyc - Atheros AR9132 (TP-LINK TL-WR1043ND / TL-WDR4300 router)

HowTo compile and run
1. download lyc.c and Makefile
2. compile with: make
3. set up USB Serial adapter http://www.panticz.de/USB-Serial-adapter
4. run command:
./lyc input dvd
./lyc volume up

Run on OpenWrt router
1. download sources
2. comile with
make mips
4. copy lyc to OpenWRT router:
scp lyc root@OPENWRT_IP:/root/lyc
5. login to root@YOUR_OPENWRT_IP
6. download wlyc (OpenWrt wget can not access https, use http redirection)
wget -q http://dl.panticz.de/wlyc/wlyc -O /www/cgi-bin/wlyc
chmod 755 /www/cgi-bin/wlyc
7. Open im broser:
http://OPENWRT_IP/cgi-bin/wlyc
Example: http://ROUTER_IP/cgi-bin/wlyc?p1=input&p2=dvd

cros-compile script for OpenWRT
http://dl.panticz.de/lyc/compile_openwrt_ar9132.sh

http://raw.githubusercontent.com/panticz/lyc/master/lyc.c - lyc source code
<?php
$URL="https://raw.githubusercontent.com/panticz/lyc/master/lyc.c";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

https://raw.githubusercontent.com/panticz/lyc/master/rxvx700.h - Yamaha RS232 codes
<?php
$URL="https://raw.githubusercontent.com/panticz/lyc/master/rxvx700.h";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

https://raw.githubusercontent.com/panticz/lyc/master/Makefile - Makefile
<?php
$URL="https://raw.githubusercontent.com/panticz/lyc/master/Makefile";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Links
http://mark.jerde.org:13780/v1/comp/rxv2400/
http://linuxmce.org/
http://forum.linuxmce.org/index.php?topic=5759.0
http://www.remotecentral.com/cgi-bin/mboard/rc-touch/thread.cgi?849
http://www.omei.de/

Ubuntu: temperature monitoring with TEMPer USB sensor / thermometer

lsusb
Bus 005 Device 012: ID 0c45:7401 Microdia

download already compiled version
sudo wget -q http://dl.panticz.de/pcsensor/pcsensor -O /usr/local/bin/pcsensor
sudo chmod a+x /usr/local/bin/pcsensor
sudo watch /usr/local/bin/pcsensor

compile self
# install libs
sudo apt-get install -y libusb-dev libusb-1.0-0 make #libhid-dev

# get source
#wget http://www.isp-sl.com/pcsensor-0.0.1.tgz -O /tmp/pcsensor-0.0.1.tgz
#tar xzf /tmp/pcsensor-0.0.1.tgz -C /tmp
#cd /tmp/pcsensor-0.0.1
mkdir /tmp/pcsensor