Monday, February 12, 2018

மீயுட்சுவல் பண்டுகள்

மீயுட்சுவல் பண்டுகள் என்பவை பங்கு வர்த்தகத்தில் இருந்து சற்று வேறுபட்டது. பணத்தை பல பேரிடம் பெற்று அதை மார்கெட்டில் முதலீடு செய்வார்கள்.அதில் வரும் லாபம் முதலீடு செய்த அனைவருக்கும் சமமாக பிரித்துக்கொடுக்கப்படும். சந்தை உயர்வு தாழ்விற்கு ஏற்ப்ப நீங்கள் கொடுத்த பணம் ஏறவோ இறங்கவோ செய்யும். சுருக்கமாக சொல்லுவதென்றால் நேரடியாக நீங்கள் பங்கு சந்தையில் இறங்காமல் மீயுட்சுவல் பண்ட் நிறுவனத்திடம் உங்கள் பணத்தை ஒப்படைத்து அவர்களை நிறுவனம் செய்யும்படி கூறுகின்றீர்கள் என அர்த்தம். இதனால் உங்களுக்கு ரிஸ்க் குறையும். தற்போது நிறைய வகையான மீயுட்சுவல் பண்டுகள் வந்துவிட்டன.

உதாரணமாக ரூபாய் 5000க்கு SBI ONE India Fund மீயுட்சுவல் பண்டினை வாங்கினால்.அப்போதைய அந்த மீயுட்சுவல் பண்டின் நிகர சொத்து மதிப்பு( NAV ) ரூபாய் 20 எனில் உங்களுக்கு 250( 5000/20 ) அளவு என பண்டுகள் வழங்கப்படும். NAV ன் மதிப்பு 20 ரூபாயில் இருந்து உயர உயர உங்கள் பணமும் உயரும். ஒரு ஆண்டுகள் கழித்து NAV மதிப்பு 40 ரூபாய் எனில் 250x40=10000 ரூபாய் உங்களிடம்.

கவனிக்க NAV மதிப்பு 20 ரூபாய்க்கும் கீழ் சென்றுவிட்டால் நீங்கள் போட்ட பணம் குறைந்து கொண்டே செல்லும். NAV மதிப்பு பங்கு சந்தையை பொருத்து உயரலாம் அல்லது குறையலாம்.

ஆக மீயுட்சுவல் பண்ட் நிறுவனம் திறமையானதாக இருக்கும் பட்சத்தில் மற்றும் சந்தை உயர்வாக இருக்கும் பட்சத்தில் உங்கள் முதலீடுக்கு உத்திரவாதம் கண்டிப்பாக உண்டு.

மீயுட்சுவல் பண்டில் இரண்டு வகை உண்டு. அவை Open ended, Closed ended.
Open-end Fund
இந்த வகையில் நீங்கள் போட்ட பணத்தை எப்போது நீங்கள் விரும்புகின்றீர்களோ அப்போது எடுக்கலாம்.
Close-end Fund
இந்த வகையில் அவர்கள் கூறிய காலத்திற்கு( 3 ஆண்டுகள் என்க ) இடையே உங்கள் பணத்தை திரும்ப எடுக்க முடியாது.

லாபம் எப்படி பகிர்தளிக்கப்படுகின்றது. இதில் இரு வகை உள்ளது

DIVIDEND OPTION
இதில் கிடைக்கும் லாபம் பணம் போட்ட அனைவருக்கும் சமமாக பகிர்ந்தளிக்கப்படும். நீங்கள் எவ்வளவு அளவு பண்ட் வைத்திருக்கின்றீர்களோ அதுக்கேற்றார் போல் பகிர்ந்தளிக்கப்படும். உதாரணமாக 250x4(ஒரு பண்டுக்கு 4 ரூபாய் லாபம் என்க. ) = 1000 ரூபாய் லாபமாக கொடுத்துவிடுவார்கள். காசோலையாகவோ அல்லது உங்கள் பேங்க் கணக்கிலோ வரவு வைக்கப்படும். நீங்கள் போட்ட 5000 தொடர்ந்து முதலீடு செய்யப்படும்( நீங்களாக பண்ட்டை விற்காதவரை )

GROWTH OPTION
இந்த முறையில் கிடைத்த லாபம் மீண்டும் சந்தையில் முதலீடு செய்யப்படும். அதாவது உங்களிடம் உள்ள 250 பண்ட் + 1000 ரூபாய் லாபம் இப்படி மாற்றப்படும்,

1000/40(NAV) = 25 பண்ட் ஏற்கனவே உள்ள பண்ட் 250 + 25 பண்ட் = 275 பண்ட்ஸ். உங்களது லாபம் தற்போது பண்ட்டாக மாற்றப்பட்டு மீண்டும் சந்தையில் முதலீடு செய்யப்படும்.


ரிஸ்க் இல்லாத முதலீடு

ரிஸ்க் இல்லாத முதலீடு இல்லை என்றாலும், கடன் சார்ந்த மியூச்சுவல் ஃபண்ட் திட்டங்கள் ரிஸ்க் குறைவானவை என்பதோடு மிதமான வருமானம் தருபவை. இந்த வகை ஃபண்டுக்கு நல்லதொரு எடுத்துக்காட்டு ஜே.எம். ஜி - செக்யூரிட்டி ரெகுலர் . இந்த ஃபண்டின் மூலம் திரட்டப்படும் நிதி அரசாங்க கடன் பத்திரங்களில் முதலீடு செய்யப்படுவதால் ரிஸ்க் குறைவாக இருக்கும். இந்த ஃபண்ட் கடந்த ஐந்து ஆண்டுகளில் ஆண்டுக்கு சராசரியாக 9.40% வருமானத்தையும், ஆரம்பம் முதல் 10.24% வருமானத்தையும் தந்துள்ளது

Sunday, February 11, 2018

Websphere Connection Pool monitoring and Alerting System ( Connection Pool runtime information)

Many of the infrastructure monitoring tools brings their own JMX monitoring now a days to monitor all the JVM components including connection pool (DataSource) JMS etc.
But, If in case you wanted to set up your own alerting system (Email Notification etc.) for Connection pool.  You can use this  wsadmin script.

Design

-It will find all the running servers registered with DMGR (cell) and take a list of running connection pools targeted on those servers.
-It will automatically set 80 percent of the connection max_limit as a threshold.
-It will print a alert message, in case of possible connection pool overflow. When the current connection limit reaches the threshold.
  
If you do not want any alerting system and want to see the connection pool usage manually in case of requirement (or) on demand basis. You can just use this jython script with wsadmin. In case if you wanted to setup alerting system refer the additional notes for some ideas of designing the alerting system.

Additional notes

1    You can run this script in a frequent interval like 2 minutes (or) 10 minutes using the external shell script scheduled in crontab and get the alert generated. ( let me know in comment section if you need help) 
2    If you have Autosys, you can rather schedule it with JIL and run this in a periodic interval.
       After scheduling it to run on certain interval you can use any log parse monitoring tools like Tivoli and get alerts/tickets upon your infrastructure set up.

Version compatibility
was6.1 and above ( for was 6 there is little bit modification required, write a comment if you need)
wsadmin script


wsadmin script

import re
Running_JVMS
=AdminControl.queryNames("*:type=Server,*").split(java.lang.System.getProperty("line.separator"))
ignorelist
=['nodeagent','dmgr']
TMPFILE
='/tmp/PoolContents.tmp'
global current_conn
for JVM in Running_JVMS:
        ServerName
=AdminControl.invoke(JVM ,"getName()")
       
if ServerName not in ignorelist:
                DS
=AdminControl.queryNames('*:process='+ServerName+',type=DataSource,*').split(java.lang.System.getProperty("line.separator"))
               
for entry in DS:
                       
if AdminControl.invoke(entry, "getStatus()") != '99':
                               
print "============================================"
                               
print "ServerName    :", ServerName
                                DSN
=AdminControl.invoke(entry, "getName()")
                               
print "DataSourceName:", DSN
                                JNDN
=AdminControl.invoke(entry, "getJndiName()")
                               
print "JNDIName      :", JNDN
                                MaxConn
=AdminControl.invoke(entry, "getMaxConnections()")
                               
print "MaxConnections:", MaxConn
                               
print "StatusCode    :", AdminControl.invoke(entry, "getStatus()")
                               
##########################
                                fout
=open(TMPFILE, 'w')
                                data
=AdminControl.invoke(entry, "showPoolContents")
                                fout.write(data)
                                fout.close()
                                percent
=0.8
                                threshold
=int(MaxConn)*float(percent)
                               
print "Threshold     :", threshold
                                
try:
                                        fin
=open(TMPFILE)
                                        filedata
=fin.readlines()
                                       
for line in filedata:
                                               
#match 1= re.search(r':sd', line)
                                               
#matchstr=re.search(r'Total number of connection in shared pool', line)
                                                matchstr
=re.search('(.....s......s..s..........s..s......s....):(sd)', line)
                                               
if matchstr:
                                                       
#current_conn=match.group().split(":")[1].strip(" ")
                                                        current_conn
=matchstr.group(2)
                                                       
if int(current_conn) >= int(threshold):
                                                                ALERT
='YES'
                                                                ALERTSTRING
='Connection Pool %r reached 80 percent of its max_limit on Server %r'%(DSN,ServerName)
                                                               
print ALERTSTRING
                                                       
else:
                                                                ALERT
='NO'
                                                       
break

                                               
else:
                                                        current_conn
=0


                                        fin.close()
                                       
print "Currently used:", current_conn
                                       
print "============================================"
                               
except IOError:
                                       
print  'Something went Wrong.'


How to run

Save the above code with “.py” extension and run it with wsadmin.
In example
wsadmin.sh -lang jython -username <username> -password <password> -lang jython -f <saved py file name>


WAS – Get Running Server list with heap usage wsadmin

Objective:
This script will help you to print the “Running Server List” per everyNode registered under Cell(dmgr). With up time and heap usage

Compatibility: WAS6.1 and above

Script:
Running_Nodes=AdminControl.queryNames('*:type=Server,name=nodeagent,*').split(java.lang.System.getProperty("line.separator"))
print "Websphere Status Report  by Sarav@mwinventory.in"

print "CELLNAME: ", AdminControl.getCell()
print "HOST:     ", AdminControl.getHost()

ignorelist
=['dmgr','nodeagent']
for nod in Running_Nodes:
        NodeName
=AdminControl.invoke(nod ,"getNodeName()")
        Running_JVMS
=AdminControl.queryNames('*:type=Server,node='+NodeName+',*').split(java.lang.System.getProperty("line.separator"))
       
print "====================================================================="
       
print "NODENAME:",NodeName
       
print "====================================================================="
       
print "--------------------------------------------"
       
print "<< Running JVMs under the Node >>"
       
print "--------------------------------------------"
       
for Serv in Running_JVMS:
               
print  AdminControl.invoke(Serv,"getName()")
        
print "--------------------------------------------"

       
print ""
       
print ""
       
print "--------------------------------------------"
       
print "<< Server Runtime Information >>"
       
print "--------------------------------------------"

       
for JVM in Running_JVMS:
                ServerName
=AdminControl.invoke(JVM ,"getName()")
               
if ServerName not in ignorelist:
                        JVMName
=AdminControl.completeObjectName('type=JVM,process='+ServerName+',*')
                        JVMObject
=AdminControl.makeObjectName(JVMName)
                        perf
=AdminControl.completeObjectName('type=Perf,process='+ServerName+',*')
                        perfObject
=AdminControl.makeObjectName(perf)
                        Obj
=AdminControl.invoke_jmx(perfObject,"getStatsObject",[JVMObject,java.lang.Boolean('false')],['javax.management.ObjectName','java.lang.Boolean'])
                        current
=Obj.getStatistic('HeapSize').getCurrent()
                        used
=Obj.getStatistic('UsedMemory').getCount()
                        usage
=float(used)/float(current)*100
                        uptime
=float(Obj.getStatistic('UpTime').getCount())/60/60/24
               
print "--------------------------------------------"
               
print "ServerName      :", ServerName
               
print "uptime(in days) :", int(uptime)
               
print "--------------------------------------------"
               
print "CurrentUsage    :", current
               
print "Usedmemory      :", used
               
print "Usage in Percent:", int(usage)
               
print "--------------------------------------------"
print ""
print "====================================================================="


Result:

bash-3.00# ./wsadmin.sh -lang jython -username wsadmin -password wsadmin -f getHeapSizeV3.py
WASX7209I: Connected to process "dmgr" on node MWICellManager01 using SOAP connector;  The type of process is: DeploymentManager
Websphere Status Report  by Sarav@mwinventory.in

CELLNAME:  MWICell
HOST:      as1.mwi.com


=====================================================================
NODENAME:   MWINode01
=====================================================================
--------------------------------------------
<< Running JVMs under the Node >>
--------------------------------------------
MWI_SERVER01
MWI_SERVER02
nodeagent
--------------------------------------------

--------------------------------------------
<< Server Runtime Information >>
--------------------------------------------
ServerName      : MWI_SERVER01
uptime(in days) : 27
--------------------------------------------
CurrentUsage    : 122176
Usedmemory      : 87480
Usage in Percent: 71
--------------------------------------------
--------------------------------------------
ServerName      : MWI_SERVER02
uptime(in days) : 64
--------------------------------------------
CurrentUsage    : 483904
Usedmemory      : 412135
Usage in Percent: 85
--------------------------------------------

=====================================================================

=====================================================================
NODENAME:   MWINode02
=====================================================================
--------------------------------------------
<< Running JVMs under the Node >>
--------------------------------------------
MWI_SERVER03
MWI_SERVER04
nodeagent
--------------------------------------------

--------------------------------------------
<< Server Runtime Information >>
--------------------------------------------
ServerName      : MWI_SERVER03
uptime(in days) : 251
--------------------------------------------
CurrentUsage    : 58432
Usedmemory      : 50091
Usage in Percent: 85
--------------------------------------------
--------------------------------------------
ServerName      : MWI_SERVER04
uptime(in days) : 36
--------------------------------------------
CurrentUsage    : 120704
Usedmemory      : 101834
Usage in Percent: 84
--------------------------------------------

=====================================================================