tag:blogger.com,1999:blog-26804470028141065622024-02-02T19:12:40.764+03:00Computer Related LogbookUnknownnoreply@blogger.comBlogger209125tag:blogger.com,1999:blog-2680447002814106562.post-64808843094006571772017-01-07T01:25:00.000+03:002017-01-07T01:25:38.219+03:00Packstack installation mariadb error <div dir="ltr" style="text-align: left;" trbidi="on">
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Here is the error I get </div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
ip_mariadb.pp: [ ERROR ]</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Applying
Puppet manifests
[ ERROR ]</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
ERROR :
Error appeared during Puppet run: ip_mariadb.pp</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Error:
Execution of '/usr/bin/yum -d 0 -e 0 -y install mariadb' returned 1: Transact</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
ion check
error:</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
You will
find full trace in log /var/tmp/packstack/ZCy5o5/manifests/</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
ip_mariadb.pp.log</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Please check
log file /var/tmp/packstack/ZCy5o5/openstack-setup.log</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
for more
information</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Additional
information:</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
Remove mysql
and install mariadb manually </div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
# yum remove
mysql mysql-libs mysql-devel mysql-server</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
# yum
install mariadb mariadb-libs mariadb-devel mariadb-server</div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
<br /></div>
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
After that
run packstack again</div>
<br />
<div lang="tr" style="font-family: Calibri; font-size: 11.0pt; margin: 0in;">
# packstack
--answer-file rdo.txt</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-74330954259765945192017-01-01T21:40:00.000+03:002017-01-01T21:40:54.199+03:00Packstack Openstack Installation<div dir="ltr" style="text-align: left;" trbidi="on">
After installing CentOS 7 <br />
Instal RDO <br />
#yum install -y <a href="https://rdoproject.org/repos/rdo-release.rpm" style="color: #3465a4;">https://rdoproject.org/repos/rdo-release.rpm</a><br />
<br />
Because installation not compatible with openstack-packstack <br />
#systemctl stop NetworkManager; systemctl disable NetworkManager<br />
<br />
Install openstack <br />
#yum install -y centos-release-openstack-mitaka<br />
<br />
Install packstack <br />
#yum install -y openstack-packstack<br />
<br />
get the answer file <br />
# packstack --gen-answer-file <a href="https://www.blogger.com/root/answers.txt" style="color: #3465a4;">/root/answers.txt</a><br />
<br />
<br />
change with your options <br />
CONFIG_NTP_SERVERS=pool.ntp.org<br />
CONFIG_KEYSTONE_ADMIN_PW=password<br />
CONFIG_DEFAULT_PASSWORD=password<br />
CONFIG_HORIZON_SSL=y<br />
CONFIG_PROVISION_DEMO=n<br />
<br />
<br />
start installation <br />
#packstack --answer-file <a href="https://www.blogger.com/root/answers.txt" style="color: #3465a4;">/root/answers.txt</a><br />
<br />
<br />
<br />
You may face this error<br />
<br />
Preparing Nova VNC Proxy entries [ ERROR ]<br />
<br />
ERROR : [Errno 2] No such file or directory: '/etc/pki/tls/certs/selfcert.crt'<br />
Please check log file <a href="https://www.blogger.com/var/tmp/packstack/20161109-192844-cGjfCc/openstack-setup.log" style="color: #3465a4;">/var/tmp/packstack/20161109-192844-cGjfCc/openstack-setup.log</a> for more information<br />
<br />
<br />
Solution:<br />
# openssl req -x509 -sha256 -newkey rsa:2048 -keyout selfkey.key -out selfcert.crt -days 1024 -nodes<br />
# cp selfkey.key <a href="https://www.blogger.com/etc/pki/tls/private/" style="color: #3465a4;">/etc/pki/tls/private/</a><br />
# cp selfcert.crt <a href="https://www.blogger.com/etc/pki/tls/certs" style="color: #3465a4;">/etc/pki/tls/certs</a><br />
<br />
change answer file <br />
CONFIG_SSL_CERT_DIR=/root/packstackca/<br />
<br />
and put your ip here <br />
ln -s <a href="https://www.blogger.com/etc/pki/tls/certs/ssl_vnc.crt" style="color: #3465a4;">/etc/pki/tls/certs/ssl_vnc.crt</a><a href="https://www.blogger.com/root/packstackca/certs/PUTYOURIPssl_vnc.crt" style="color: #3465a4;">/root/packstackca/certs/PUTYOURIPssl_vnc.crt</a></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-54770945850392990652016-08-09T09:05:00.001+03:002016-08-09T09:05:56.846+03:00Scappy vlan information<div>scappy vlan information </div><div>In scappy because of implementation , capturing with scappy do not collect vlan information. Instead of this I prefer collecting pcap information via os command and tcpdump. After that I proceed with scappy</div><div><br></div><div>>>> a=rdpcap("/tmp/test.pcap")</div><div>>>> a[0]</div><div><Ether dst=xx:xx:xx:xx:xx:xx src=xx:xx:xx:xx:xx:xx type=0x8100 |<Dot1Q prio=0L id=0L vlan=3625L type=0x8100 |<Dot1Q prio=0L id=0L vlan=3625L type=0x800 |<IP version=4L ihl=5L tos=0xe0 len=107 id=14873 flags= frag=0L ttl=63 proto=udp chksum=0x5a4a src=xx.xx.xx.xx dst=xx.xx.xx.xx options=[] |<UDP sport=xx dport=xx len=87 chksum=0x0 |<Raw xxxxxxxxx>>>>>></div><div><br></div><div><br></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-69777238820532905922016-08-09T08:56:00.001+03:002016-08-09T08:58:46.737+03:00Devstack installation , Ubuntu<div>Devstack installation on Ubuntu 14.04 server version. I installed on Vmware Player. </div><div><br></div><div>$ adduser stack</div><div><br></div><div>Install sudo if not installed </div><div>$ apt-get install sudo -y </div><div><br></div><div>Adding user to sudo group </div><div>$ sudo adduser stack sudo </div><div><br></div><div>Install git </div><div>$ sudo apt-get install git -y</div><div><br></div><div>Devstack clone</div><div>$ git clone https://git.openstack.org/openstack-dev/devstack</div><div><br></div><div>$ cd devstack </div><div><br></div><div>Config file copy </div><div>$ cp ./samples/local.conf .</div><div><br></div><div><br></div><div><br></div><div>Edit local.conf file</div><div>FLOATING_RANGE a range not used on the local network</div><div>FIXED_RANGE to configure the internal address space used by the instances</div><div>FLAT_INTERFACE to the Ethernet interface that connects the host to your local network </div><div><br></div><div>FLOATING_RANGE=192.168.1.0/24</div><div>FIXED_RANGE=192.168.149.1/24</div><div>FLAT_INTERFACE=eth1</div><div><br></div><div>This is could be goog if you have multiple network card </div><div>HOST_IP=127.0.0.1</div><div><br></div><div>Start installation</div><div>$./stack.sh </div><div><br></div><div><br></div><div>You can get these kind of errors, also find solution here </div><div><br></div><div>Error</div><div>[ERROR] /home/stack/devstack/functions-common:604 git call failed: [git clone https://github.com/kanaka/noVNC.git /opt/stack/noVNC</div><div><br></div><div>Solution </div><div>Download noVNC from github, extract as /opt/stack/noVNC .</div><div>And run ./stack.sh again. </div><div><br></div><div><br></div><div>Error</div><div>OfflineGenerationError at /auth/login/</div><div>You have offline compression enabled but key "71f1bb91aa1db46c691a399635d662c7" is missing from offline manifest. You may need to run "python manage.py compress".</div><div><br></div><div>Solution</div><div>/opt/stack/horizon/openstack_dashboard/local</div><div>COMPRESS_OFFLINE=True --> False</div><div><br></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-28498109788947610252015-10-13T16:04:00.001+03:002015-10-14T11:04:10.156+03:00scramble values in csv file<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">I need to do kind of scrambling, or mixing some values in certain columns if csv file. Kind of security issue. So python takes argument of column place in the file to mix. You can state more than one column. It keeps first 8 number and shuffles rest. You change this part for more.</div>
<pre>SHELL PART
I do process controls here, for not running twice or more.
#!/bin/sh
#used for process control
probe=SMTH
if [ -e /tmp/.transferfile$probe.pid ]
then
PID=`cat /tmp/.transferfile$probe.pid`
PROC=`ps $PID | wc -l`
if [ $PROC -gt 1 ]
then
exit 0
fi
fi
echo $$ > /tmp/.transferfile$probe.pid
ls /folder| grep ^filename | while read file
do
/usr/bin/python /pathto/xdrscramble.py -i /folder/$file -o /newfolder/ -c 7 9 16
done
PYTHON PART
import csv
import os
import sys
import getopt
import random
from random import shuffle
keep = 8
def main(argv):
inputfile = ''
outputfile = ''
try:
opts, args = getopt.getopt(argv,"hi:o:c",["ifile=","ofile="])
except getopt.GetoptError:
print 'xdrscamble.py -i <inputfile> -o <outputdir>'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'xdrscamble.py -i <inputfile> -o <outputdir> -c column1 column2'
sys.exit()
elif opt in ("-i", "--ifile"):
inputfile = arg
inputdir = os.path.dirname (inputfile)
inputfilename = os.path.basename (inputfile)
elif opt in ("-o", "--ofile"):
outputfile = arg
elif opt in ("-c", "--columns"):
mixthem = args
f = open(inputfile)
xdrfile = csv.reader(f)
print inputdir+ "/" + "tmp_"+inputfilename
fo = open(inputdir+ "/" + "tmp_"+inputfilename,'wb')
writer= csv.writer(fo)
for row in xdrfile:
for columns in mixthem:
columns=int(columns)
columns = columns -1
if row[columns] != "_":
x=row[columns]
rowx=row[columns][keep:]
y=mixup(rowx)
row[columns] = row[columns][0:keep]
writer.writerow(row)
fo.close
f.close
os.system ("mv " + inputdir+ "/" + "tmp_" + inputfilename + " " + outputfile + "/" + inputfilename )
os.remove (inputfile)
def mixup(rowx):
as_list_of_letters = list(rowx)
random.shuffle(as_list_of_letters)
return ''.join(as_list_of_letters)
if __name__ == "__main__":
main(sys.argv[1:])</outputdir></inputfile></outputdir></inputfile></pre>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-8848112224859298592015-09-30T09:00:00.000+03:002015-10-14T10:54:42.607+03:00Oracle cx_Oracle python nagios DB check<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br></div>
I used this python plugin for nagios to find delay in a database. Database is used for etl processes.
You need to create a readonly user at Oracle DB.
<br>
<br>It takes arguments ip of db, delay , table name holds delay data, and sid<br>
<pre>#!/usr/bin/python
import sys,os
import cx_Oracle
ip = str(sys.argv[1])
port = 1521
SID = str(sys.argv[4])
maxcount = sys.argv[2]
TABLE = str(sys.argv[3])
dsn_tns = cx_Oracle.makedsn(ip, port, SID)
connection = cx_Oracle.connect('dbuser', 'dbpass', dsn_tns)
cursor = connection.cursor()
cursor.execute("SELECT max(m5_id) FROM " + TABLE )
m5_id = cursor.fetchall()[0][0]
cursor.execute("SELECT ROUND((SYSDATE -(SELECT MAX(M5_REAL_DATE_LOCAL) FROM " + TABLE + "))*1440,2) FROM DUAL")
delay = cursor.fetchall()[0][0]
cursor.close()
connection.close()
if int(delay) < int(maxcount):
print "OK | " + str(delay)
sys.exit(0)
else:
print "NOK | " + str(delay)
sys.exit(2)
Nagios definitions</pre><pre>define command{
command_name check_dwhtime3
command_line $USER1$/check_dbrecordcount2.py $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$
}
define service{
use generic-service
host_name servername
service_description DWH time
check_command check_dwhtime3!90!DWH.DWH_TIME_TB!SID
contact_groups admins
}
</pre>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-5796678112173451442015-09-29T22:40:00.001+03:002015-09-29T22:40:30.087+03:00log trace send application logs to remote syslog server<div dir="ltr" style="text-align: left;" trbidi="on">
I aimed send log file (not /var/log/* all kind of application log files) from a system to remote syslog server. Nice part ; using multiple cpu, runs as a deamon , and it is configurable :) - you can specify any file, you can search specific keywords or you can send all lines. all syslog proprieties are also configurable .<br />
<br />
<br />
<br />
<div dir="ltr" style="text-align: left;" trbidi="on">
Probably you cant see all code so please select all start from to<br />
#!/usr/bin/python to the end and then paste. You will see all codes.<br />
<br />
Description: This threaded python script checks text files which defined in parameter file and (if you want you can specify search keywords) send lines to syslog server (with server, port, facility,priority) or any local file. It runs in daemon mode.<br />
<br />
<br />
<pre>#!/usr/bin/python
#Name: Logtrace
#Release: v0.2 03.June.2007
#Description: This threaded python script checks text files which defined in parameter file and
# (if you want you can specify search keywords) send lines to syslog
# server (with server, port, facility,priority) or any local file.
# It runs in daemon mode.
# Threads depends on logfile count*2.
#Written by: ANIL ERCAN SONMEZ <anil .sonmez="" gmail.com="">
#Modified by:
#Notice: You will see many processes, if you check with ps command.
#Modules: ConfigParser,os,re,socket,sys,threading,time
#
#
#======================================================================
#Parameter file content:
#;Log parameters for logtrace python script
#;
#;Put your parameter file (logparam.ini) and script in the same directory
#;
#;Each section [] starts with logfile_??
#;
#;logfilename: Put your file name here search for logtext_?? and send each line to syslog server or any local file.
#;
#;logfacility: auth,authpriv,cron,daemon,kern,lpr,mail,news,security,syslog,user,uucp
#; local0,local1,local2,local3,local4,local5,local6,local7
#; You can configure your syslog server which facility will be written to files.
#; Check syslog documentation for priority and facility.
#;
#;logpriority: alert,crit,debug,emerg,err,error,info,notice,panic,warn,warning
#; You can configure syslog server which priority will be written to files.
#; Check syslog documentation for priority and facility
#;
#;logserver: Ip adress of your syslog server.
#; Please check syslog server has started with -r option and syslog.conf
#; is configured to write to relative log file (messages etc.).
#; You can find further information in syslog documentation.
#; If you want to send logs another file in local system
#; (except syslog controlled files messages,cron,boot etc)
#; leave empty logport option leave empty logport option
#;
#;logport: syslog port, default 514.
#;
#;timeout: frequeny of log file control.
#;
#;logtext_??: search text for you log file. Use '' for sending all of new records.You can append more search.
#
#
#
#[logfile_01]
#logfilename=/var/log/bootlog
#logfacility=kern
#logpriority=alert
#logserver=127.0.0.1
#logport=514
#logtimeout=1
#logtext_01=ara
#
#[logfile_02]
#logfilename=/var/log/cron
#logfacility=kern
#logpriority=alert
#logserver=127.0.0.1
#logport=514
#logtimeout=1
#logtext_01=anil
#logtext_02=test
#logtext_03=
#
#[logfile_03]
#logfilename=/var/log/secure
#logfacility=kern
#logpriority=alert
#logserver=/var/log/anil
#logport=
#logtimeout=1
#logtext_01=
#======================================================================
def daemonize():
import os,sys
if os.fork(): os._exit(0)
os.setsid()
sys.stdin = sys.__stdin__ = open('/dev/null','r')
sys.stdout = sys.__stdout__ = open('/dev/null','w')
sys.stdout = sys.__stderr__ = os.dup(sys.stdout.fileno())
def log_watcher(logfilename,logfacility,logpriority,logserver,logport,logtimeout,search_keywords):
import time, os, re
file = open(logfilename, 'r')
watcher = os.stat(logfilename)
this_modified = last_modified = watcher[8]
""" Go to the end of the file """
file.seek(0,2)
""" Main Loop """
while 1:
if this_modified > last_modified:
last_modified = this_modified
""" File was modified, so read new lines, look for error keywords """
while 1:
line = file.readline()
if not line: break
for keyword in search_keywords:
if re.search(keyword, line):
if logport=='':
lgrfile=open(logserver,"a")
lgrfile.write(logfilename+' ' +line)
lgrfile.close()
else:
lgr = syslog_client((logserver,int(logport)))
lgr.log(line,facility=logfacility,priority=logpriority)
watcher = os.stat(logfilename)
this_modified = watcher[8]
time.sleep(int(logtimeout))
def configread():
config = ConfigParser.ConfigParser()
confpath = os.path.dirname(sys.argv[0]) + '/logparam.ini'
"""config.read(['/usr/local/tcell/bin/logparam.ini'])"""
config.read([confpath])
thr = []
daemonize()
for section in config.sections():
if re.search('logfile',section) :
logfilename= config.get(section,'logfilename')
logfacility= config.get(section,'logfacility')
logpriority= config.get(section,'logpriority')
logserver= config.get(section,'logserver')
logport= config.get(section,'logport')
logtimeout= config.get(section,'logtimeout')
search_keywords=[]
for option in config.options(section):
if re.search('logtext',option):
keyword = config.get(section,option)
search_keywords.append(keyword)
thr= threading.Thread(target=log_watcher,kwargs={"logfilename":logfilename,"logfacility":logfacility,"logpriority":logpriority,"logserver":logserver,"logport":logport,"logtimeout":logtimeout,"search_keywords":search_keywords})
thr.start()
#-----This part belong to Sam Rushing syslog.py
# ======================================================================
# Copyright 1997 by Sam Rushing
#
# All Rights Reserved
# priorities (these are ordered)
LOG_EMERG = 0 # system is unusable
LOG_ALERT = 1 # action must be taken immediately
LOG_CRIT = 2 # critical conditions
LOG_ERR = 3 # error conditions
LOG_WARNING = 4 # warning conditions
LOG_NOTICE = 5 # normal but significant condition
LOG_INFO = 6 # informational
LOG_DEBUG = 7 # debug-level messages
# facility codes
LOG_KERN = 0 # kernel messages
LOG_USER = 1 # random user-level messages
LOG_MAIL = 2 # mail system
LOG_DAEMON = 3 # system daemons
LOG_AUTH = 4 # security/authorization messages
LOG_SYSLOG = 5 # messages generated internally by syslogd
LOG_LPR = 6 # line printer subsystem
LOG_NEWS = 7 # network news subsystem
LOG_UUCP = 8 # UUCP subsystem
LOG_CRON = 9 # clock daemon
LOG_AUTHPRIV = 10 # security/authorization messages (private)
# other codes through 15 reserved for system use
LOG_LOCAL0 = 16 # reserved for local use
LOG_LOCAL1 = 17 # reserved for local use
LOG_LOCAL2 = 18 # reserved for local use
LOG_LOCAL3 = 19 # reserved for local use
LOG_LOCAL4 = 20 # reserved for local use
LOG_LOCAL5 = 21 # reserved for local use
LOG_LOCAL6 = 22 # reserved for local use
LOG_LOCAL7 = 23 # reserved for local use
priority_names = {
"alert": LOG_ALERT,
"crit": LOG_CRIT,
"debug": LOG_DEBUG,
"emerg": LOG_EMERG,
"err": LOG_ERR,
"error": LOG_ERR, # DEPRECATED
"info": LOG_INFO,
"notice": LOG_NOTICE,
"panic": LOG_EMERG, # DEPRECATED
"warn": LOG_WARNING, # DEPRECATED
"warning": LOG_WARNING,
}
facility_names = {
"auth": LOG_AUTH,
"authpriv": LOG_AUTHPRIV,
"cron": LOG_CRON,
"daemon": LOG_DAEMON,
"kern": LOG_KERN,
"lpr": LOG_LPR,
"mail": LOG_MAIL,
"news": LOG_NEWS,
"security": LOG_AUTH, # DEPRECATED
"syslog": LOG_SYSLOG,
"user": LOG_USER,
"uucp": LOG_UUCP,
"local0": LOG_LOCAL0,
"local1": LOG_LOCAL1,
"local2": LOG_LOCAL2,
"local3": LOG_LOCAL3,
"local4": LOG_LOCAL4,
"local5": LOG_LOCAL5,
"local6": LOG_LOCAL6,
"local7": LOG_LOCAL7,
}
import socket
class syslog_client:
def __init__ (self, address='/dev/log'):
self.address = address
if type (address) == type(''):
self.socket = socket.socket (socket.AF_UNIX, socket.SOCK_STREAM)
self.socket.connect (address)
self.unix = 1
else:
self.socket = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
self.unix = 0
# curious: when talking to the unix-domain '/dev/log' socket, a
# zero-terminator seems to be required. this string is placed
# into a class variable so that it can be overridden if
# necessary.
log_format_string = '<%d>%s\000'
def log (self, message, facility=LOG_USER, priority=LOG_INFO):
message = self.log_format_string % (
self.encode_priority (facility, priority),
message
)
if self.unix:
self.socket.send (message)
else:
self.socket.sendto (message, self.address)
def encode_priority (self, facility, priority):
if type(facility) == type(''):
facility = facility_names[facility]
if type(priority) == type(''):
priority = priority_names[priority]
return (facility<<3 data-blogger-escaped-br="" data-blogger-escaped-priority="">
def close (self):
if self.unix:
self.socket.close()
#-----Sam Rushing syslog.py finished here.
if __name__=='__main__':
import re
import os
import sys
import ConfigParser
import threading
configread()
<!--3--></anil></pre>
</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-20130226499561479572015-09-29T22:25:00.000+03:002015-10-14T10:56:00.693+03:00Nagios python plugin<div dir="ltr" style="text-align: left;" trbidi="on">
I used below plugin for creating easy services in Nagios. Main idea behind this without adding new commands for everycheck i just use same command for many service definition<br>
check_command_big!find /var/ | grep test |wc -l!5 . Here you can change only OS commands and check anything you want greater than 5 or any value you state. another example of check can be check_command_big!ps -ef | grep aprocess | wc -l !5<br>
<br>
<br>
<br>
<pre>cat check_command_big.py
#!/usr/bin/python
#import sys, os, base64, getpass, socket, traceback, termios, tty, select
import paramiko, getpass
import os,sys,re
import signal
userName="user"
userPass="pass"
server=sys.argv[1]
command=sys.argv[2]
maxcount=int(sys.argv[3])
t = paramiko.Transport((server,22))
try:
t.connect(username=userName,password=userPass,hostkey=None)
except:
print server + ": Bad password or login!"
t.close()
else:
ch = t.open_channel(kind = "session")
ch.exec_command(command)
if (ch.recv_ready):
x=int(ch.recv(1000))
if x <= maxcount:
print "OK " + str(x) + " command=" + re.sub(r'\|', "",sys.argv[2]) + " | " + str(x)
t.close()
sys.exit(0)
else:
print "NOK " + str(x) + " command=" + re.sub(r'\|', "",sys.argv[2]) + " | " + str(x)
t.close()
sys.exit(1)
define command{
command_name check_command_big
command_line $USER1$/check_command_big.py $HOSTADDRESS$ '$ARG1$' $ARG2$
}
define service{
hostgroup_name testservers
use generic-service
check_interval 10
service_description TEST
check_command check_command_big!find /var/ | grep test |wc -l!5
}</pre>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-58106856965678938812015-09-27T14:38:00.000+03:002015-09-27T14:38:34.136+03:00Cacti plugin installation<div dir="ltr" style="text-align: left;" trbidi="on">
You need at least plugin achitecture, settings plugin. Here i used thold plugin for test. <br />
Download plugin architecture cacti-plugin-0.8.7g-PA-v2.8.tar.gz<br />
Download plugins settings-v0.7-1.tar.gz and thold-latest.tar.gz <br />
<br />
# tar -zxvf settings-v0.7-1.tar.gz<br />
# tar -zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz <br />
# tar -zxvf thold-latest.tar.gz <br />
# cp -R /root/cacti-plugin-arch/files-0.8.7g/ /var/www/html/cacti/<br />
# cp -R /root/settings /var/www/html/cacti/plugins<br />
# cp -R /root/thold-0.41 /var/www/html/cacti/plugins<br />
<br />
<br />
Under /root/cacti-plugin-arch<br />
# mysql cacti -u root -p < pa.sql<br />
<br />
<br />
edit /var/www/html/cacti/include/config.php and add lines below <br />
<br />
<pre>
/* load up old style plugins here */
$plugins = array();
//$plugins[] = 'thold';
/*
Edit this to point to the default URL of your Cacti install
ex: if your cacti install as at http://serverip/cacti/ this
would be set to /cacti/
*/
$url_path = "/cacti/";
</pre>
<br />
<br />
User Management enable plugin management <br />
Plugin management enable plugins<br />
User Management configure view and configure settings again. </div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-36104894586228655062015-09-27T14:37:00.000+03:002015-09-27T14:37:17.726+03:00Calculate timezone difference for bash epoch time<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
Lets find difference of time from UTC with epoh time.<br />
tzdifference=$(($(TZ=Europe/Istanbul date +%:::z)*60*60*1000))<br />
<br />
And add this to UTC for showing time local.<br />
All time information was epoch time.<br />
cat $filename | sed 's/\\,//g' | awk -F"," '{print $1","$2","$3","$4","strftime("%F %T",($5+'$tzdifference')/1000)","$6","$7","$8","$9","$10","$11","$12","$13","$14 </div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-6911904737864278792015-09-27T14:36:00.001+03:002015-09-27T14:36:21.882+03:00Bonding linux<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">Cables are connected to eth2 and eth3 , check switch lacp is enabled. </span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;"><br /></span></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">Edit file </span></span><span style="line-height: 24px; text-align: left;"><span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;">/etc/sysconfig/network-scripts/ifcfg-eth2 </span></span></div>
<div style="text-align: -webkit-auto;">
<span style="line-height: 24px; text-align: left;"><span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;">and ifcfg-eth3</span></span></div>
<div style="text-align: -webkit-auto;">
<span style="line-height: 24px; text-align: left;"><span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><br /></span></span></div>
<span style="background-color: white; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; text-align: -webkit-auto;">DEVICE=eth0</span><br />
<span style="background-color: white; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; text-align: -webkit-auto;">BOOTPROTO=none</span><br />
<span style="background-color: white; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; text-align: -webkit-auto;">ONBOOT=yes</span><br />
<span style="background-color: white; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; text-align: -webkit-auto;">MASTER=bond0</span><br />
<span style="background-color: white; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; text-align: -webkit-auto;">SLAVE=yes</span><br />
<span style="background-color: white; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; text-align: -webkit-auto;">USERCTL=yes</span><br />
<span style="background-color: white; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; text-align: -webkit-auto;"><br /></span>
<span style="background-color: white; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; text-align: -webkit-auto;"><br /></span>
<span style="background-color: white; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px; text-align: -webkit-auto;">Add this </span><span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">/etc/modprobe.conf</span></span><br />
<div style="text-align: -webkit-auto;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">alias bond0 bonding</span></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;"><br /></span></span></div>
<div style="text-align: -webkit-auto;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">Create </span></span><span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif; line-height: 24px; text-align: left;">/etc/sysconfig/network-scripts/ifcfg-bond0</span></div>
<div style="text-align: -webkit-auto;">
<span style="text-align: left;"></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">DEVICE=bond0</span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">BOOTPROTO=none</span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">ONBOOT=yes</span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">NETMASK=255.255.255.0</span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">IPADDR=your ip address</span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">GATEWAY=your gatweay </span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">TYPE=Ethernet</span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">IPV6INIT=no</span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">BONDING_OPTS="miimon=1000 mode=</span></span><b style="font-family: courier, verdana, sans-serif; font-size: 16px; text-align: -webkit-auto;">balance-rr</b><span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">"</span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;"><br /></span></span></div>
<div style="text-align: left;">
<span style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif;"><span style="line-height: 24px;">check for other options </span></span></div>
<div style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif; line-height: 24px;">
<a href="http://www.linuxhorizon.ro/bonding.html" style="text-align: -webkit-auto;">http://www.linuxhorizon.ro/bonding.html</a></div>
<div style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif; line-height: 24px;">
<br /></div>
<div style="color: #333333; font-family: Georgia, 'Bitstream Charter', serif; line-height: 24px;">
/etc/init.d/network restart </div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-56064600878492672942015-09-27T14:36:00.000+03:002015-09-27T14:36:06.397+03:00Bandwith Calculation<div dir="ltr" style="text-align: left;" trbidi="on">
I need to find bandwith between two server. I used iperf <a href="http://sourceforge.net/projects/iperf/">http://sourceforge.net/projects/iperf/</a> for this.<br />
<div>
Just compile it run on one instance as server </div>
<div>
# iperf -s</div>
<div>
<br /></div>
<div>
On another server </div>
<div>
# /usr/local/bin/iperf -c ipaderssofinstance -f M</div>
<div>
<br /></div>
<div>
It generates outputs like below</div>
<div>
<div>
[ ID] Interval Transfer Bandwidth</div>
<div>
[ 3] 0.0-10.0 sec 830 MBytes 83.0 MBytes/sec</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-28258322486999197002013-05-22T08:15:00.000+03:002013-05-22T08:15:28.282+03:00Linux Disk performance tuning<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Last weekend I had problems with heavily active server. I check and see that iostat is showing high disk activity service time was about 100. Also that caused cpu load. I try to find which process is causing disk activity. For this I turn on kernel messages about I/O. Normally for old kernels you could not directly see which process is causing heavy disk activity.<br />
<br />
echo 1 > /proc/sys/vm/block_dump<br />
<br />
dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head<br />
<br />
I found kjournald causing disk activity. And I know many files are created in short term for that server. So I decide to tune filesystem. Filesystem is ext3. I decide to move writeback journaling. The writeback mode does not preserve data ordering when writing to the disk, so commits to the journal may happen before the file system is written to. This method is faster because only the meta data is journaled, but is not quite as neurotic about protecting your data as the default.<br />
I edit fstab and add writeback option<br />
LABEL=/ / ext3 defaults,data=writeback 1 1<br />
<br />
Before reboot run this command.If not your server won't boot.<br />
tune2fs -o journal_data_writeback /dev/sda1<br />
<br /></div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2680447002814106562.post-88787079697525240052013-05-22T08:13:00.001+03:002013-05-22T08:13:15.370+03:00Disable banner for ssh scripts<div dir="ltr" style="text-align: left;" trbidi="on">
LogLevel=Error disables ssh banner in your script.<br />
<br />
ssh -o LogLevel=Error -n $ip </div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-35253166456838632662012-10-05T11:37:00.007+03:002012-10-05T11:37:33.812+03:00Linux Disk performance tuning<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Last weekend I had problems with heavily active server. I check and
see that iostat is showing high disk activity service time was about
100. Also that caused cpu load. I try to find which process is causing
disk activity. For this I turn on kernel messages about I/O. Normally
for old kernels you could not directly see which process is causing
heavy disk activity.<br />
<br />
<pre>echo 1 > /proc/sys/vm/block_dump</pre>
<pre> </pre>
<pre>
</pre>
<pre>dmesg <span class="sh_symbol">|</span> egrep <span class="sh_string">"READ|WRITE|dirtied"</span> <span class="sh_symbol">|</span> egrep <span class="sh_normal">-o</span> <span class="sh_string">'([a-zA-Z]*)'</span> <span class="sh_symbol">|</span> sort <span class="sh_symbol">|</span> uniq <span class="sh_normal">-c</span> <span class="sh_symbol">|</span> sort <span class="sh_normal">-rn</span> <span class="sh_symbol">|</span> head </pre>
<br />
<pre>
</pre>
I
found kjournald causing disk activity. And I know many files are
created in short term for that server. So I decide to tune filesystem.
Filesystem is ext3. I decide to move writeback journaling. The writeback
mode does not preserve data ordering when writing to the
disk, so commits to the journal may happen before the file system is
written to. This method is faster because only the meta data is
journaled, but is not quite as neurotic about protecting your data as
the default.<br />
I edit fstab and add writeback option<br />
LABEL=/ / ext3 defaults,data=writeback 1 1 <br />
<br />
Before reboot run this command.If not your server won't boot. <br />
tune2fs -o journal_data_writeback /dev/sda1<br />
<br />
<br />
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2680447002814106562.post-61677485615449861302012-03-16T14:59:00.000+02:002012-03-16T14:59:30.094+02:00Python Cx_oracle ImportError "libclntsh.so.11.1"<div dir="ltr" style="text-align: left;" trbidi="on">
<pre class="jive-pre"><code class="jive-code jive-java">I started to use cx_oracle module for inserting data to oracle. I get error below if i put related script to cron. </code></pre>
<pre class="jive-pre"><code class="jive-code jive-java">"ImportError: libclntsh.so.11.1: cannot open shared object file: No such file or directory"</code></pre>
<pre class="jive-pre"><code class="jive-code jive-java"> For solution you can run command like below in cron</code></pre>
<pre class="jive-pre"><code class="jive-code jive-java"> </code></pre>
<pre class="jive-pre"><code class="jive-code jive-java">* * * * * (/bin/ksh;export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib/;/usr/local/smthng.py) </code></pre>
</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2680447002814106562.post-66180775483240444062011-10-03T09:08:00.002+03:002011-10-03T09:09:06.870+03:00move volume group to another system<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
move volume group to another system<br />
<br />
servera# umount /folder<br />
vgname datasan, move volume inactive , and export<br />
servera# vgchange -an datasan<br />
servera# vgexport datasan<br />
<br />
in serverb for import<br />
serverb# vgimport datasan<br />
serverb# vgchange -ay datasan<br />
serverb# mount /dev/datasan/datalvname /fodler<br />
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-28990629865378618642011-09-02T15:48:00.001+03:002011-09-02T15:49:42.260+03:00check_by_ssh Remote command execution failed"Remote command execution failed: *************************************************************************** "
<br />
<br />try -E option for fixing this problem for check_by_ssh
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-46952196120064390412011-08-01T16:39:00.002+03:002011-08-01T16:40:39.308+03:00500 OOPS: cannot change directoryI got this error in Red Hat 5.5 vsftp; 500 OOPS: cannot change directory<br />For this just run command below<br />setsebool -P ftp_home_dir onUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-89376149875344490932011-07-11T14:38:00.001+03:002011-07-11T14:38:47.998+03:00find the WWN of a disk/LUN on Red Hat Enterprise Linux 5find the WWN of a disk/LUN on Red Hat Enterprise Linux 5<br /># systool -c fc_host -vUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-23298004848050665812010-09-21T14:39:00.004+03:002010-09-21T15:39:01.081+03:00Clone and Split 2G Virtualbox diskIn Virtual Box Media Manager release and remove disk this is important. <br />Run command below. Give full path, if not it will create disk in your home folder . <br />VBoxManage clonehd /media/VirtualBox/xpDomain/xpDomain.vdi /media/VirtualBox/xpDomain/xpSplited.vdi --format VMDK --variant Split2GUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-41314962044493294742010-07-28T13:29:00.002+03:002010-09-21T15:39:27.515+03:00GPG error Synaptic Package ManagerFor error <br />W: GPG error: http://download.virtualbox.org lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54422A4B98AB5139<br /><br />run this command <br /># sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 54422A4B98AB5139Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-10389648762606249052010-06-15T07:59:00.001+03:002010-06-15T08:01:20.362+03:00ssh initial connection slowCheck /etc/resolv.conf file and verify dns is working for the remote server.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-1262172725056592452010-05-20T11:32:00.002+03:002010-05-20T11:36:55.037+03:00Citrix Client in LinuxDownload and install package <br />http://www.citrix.com/English/ss/downloads/details.asp?downloadId=3323&productId=186&c1=sot2755&c2=ost1349860#top<br /><br />Opening from web page <br /> 1. For the .mailcap file modification, in $HOME, create or modify the .mailcap file and add the line:<br /> application/x-ica; /usr/lib/ICAClient/wfica.sh %s; x-mozilla-flags=plugin:Citrix ICA<br /> 2. For the MIME file modification, in $HOME, create or modify the .mime.types file and add the line:<br /> application/x-ica ica<br /><br /> <br />For ssl error<br /><br />$ sudo cp /usr/share/ca-certificates/mozilla/GlobalSign_Root_CA.crt /usr/lib/ICAClient/keystore/cacerts/<br /><br />Now you can use citrix client.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2680447002814106562.post-50267271035965903122010-04-28T10:19:00.000+03:002010-04-28T10:20:24.815+03:00User Profile Deletion UtilityUser Profile Deletion Utility (Delprof.exe)<br />Delprof.exe is available in the Windows Server 2003 Resource Kit. It is a command-line utility that you can use to delete user profiles on a local or remote computers running Windows 2000, Windows XP, and Windows Server 2003. User profiles can grow large and may take up considerable disk space, especially if there are several users using one computer. Because of this, you may want to use Delprof.exe to free disk space by deleting profiles that are no longer required. However, because each profile on the computer is presented in order when you run the utility, you may want to use the graphical interface instead of the command-line tool whenever possible.<br /><br />http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=901a9b95-6063-4462-8150-360394e98e1eUnknownnoreply@blogger.com0