Wednesday, 18 May 2016

PERL example for opening EXCEL sheet using WIN32:OLE

# This PERL file will open one EXCEL, create 4 WORK Sheets, in first
# WORKSheet make table with borders and few values

use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;                                # die on errors...
my $Excelfile = Win32::OLE->GetActiveObject('Excel.Application')
                || Win32::OLE->new('Excel.Application', 'Quit'); 
$Excelfile->{DisplayAlerts} = 0;
$Excelfile->{ScreenUpdating} = 0;

$workbook = $Excelfile->Workbooks->Add();

for ($j=1;$j<=4;$j++)
    $worksheet = $workbook->WorkSheets->Add({after => $workbook->WorkSheets($workbook->WorkSheets->{COUNT})});
my $cur_dir = `cd`;
$TargetFile = $cur_dir."\\Excel_Test_File.xls";
print "Result file name is $TargetFile \n";

#Select first sheet and write values


$current_row = 3;
$current_col = 2;

#for ($k=0;$k<3;$k++)
#    $worksheet->Cells($current_row,$current_col)->Font->{FontStyle}="Bold";
#    $worksheet->Cells($current_row,$current_col)->Interior->{ColorIndex} =24;
#    $worksheet->Columns($current_col)->{ColumnWidth}=20;
#    $current_col++;

### Another way of formatting if we are using fixed columns

$worksheet->Range("B$current_row:D$current_row")->Interior->{ColorIndex} =24;
$worksheet ->Range("B$current_row:D$current_row") ->{ColumnWidth} = 20;

$worksheet->Cells($current_row, $current_col)->{'Value'} = "S.No";
$worksheet->Cells($current_row, $current_col+1)->{'Value'} = "Name";
$worksheet->Cells($current_row, $current_col+2)->{'Value'} = "Department";
$worksheet->Cells($current_row, $current_col+2)->{'Value'} = "Work_type";


for ($i=1;$i<=10 ;$i++) {

    $worksheet->Cells($current_row, $current_col)->{'Value'} =$i;
    $worksheet->Cells($current_row, $current_col+1)->{'Value'} = "Name_".$i;
    $worksheet->Cells($current_row, $current_col+2)->{'Value'} = "Colour";

    #### Keep border for excel if it is last line.

    $worksheet->Range("B$start_row_forborder:D$last_row")->{HorizontalAlignment} = xlHAlignRight;
    $worksheet->Range("B$start_row_forborder:D$last_row")->{Borders}->{Weight} = xlThin;

#Deleting Default SHEETS
$worksheet = $workbook->Worksheets("Sheet1")->Delete();
$worksheet = $workbook->Worksheets("Sheet2")->Delete();
$worksheet = $workbook->Worksheets("Sheet3")->Delete();



Monday, 9 May 2016

Syntax error in /sysroot/etc/selinux/config : 6 : syntax error ";" unexpected failed to boot sleeping forever.

We got this issue in one of the Linux PC, by mistake in the config file of SELinux instead of using # for commenting ";" was used. After reboot the PC won't boot with below messages:


/sysroot/etc/selinux/config : 10 : syntex error: ";" unexpected
Signal caught!
Boot has failed, sleeping forever.

We can access GRUB command line but Single mode bootup doesnt work. the only way to recover was to use Live CD, go to rescue mode. Give below command in shell:

chroot /mnt/sysimage
cd etc/selinux
vim config

Modify the statement and save and reboot.

And it worked....

Keep Working , Keep Trying !!

Friday, 22 April 2016

Windows "Netsh" command to change Interface Dynamic to Static IP address

netsh interface ip set address name="Local Area Connection" source=static

netsh interface ip set address name="Local Area Connection" source=dhcp

Monday, 29 February 2016

Convert SNMP MIBs into Excel Spreadsheets for analysis -MIB Parser tool


Parses multiple mibs into a single spreadsheet for analysis of mib variables and traps. Intended to be complimentary to Netcool/micromuse so one can analyze traps before creating rules.


In this we wanted to add allowed value range of MIB variables also.

One of my colleague has added this functionality, with her permission , sharing with all. As i think it can be useful for others as well.

Its raw script and is not properly formatted , but does the task properly. If someone wants to inform the original creator/user and can ask him/her to add it in original version will be great.

"The satisfaction of making out the best with whatever is handed to you by GOD, is much more valuable then anything else."

Keep Trying, Keep Improving!

SNMP Online MIB Validation tool

Below given RFC governs the structural compliance of the SNMP MIB's

RFC : 2578

Structure of Management Information Version 2 (SMIv2)

RFC :2579

Textual Conventions for SMIv2

RFC :2580

Conformance Statements for SMIv2

To validate if the SNMP MIB is compliant or not or till which level it is complaint, Simpleweb online MIB validation tool can be used.

Friday, 9 October 2015

Linux DHCP Server won't reply to DHCP clients in Routing mode to DHCP relayed clients

Problem  Description:

Setup :     ----           
Win DHCP Server 1 ---Linux DHCP Server 2------Linux DHCP relay -------Win XP DHCP client PC
                                               Routing mode             Routing mode

Config :

Win DHCP Server 1 : IP address

Linux DHCP Server 2 : , ( As its in routing mode)

Linux DHCP relay : ,

Win XP DHCP Client : Has to get IP from DHCP servers.

Config/ Observations 1:

1) DHCP server 1 is disabled, now only one server is present in the network.

2) In DHCP relay the DHCP server is mentioned as and client interface as

3) On DHCP server in the config file (dhcpd.conf) subnet is defined for network, make a note that this subnet is not part of the subnet on which server is runnning ( server is running on and

4) Start DHCP client on windows PC, the DHCP discover can be seen on Linux DHCP Server , but it is not replying to the discover.As i know, if the subnets configured are not of the same subnet as one of its interfaces the DHCP server will not reply. So this is expected behavior. ( Correct me if I am wrong , i am trying to find supporting links, will update on this also)

 Config/ Observations 2:

1) Now start Windows DHCP Server 2 and on DHCP relay configure the DHCP server as and  client interface as

2) Again run "ipconfig/release" and "ipconfig /renew" on the WIndows DHCP client PC.

3) On Linux PC forwarding is enabled and it is forwarding the "unicast DHCP DISCOVER"  packet to the Windows Server.

4) Now suddenly both Linux DHCP Server starts working and it start replying along with the Windows DHCP server. Both the servers are replying for the intended subnets ( , even though the DHCP discover packet is not intended for the Linux server.


The question is why the Linux server is replying now? As it is supposed to reply only to the connected interfaces IP subnets.

I am still trying to find answers, if you have any comments/ideas let me know in comments.

Keep Researching !

Tuesday, 28 July 2015

Command to generate multicast traffic using Iperf

Server Device:
Iperf –B –us

Client Device:
Iperf –B <ServerDeviceIP> -uc –b 10M –t 120

Related Posts Plugin for WordPress, Blogger...