Pages

Sunday, November 20, 2016

Windows 10 Anniversary Update Failed (1607) ? - Issue Resolved

If your system is having genuine windows operating system windows 7 or later, and if your system is trying to install Windows anniversary update , and if it is getting failed. This is happening because ,you have activated 3rd party Antivirus application installed in your system, and that is causing issue. Please remove any existing 3rd party antivirus or security from your system, reboot the system, activate built in windows defender, it will protect your system without hassle,don't worry.





One more option is to use windows 10 media creation tool, when asked instead of install select option to create media iso dvd, then upgrade from that dvd, In that case , you will be able to install anniversary update for windows 10. Make sure you disable your antivirus from services.msc

Saturday, October 15, 2016

Check Last one minute Average CPU Utilization which was not idle without SNMP Check

Just Remove value of 1% from output which might be due this script execution would give exact information

Saturday, May 28, 2016

Get all MAC address of Windows System

###Script Starts here###
#Developed By Krunal Patel
#Script Works in Windows System Only
import os
import re
a = os.popen("getmac")
count = "1"
for value in a.readlines():
    m = re.search('[\w][\w]-[\w][\w]-[\w][\w]-[\w][\w]-[\w][\w]-[\w][\w]',value)
    if m:
        print ("MAC Address " + "%s" %count + " = " +"%s" %m.group(0))
        count = int(count) + 1
    else:
        continue
a.close()
###Script Ends Here###

This will give output as per highlighted in yellow marker in below screenshot.



Tuesday, May 17, 2016

Simple "Hello World" script in python for Windows

#!C:\Python27\python.exe -u
a = "Hello World"
print a


Monday, May 16, 2016

Simple "Hello World" Script using Ruby

print("Enter your name or word : ")
name = gets
puts("Hello " + name)



Sunday, May 15, 2016

Simple "hello world!" python script

#!/usr/bin/env python
val = raw_input("Enter Sentanse : ")
print "Welcome", val



Wednesday, May 4, 2016

Bash script to get hostname or ip address from /etc/hosts file, if not add to /etc/hosts file


#!/bin/bash
######Developed By - Krunal Patel(Linux Admin)#####
getent hosts $1 | grep $1
if [ $? == 0 ]; then
echo "hostname or ip address " {$1} " exists in /etc/hosts file"
else
read -p "please enter hostname to be added in /etc/hosts file : " hos
read -p "please enter ip address to be added in /etc/hosts file for $hos : " ipa
echo "$ipa $hos" >> /etc/hosts
fi
######Copyright © Krunal Patel (Shell Script Developer)######

Monday, April 25, 2016

Wooh!!! It is possible to start linux OS from Windows cmdline

I have configured vagrant vm from windows cmdline which handles linux vm.





Tuesday, April 19, 2016

Bash Script For Installing Nagios 3.3.1

Note: Dependancies must be installed before you run script, otherwise it would through an error.

#####################Script Starts Here#######################
#!/bin/bash

# This script comes with no warranty ...use at own risk

# Copyright (C) 2010 Mike Weber

#

# This program is free software; you can redistribute it and/or modify

# it under the terms of the GNU General Public License as published by

# the Free Software Foundation; version 2 of the License.

#

# This program is distributed in the hope that it will be useful,

# but WITHOUT ANY WARRANTY; without even the implied warranty of

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

# GNU General Public License for more details.

#

# You should have received a copy of the GNU General Public License

# along with this program or from the site that you downloaded it

# from; if not, write to the Free Software Foundation, Inc., 59 Temple

# Place, Suite 330, Boston, MA 02111-1307 USA

#####################################################################

# The purpose of the script is to install Nagios and plugins using source.

# DESIGNED AND TESTED ON CENTOS 5.5

# Created September 21, 2010

# Modified November 26, 2010

# Modified March 14,2011

# Modified July 24, 2011 update to make compatible with CentOS 6

# Updated for Nagios 3.3.1 July 26 ,2011

# Tested on CentOS 6.2 Jan. 12, 2012

#####################################################################



# Script Must Run as root

if [[ $EUID -ne 0 ]]; then

echo "This script must be run as root" 1>&2

exit 1

fi

cd /usr/local/src

yum install -y wget

wget http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.3.1/nagios-3.3.1.tar.gz

wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz

yum install -y httpd php gcc glibc glibc-common gd gd-devel make mysql mysql-devel net-snmp

useradd nagios

groupadd nagcmd

usermod -a -G nagcmd nagios

tar zxvf nagios-3.3.1.tar.gz

tar zxvf nagios-plugins-1.4.15.tar.gz

cd nagios

./configure --with-command-group=nagcmd

make all

make install; make install-init; make install-config; make install-commandmode; make install-webconf

cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/

chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

cd ..

cd nagios-plugins-1.4.15

./configure --with-nagios-user=nagios --with-nagios-group=nagios

make

make install

chkconfig --add nagios

chkconfig --level 3 nagios on

chkconfig --level 3 httpd on

exit 0

#####################Script Ends Here#######################

Saturday, April 16, 2016

Get Hostname associated with ip address from /etc/hosts file


You need to add command line argument as mentioned in screenshot.



#!/bin/bash
#Developed By - Krunal Patel ( Linux Admin)
cat /etc/hosts | grep $1 | awk {'print $2,$3'}

Bash Script to get IP Address Of System NIC in Linux


You need to use command line argument i.e. called as $1 in bash script, shown in screenshot below


###############Script Starts Here#################
#!/bin/bash
#Developed By - Krunal Patel
echo "IP Address of interface $1 is : " $(ifconfig $1 | grep -i "inet addr" | cut -d":" -f2 | cut -d" " -f1)
###############Script Ends Here##################

Shell Script Code