Electricity Bill Calculator

Electricity Bill Calculator

Electricity Bill Cost Calculator. Electricity Usage Consumption Calculator.

Select Country:  
Typical Appliance:
Power Consumption:
Hours Of Use Per Day: Hrs/Day
One Unit Cost (1 kWh ):
 
Electricity Cost Per Day:  
Electricity Cost Per Month:  
Electricity Cost Per Year:  

Note:- 1 Unit = 1 kwh (Kilo Watt Hour)

HTML tutorial

Social Message

Social Message
Social Message Useful Health Tips

Thursday, March 16, 2017

Run Multiple Instances of Google Drive on Windows 7 / 8 /10 to Sync Multiple Accounts

Run Multiple Google Backup and Sync Accounts
Configure on Windows 7 / 8 /10 

Step 1: 

Please Install Google Drive Backup and Sync on your computer. Download available below link.

https://www.google.com/drive/download/


After installation, Please configure your First Google Drive account.

Step 2: 

For Second Google Drive account; Please create one New folder at any location on your windows 7/8/10 system/laptop.

Create one new mohan.bat or XXXXXX.bat file and open in notepad , add below mention entry.

@ECHO OFF
SET USERNAME=mohan@ gmail.com
SET USERPROFILE=%~dp0%USERNAME%
MD "%USERPROFILE%\AppData\Roaming">nul
MD "%USERPROFILE%\AppData\Local\Application Data">nul
MD "%USERPROFILE%\Application Data">nul
MD "%USERPROFILE%\Local Settings\Application Data">nul
MD "%USERPROFILE%\My Documents">nul
MD "%USERPROFILE%\Documents">nul
START googledrivesync
                                                                                                                                                        

Reference Note:-

mohan à Replace with your mail account name [Or] Other name which you like "My mail" or "My Inbox". Remaining scripts Don't change / Don't  Remove any space between letter/words.


Step 3:


Copy googledrivesync.exe file from Existing installed google drive location 
(C:\Program Files (x86)\Google\Drive ) to New folder location which you created. Refer below screen shot.



Step 4:

Simply open mohan.bat (XXXXX.bat)  file. It will open new google drive backup and sync login windows (Reference below screen shot)..You can add another gmail account and configure it.






After configure you can see Two Google Drive icon in task bar.



Step 5:

New Google Drive Account Auto start option. Create shortcut using mohan.bat / XXXXX.bat file and cut, paste shortcut to windows startup location.

Windows 10 windows startup location:

C:\Users\Dell\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup



After the reboot of system. Google drive second account will start automatically.




If need more account to be configure. Please follow Step 2 to Step 5.



Saturday, January 14, 2017

Setup External SMTP Server to Send Nagios Notifcation Alerts on CentOS/Linux

Setup External SMTP Server to Send Nagios Notifcation Alerts on Linux


Setup up Nagios to use an external SMTP server.


1. Download the SendEmail setup tar file from below link.

Click Here to Download

[or ]   Directly use wget command on Linux command prompt.

root#wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz

2. Extract, and copy sendEmail to /usr/local/bin

root#tar -xvzf sendEmail-v1.56.tar.gz
root#cp sendEmail-v1.56/sendEmail /usr/local/bin

3. SendEmail requires the Net::SSLeay and IO::Socket::SSL perl modules be installed to function, so install these if they're not already:

root#yum install perl-Net-SSLeay
root#yum install perl-IO-Socket-SSL

For Testing run below command on Linux command prompt. You will get Test Mail. If receiving Test mail. Your external mail server installed successfully.

root#/usr/local/bin/sendEmail -f mohan@mohansundaram.com -t mohan@mohansundaram.com -u TestMail -m TestMail -s smtp.mail.com:587 -xu alert@mohansundaram.com -xp help@123 -o tls=yes

mohan@mohansundaram.com -> From Address
smtp.mail.com -> SMTP Outgoing Server 
587 -> SMTP Server port with TLS
alert@mohansundaram.com -> Mail Server Username
help@123 -> Password


4. Now modify the notify-host-by-email and notify-service-by-email commands in Nagios' commands.cfg file as follows:

root#/usr/local/nagios/etc/objects/commands.cfg

define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/local/bin/sendEmail -f mohan@mohansundaram.com -s smtp.mail.com:587 -xu alert@mohansundaram.com -xp help@123 -o tls=yes -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -t $CONTACTEMAIL$
}

define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/local/bin/sendEmail -f mohan@mohansundaram.com -s smtp.mail.com:587 -xu alert@mohansundaram.com -xp help@123 -o tls=yes -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -t $CONTACTEMAIL$
}


5.Update below entry on contacts.cfg file.

root#vi /usr/local/nagios/etc/objects/contacts.cfg

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           ITHELPDESK@mohansundaram.com  ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS *****

service_notification_period             24x7
host_notification_period        24x7
        service_notification_options            w,u,c,r,f,s
        service_notification_commands           notify-service-by-email
        host_notification_period                24x7
        host_notification_options               d,u,r,f,s
        host_notification_commands              notify-host-by-email
        }


define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }


6. Restart your Nagios service.

root# /etc/init.d/nagios restart
Your done. Nagios will now send alert notifcations via your external SMTP server.


How to Change Nagios Default Context Path

Nagios Default Context Path Change Steps

If you want change nasios default /nagios context path to new context path.

**Marked Red color New context path

root#vi /etc/httpd/conf.d/nagios.conf

Alias /mohantool/ /usr/local/nagios/share/
Alias /mohanadmin/ /usr/local/nagios/eznag/php/mmi/

root#vi /usr/local/nagios/etc/cgi.cfg

url_html_path=/mohantool

[root@eznag conf]# /usr/sbin/apachectl stop

[root@eznag conf]# /usr/sbin/apachectl start

After that try below URL on any browser.

http://172.0.0.1/mohantool/   --> Nagios Main Page

http://172.0.0.1/mohanadmin/   --> Nagios Admin Page




How To Change Timezone IST on a CentOS 6 and 7

Change Timezone  IST and Update NTP Time 

on a CentOS 6 and 7

Step: 1

First login CentOS Linux putty session.

Step: 2

Run NTP update command using NTP Server or Google Server.

[root@eznag objects]# ntpdate 192.168.100.11
22 May 11:06:26 ntpdate[7057]: the NTP socket is in use, exiting

Step: 3

You willl see NTP Socket is in use Error. Run below commands.

[root@eznag objects]# service ntpd stop
Shutting down ntpd:                                        [  OK  ]

Step: 4

NTP Command. Time updated successfully.

[root@eznag objects]# ntpdate 192.168.100.11
22 May 11:07:34 ntpdate[7096]: step time server 192.168.100.11 offset 51.408174 sec

Step:5

If you want change IST time/date format,Try below commands.

[root@eznag objects]# ln -sf /usr/share/zoneinfo/Asia/Calcutta /etc/localtime
[root@eznag objects]# date
Sun May 22 20:40:29 IST 2016






Wednesday, July 20, 2016

Microsoft SQL Server Databases Stuck in Restoring State

Microsoft SQL Server Databases Stuck in Restoring State


Overview

The RESTORE ... WITH RECOVERY option puts the database into a usable state, so users can access a restored database. 


This is likely caused by the restore script adding the WITH NO RECOVERY parameter to make the database ready for a transaction log apply after the restore. The database is now waiting for the latest transaction log file.
You can either:
  1. Apply the latest transaction log (Using RESTORE LOG... WITH RECOVERY)... or
  2. Restore the database again, but this time using WITH RECOVERY ... or
  3. Force the database out of restoring mode by executing: RESTORE DATABASE YourDb WITH RECOVERY
Before you do this, please make sure you understand the implications of these options. You may cause data loss if you are not careful.

Run below commands in SQL Query windows

RESTORE DATABASE AdventureWorks WITH RECOVERY

Optional more Recovery commands:-
Restore full backup WITH RECOVERY
RESTORE DATABASE AdventureWorks FROM DISK = 'C:\AdventureWorks.BAK'
WITH RECOVERY
GO


Recover a database that is in the "restoring" state


RESTORE DATABASE AdventureWorks WITH RECOVERY
GO


Restore multiple backups using WITH RECOVERY for last backup


RESTORE DATABASE AdventureWorks FROM DISK = 'C:\AdventureWorks.BAK'
WITH NORECOVERY
GO
RESTORE LOG AdventureWorks FROM DISK = 'C:\AdventureWorks.TRN'
WITH RECOVERY
GO


Thursday, March 24, 2016

How to Reduce File System Size on Linux

How to Reduce File System Size on Linux


Before starting, it is always good to backup the data, if something goes wrong. Easily restore from backup.

To Reduce a logical volume / file system there are 5 steps needed to be done very carefully.
While extending a volume we can extend it while the volume under mount status (online) but for reduce we must need to unmount the file system before reducing.

Fallow the below 5 steps


  • unmount the file system for reducing.
  • Check the file system after unmount.
  • Reduce the file system.
  • Reduce the Logical Volume size than Current size.
  • Recheck the file system for error.
  • Remount the file-system back to stage.


Step 1:

mohan@root# lvs

  LV      VG           Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_home vg_test01 -wi-ao 431.79g
  lv_root vg_test01 -wi-ao  50.00g
  lv_swap vg_test01 -wi-ao  17.72g

mohan@root# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_test01-lv_root
                       50G  4.9G   42G  11% /
tmpfs                 7.8G   88K  7.8G   1% /dev/shm
/dev/sda1             485M   35M  425M   8% /boot
/dev/mapper/vg_test01-lv_home
                      426G  199M  404G   1% /home

mohan@root# umount -v /home
/dev/mapper/vg_test01-lv_home umounted

Step 2:

mohan@root# e2fsck -ff /dev/mapper/vg_test01-lv_home
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg_test01-lv_home: 11/28303360 files (0.0% non-contiguous), 1827094/113190912 blocks

Step 3:

mohan@root# resize2fs /dev/mapper/vg_test01-lv_home 250G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_test01-lv_home to 65536000 (4k) blocks.
The filesystem on /dev/mapper/vg_test01-lv_home is now 65536000 blocks long.


Step 4:

mohan@root# lvreduce -L -250G /dev/mapper/vg_test01-lv_home
  WARNING: Reducing active logical volume to 181.79 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Reducing logical volume lv_home to 181.79 GiB
  Logical volume lv_home successfully resized

Step 5


mohan@root# mount /home (or) mount -f /home
mohan@root# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_test01-lv_root
                       50G  4.9G   42G  11% /
tmpfs                 7.8G   88K  7.8G   1% /dev/shm
/dev/sda1             485M   35M  425M   8% /boot
/dev/mapper/vg_test01-lv_home
                       50G  4.9G   42G  11% /home


Successfully reduced /home file system size.



Sunday, March 20, 2016

Cisco Network Time Protocol (NTP) and Change Time format to Indian Standard (IST)


Cisco Network Time Protocol (NTP) and Change Time format to IST Indian Standard

NTP (Network Time Protocol) is used to allow network devices to synchronize their clocks with a central source clock. For network devices like routers, switches or firewalls this is very important because we want to make sure that logging information and time stamps have the accurate time and date.

MOHAN-SUNDARAM#show clock
*14:09:12.784 UTC Sun Mar 18 2016 --> Incorrect timezone.

How to Change Time / Date format to IST Indian Standard, Try below commands

MECT-D-Block-SW#conf t
Enter configuration commands, one per line.  End with CNTL/Z.

MECT-D-Block-SW(config)#clock timezone UTC +5 30

MOHAN-SUNDARAM(config)#do show clock
*15:12:59.784 UTC Sun Mar 20 2016

How to Configure Cisco Switch / Firewall  NTP Server:-

MOHAN-SUNDARAM(config)#do show clock
*15:12:59.784 UTC Sun Mar 20 2016  -->  Still showing incorrect time and Clock unsynchronized.

MOHAN-SUNDARAM#show ntp status
Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**10
reference time is 00000000.00000000 (05:30:00.000 UTC Mon Jan 1 1900)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 50.12 msec, peer dispersion is 0.00 msec
loopfilter state is 'FSET' (Drift set from file), drift is 0.000000000 s/s
system poll interval is 8, never updated.

Try below step by step commands.

Step 1:

Use Google DNS Server.

MOHAN-SUNDARAM(config)#ip name-server 8.8.8.8

Step 2:

Synchronize using clock with the public NTP server.

MOHAN-SUNDARAM(config)#ntp server pool.ntp.org
Translating "pool.ntp.org"...domain server (8.8.8.8) [OK]


Above we see the show ntp associations command that tells us if our clock is synchronized or not. The ~ in front of the IP address tells us that we configured this server but we are not synchronized yet. You can see this because there is no * in front of the IP address and the “st” field (stratum) is currently 3.


Step 3:

MOHAN-SUNDARAM(config)#do show ntp associations

  address         ref clock       st   when   poll reach  delay  offset   disp
*~123.108.200.124 125.62.193.121   3      4     64     1 46.982   1.985 188.53
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured


Step 4:

MOHAN-SUNDARAM(config)#do show ntp status
Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**10
reference time is 00000000.00000000 (05:30:00.000 UTC Mon Jan 1 1900)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 50.12 msec, peer dispersion is 0.00 msec
loopfilter state is 'FSET' (Drift set from file), drift is 0.000000000 s/s
system poll interval is 8, never updated.


The router tells us that we are unsynchronized and that there is no reference clock.
we will just wait a couple of minutes and take a look at these commands again.


MOHAN-SUNDARAM(config)#do show ntp status

Clock is synchronized, stratum 4, reference is 123.108.200.124
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**10
reference time is DA994010.8C49BBE0 (20:58:16.548 UTC Sun Mar 20 2016)
clock offset is 1.9850 msec, root delay is 356.06 msec
root dispersion is 4047.21 msec, peer dispersion is 188.53 msec
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000000000 s/s
system poll interval is 64, last update was 28 sec ago.

Step 5:

NTP Server time updated successfully.

MOHAN-SUNDARAM#show clock detail
*14:39:41.930 UTC Sun Mar 20 2016
Time source is NTP