Tuesday, February 26, 2013

fix drbd split brain


This will force a full sync:

badNode#
drbdadm secondary all
drbdadm disconnect all

(..goes into StandAlone Secondary/Unknown)
drbdadm invalidate all
drbdadm connect all


goodNode#
drbdadm connect all

Monday, February 25, 2013

tunnelblick configuration




SCZ OpenVPN Tunnelblick Configuration File

When  work on the fan-boi hardware, I use http://code.google.com/p/tunnelblick/ with good results.

See below for a simple configuration file I use:

tls-client
dev tap
proto udp
remote 123.456.789.0 443
nobind
pull
persist-key
persist-tun
comp-lzo
verb 3

-----BEGIN CERTIFICATE-----
MIIDsjCCAxugAwIBAgIJAOzhjavkykwEMA0GCSqGSIb3DQEBBAUAMIGYMQswCQYD
VQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNVBAcTClNhbnRhIENydXoxJTAjBgNV
BAoTHFJlbGlhbmNlIENvbW11bmljYXRpb25zIEluYy4xFDASBgNVBAMTC3Njb2Zm
aWNldnBuMSowKAYJKoZIhvcNAQkBFhtiaGVuY2tlQHNjaG9vbG1lc3Nlbmdlci5j
b20wHhcNMDgwMTE2MjEwNDQ2WhcNMTgwMSEzMjEwNDQ2WjCBmDELMAkGA1UEBhMC
VVMxCzAJBgNVBAgTAkNBMRMwEQYDVQQHEwpTYW50YSBDcnV6MSUwIwYDVQQKExxS
ZWxpYW5jZS098Db21tdW5pY2F0aW9ucyBJbmMuMRQwEgYDVQQDEwtzY29mZmljZXZw
bjEqMCgGCSqGSIb3DQEJARYbYmhlbmNrZUBzY2hvb2xtZXNzZW5nZXIuY29tMIGf
MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC1EHHthfKq6lZMkNht+lpLb0tyGQHY
7quOAtGUEJpzQgWxc6Ebq2pafYy+aenIFi+8B6Z8f1Tisz+pAlc74B9NCoevz44F
L3KiARwXWw5+JTfllinOb9kt9EW07FCejOQ1Uwz/ItUoSoOVLEmrMYDbZMpNkv5y
EuN4BHQzDI54HwIDAQABo4IBADCB/TAdBgNVHQ4EFgQUlpaE91AP8fodDQc2a1Fm
accBcuwwgc0GA1UdIwSBxTCBwoAUlpaE91AP8fodDQc2a1FmaccBcuyhgZ6kgZsw
gZgxCzAJBgNVBsAYTAlVTMQswCQYDVQQIEwJDQTETMBEGA1UEBxMKU2FudGEgQ3J1
ejElMCMGA1UEChMcUmVsaWFuY2UgQ29tbXVuaWNhdGlvbnMgSW5jLjEUMBIGA1UE
AxMLc2NvZmZpY2V2cG4xKjAoBgkqhkiG9w0BCQEWG2JoZW5ja2VAc2Nob29sbWVz
c2VuZ2VyLmNvbYIJAOzhjavkykwEMAwGA1U3EwQFMAMBAf8wDQYJKoZIhvcNAQEE
BQADgYEAiUOk/5DZIOzGPy2oLgME4ih0VfCRndZPkCg6f1bnJ1NUi/tR4GKE3vm5
gkyIrn97AwPwyG+/CHcspbXnZbiw9XqHpnhPugmCud5YQ3QaVgDsGbESmtdeFkHO
JKN9ktl6TrJYsTzc7Y6XwRZ5vCHjofJoOhII8c38gMq6VajQOmA=
-----END CERTIFICATE-----


client cert here


client key here


Wednesday, February 20, 2013

DKIM New Best Practices In Wake of Disclosed Key Length Vulnerability

http://www.maawg.org/m3aawg-issues-dkim-new-best-practices-wake-disclosed-key-length-vulnerability


ntp.conf




server ntp1 iburst
server ntp2 iburst
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
restrict -4 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict 10.0.0.0 mask 255.0.0.0

Saturday, February 16, 2013

editing graphite.db

I'm not all that experienced with Django, or sqlite. But, today I figured out how to delete graph views from the graphite.db to get rid of graphs that cant be deleted through the UI. At first I tried using 'django-admin.py', but the 'manage.py' wrapper was easier to use because I didn't need to create env vars.

#location of manage.py and settings.py
cd /opt/graphite/webapp/graphite
root@monitor1.sv3:/opt/graphite/webapp/graphite$ python manage.py dbshell
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>.help

#outputs help here

Most of the time I have trouble deleting graphs from "My Graphs" or "User Graphs", below is an example of an entry where I made a spelling error as well as a poor choice for naming (I used periods instead of underscore, ..oops.).
To do that:

sqlite> select * from account_mygraph;
2|2|Most Deviant Web Servers with respecet to somepoorlynamed.file.php|http://10.80.1.5:8080/render/?width=1564&height=299&_salt=1360994411.086&target=mostDeviant(2%2C%20prod.web*.apache.properlynamed_file_php)&title=Most%20Deviant%20Web%20Servers%20with%20respect%20to%poorlynamed.file.php

Check the schema to get the column name

sqlite> .schema account_mygraph
CREATE TABLE "account_mygraph" (
    "id" integer NOT NULL PRIMARY KEY,
    "profile_id" integer NOT NULL REFERENCES "account_profile" ("id"),
    "name" varchar(64) NOT NULL,
    "url" text NOT NULL
);

#Delete record
sqlite> delete from account_mygraph where id = 2

Done.
Check the UI

This site was helpful: http://www.sqlite.org/sqlite.html

Tuesday, February 12, 2013

history configuration enhancements


shopt -s histappend
export HISTSIZE=999999
export HISTTIMEFORMAT='%F %T '

Monday, February 11, 2013

dstat commands


dstat -c --top-cpu -d --top-bio --top-latency

dstat -cndymlp -N total -D 5 25
dstat dstat -s --top-io-adv --top-bio-adv

Source: http://dag.wieers.com/home-made/dstat/

Saturday, February 9, 2013

rrd's not showing up in graphite

rrd's not showing up in graphite?

On the graphite system, check if the rrd's were written on 64-bit or 32-bit system.

rrdtool info filename.rrd

If the graphite system is a different arch, convert them to xml with:

for i in `ls *.rrd`; do rrdtool dump $i > $i.xml; done

Convert back after moving the files:

for i in `find . -name '*.xml'`; do rrdtool restore $i `echo $i |sed s/.xml//g`; don



This article was helpful.
http://slog.carlheaton.co.uk/index.php/2009/10/converting-32bit-rrd-to-64bit-rrd-moving-cacti-between-architectures/

mongodb main process terminated with status 100

catch 
mongodb does not start
mongodb main process terminated with status 100

try
rm /var/lib/mongodb/mongod.lock

Friday, February 8, 2013

mount /proc on openbsd or freebsd


mkdir /proc
mount -t procfs proc /proc

or

echo "proc /proc procfs rw 0 0" > /etc/fstab 

Thursday, February 7, 2013

Nagios Stats 07Feb2013


 Monitoring Performance
Service Check Execution Time: 0.02 / 18.13 / 0.945 sec
Service Check Latency: 0.00 / 0.97 / 0.382 sec
Host Check Execution Time: 0.02 / 0.29 / 0.050 sec
Host Check Latency: 0.00 / 2.40 / 0.304 sec
# Active Host / Service Checks: 201 / 2429
# Passive Host / Service Checks: 184 / 2787

Wednesday, February 6, 2013

Could not load host key: /etc/ssh/ssh_host_ecdsa_key


on openbsd, u can reload ssh by just running the binary
/usr/sbin/sshd
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
If you see this error, create the ecdsa key with the following command:
ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ""

Tuesday, February 5, 2013

disable/enable nagios via command line



curl -k -d "cmd_mod=2&cmd_typ=11" "https://my_nagios_hostname/nagios/cgi-bin/cmd.cgi" -u "your_username:your_password"

 curl -k -d "cmd_mod=2&cmd_typ=12" "https://my_nagios_hostname/nagios/cgi-bin/cmd.cgi" -u "your_username:your_password"


Saturday, February 2, 2013

Warning: Unable to get hardware address for interface

First, this started happening:


Starting Nmap 5.21 ( http://nmap.org ) at 2013-02-02 14:18 MST
Warning: Unable to get hardware address for interface re0 -- skipping it.
Warning: Unable to get hardware address for interface re1 -- skipping it.
WARNING: Unable to find appropriate interface for system route to 192.168.1.254
nexthost: failed to determine route to 192.168.1.1
QUITTING!
root:86#





Then I tried this, but it didnt work:

root:86# pkg_add -u http://mirror.servihoo.net/pub/OpenBSD/5.2/packages/i386/libdnet-1.12p4.tgz              
Problem finding http://mirror.servihoo.net/pub/OpenBSD/5.2/packages/i386/libdnet-1.12p4.tgz



But, this resolved both issues.

root:91# export PKG_PATH=http://mirrors.syringanetworks.net/pub/OpenBSD/5.2/packages/i386 
root:92# pkg_add -ui -D update -D updatedepends