Sunday, September 9, 2012

Crontab Scripts Redirection


### Crontab scripts Redirection ###

Crontab Log: How to Log the Output of My Cron Script
$ crontab -e
59 23 * * * /home/john/bin/backup.sh > /home/john/logs/backup.log 2>&1

In the above:

> /home/john/logs/backup.log indicates that the standard output of the backup.sh script will be redirected to the backup.log file.
2>&1 indicates that the standard error (2>) is redirected to the same file descriptor that is pointed by standard output (&1).
So, both standard output and error will be redirected to /home/john/logs/backup.log

---
/opt/testscript1
"50 * * * * /opt/testscript1 > /var/log/testscript1.log 2> &1
FREQUENCY OF JOBS
Every 50th Minute of every hour
Redirecting both STDOUT and STDERR to /var/log/testscript1.log

---
/opt/testscript2
"50 * * * * /opt/testscript2 > /var/log/testscript2.log 2>&1
FREQUENCY OF JOBS
Every 50th Minute of every hour 

---
30 0 * * * /opt/test3
Every 30th Minute of 0th HOUR

---
15 */6 * * * /opt/test4 > /dev/null 2>&1
Every 15th Minute on every alternate 6 hours

---
5 1 * * 2 /opt/test4 
Every 5th Minute on every 1st Hour of Tuesday 

---
15 */4 * * * /opt/test5 2> /dev/null
Every 15th Minute on every alternate 4 hours

---
19 12 * * * /opt/test6 > /dev/null 2>&1
Every 19th Minute on every 12th Hour

---
5 1 * * * find /opt -mtime +7 -exec rm -f {} \;
Every 5th Minute on every 1st Hour
This script deletes the files older than 7 days in /opt folder

---
36 1 * * * find /opt -type d -empty -exec rmdir {} \;
Every 36th Minute on every 1st HOUR
This script deletes the directories created in /opt

---
45 */1 * * * /opt 2>&1
Every 45th Minute on every alternate Hour

---
45 */2 * * * /opt/test >> /var/test.log 2>&1
Every 45th Minute on every alternate 2 hours




Saturday, September 8, 2012

Cloud Computing Architecture Discussion


--- Overview of cloud Computing Architecture ---

After completing this session, you should be able to:
- Describe a cloud
- Describe the cloud delivery models
  private, public, hybrid
- Discuss the pros and cons for each delivery model
- Describe the business and the IT organizational changes required when implementing a cloud
- Describe the functional components required within a Cloud
- Use Cloud terminilogy

cloud delivery models

- What is Cloud Computing ?
 Ametaphor for the internet
 NIST(national institute of standard and technology) definition: Cloud computing is a model for enabling ubiquitous,convenient, on demand network access to a shared
pool of configurable computing resources that can be rapidly provisioned and released with minimal management effort or
service provider interaction

Scaling up and scaling down of the resources as needed

Cloud is an emerging consumption and deliver model for many IT-based services, in which the user only use the service, and no need to know anything about the technology or implementation

visibility ---> control ---> automation
service oriented and service managed

key attibutes
- Self service
- Standardzation
- Advanced Virtualization
- underlined automation
- Elastic scaling
- Rapid provisioing

NOTE:
Enhance your learning opportunity by putting into practise what you learn

-- Cloud Computing improves service management --
IT Service Management is about providing Visibility, Control and Automation

- visibility to repond faster and make better decisions, delivering improved visibility into the performance and availability of services that span heterogeneous and virtual environments
­- Control to manage risk compliance and shared costs, providing security management across shared infrastructures and applications. Also helps you monitor shared resources usage and cost in a virtualized environment
- Automation to lower costs and build agility into your operations, enabling you to leverage automation to address the operational complexities associated with managing virtual resources

  "Service Management is to cloud as electricity is to computing"

--- A Service driven model ---
- cloud computing provides service delivery for consumer and business needs in a simplified way
- Hardware and platform-level resources are provided as services on an on-demand basis

--- Common Attributes of Clouds ---
Enhanced user experience
Elastic scaling
Automated provisioning
Highly virtualized
Flexible Pricing

IT Customers
Ability to elastically scale resources and maintain high quality of service

IT Analysts
Ability to elastically scale resources at significantly lower incremental management cost

End Users
Anywhere access to applications through a simplified user interface

Financial Analysts
Rapid time to market for new services
Anywhere access to applications through a simplified user interface

Market point of view
Public cloud vendors
Amazon
Google
Microsoft
Salesforce.com

Private cloud vendors
IBM
VMware
Sun/Oracle

--- Evolution of Cloud Computing ---
Grid Computing
- Solving large problems with parallel computing

Utility Computing
- Offering computing resources as a mettered service

Software as a Service
- Network based subscriptions to applications

Cloud Computing
- Anytime, anywhere access to IT resources delivered dynamically as a service


--- Different Types of Services ---
- Infrastructure Services
Virtual Client services
File system services
UNIX services
x86 services
Network services
storage services

- Platform services

Portal services
JEE Services
LAMP services
Job scheduling services

Business process platform services
Database services
Information lifecycle management services

-Software services [ process, Application, Information ]
Business Intelligence services
Collaboration services
ERP application services
CRM services
Content management services

Cloud [ Service Catalog, Cloud Administrator, Datacenter Infrastructure ]


Programming and standardized interfaces
- HADOOP - Map Reduce (parallel processing on huge amount of data to decrease the latency...improve the performance )
- Service Oriented Architecute (SOA)
- REST (XML)
- SOAP

Why Cloud Computing ?
--- Helps reduce or eliminate certain issues ---
- Lost Business opportunities because IT too slow to react
- Long deployment timelines for new systems (weeks/months+)
- Many people involved in the process creating high cost & complexity
- Many steps are manual and prone to error
- Huge up front investment for new infrastructure when you want to start small
- Server Sprawl
- Low Utilization
- Compliance, auditing and security patching costly
- Don't know what compute resources are used or how much they cost

--- Cloud Computing Business Value ---
- Provides creative ways for companies to address how they utilize IT
- Reduces capital expenses and operational costs
- Makes IT applications and infrastructure dynamically available
- Provides rapid service delivery
- Provides ability to test new plans with little delay

--- Business impact when using a Cloud ---
- Companies are improving their overall IT quality
- Substantial savings
      Power, operations, hardware purchase
      Avoids the cost impact associated with over-provisioning and under provisioning
- New opportunities
      - Investment to support a new product is noticeably reduced
- Faster Start-up
      Time between approval of a project and the start of work is shorter



--- Cloud Computing technological value ---
TECHNOLOGY CAPABILITIES
- Heritage of Grid Computing
- Resource Capacity
- Virtualized pool of resources
- Automation
- Self service Provisioing
- Scalability...agility
- Multi-tenancy

VALUE
- Accelerate the deployment of new applications by serving computing resources for the enterprise's core business
- Gain flexibility to meet changes in computing resource demands

POTENTIAL
strong network management and high bandwidth needed
performance of applications
Compliance with regulations for data stored in the cloud

--- What does Cloud Computing change for the End User ---
- Provides Self-Service Portal
- Enables the end user to :
      - Deploy a complete software stack without any intervention of an IT administrator
      - Reduce cost
            - Pay per use model for the end user
- Have more flexibility in usage of IT resources
- Access their data from any terminal and wherever they are
      - Mobility
Self Service Portal

Similar to Banking ATM's and Retail Point of Sale. Cloud is Driven by:
Self Service
Technology Advancement

--- What does Cloud Computing change for the Provider ---
- Cloud Providers have to:
      - Reduce cost with the consolidation of their IT infrastructure
      - Virtualize and Optimize the infrastructure
      - Put in place strong automation and provisioing solution
      - Enhance efficiency with a highly available solution and a rapid network access
      - Manage data and security/resiliency while being complaint with regulations
- Provider Types
      - Infrastructure Provider
      - Platform Provider
      - Business Services or application Provider

One of the biggest challenges facing today's Cloud computing provider is reducing the time to market !

--- What does Cloud Computing change for the Administrator ---
Advantages
- Reduce errors and mistakes when using pre-built images
- Save time with the self service portal available to the end user
- Reduce cost and operations associated with IT Labor

Inhibitors
- Implementing a strong automation between systems and applications
- Configuring a highly virtualized infrastructure
- Ensure the security and the resiliency of the end to end cloud computing architecture

--- Pros and Cons for moving onto a cloud model ---
-Pros:
- Scalability
- Cost
- Flexibility
- Agility
- Elasticity

-Cons
- Security
- Lack of control
- Standardization

--- Private Cloud architecture ---
A Private Cloud is a Cloud computing infrastructure created by an organization for its own internal use, rather than using someone else's infrastructure

--- Public Cloud architecture ---
- Based on a standard Cloud computing model
- Resources are available to the general public
- Services may be free or offered on a pay-per-usage model

--- Hybrid Cloud architecture ---
- Composition of at least one Private Cloud and at least one Public Cloud
- Safe connections are needed between private and public Clouds

Private cloud <----------------------> Public Cloud
                        Safe connection

--- Pros and Cons for each architecture model ---
- Private Cloud benefits:
      - Fewer security concerns
      - IT organization retains control over data center
- Private Cloud risks:
      - High investment hurdle in Private Cloud implementation
      - New operational processes are required
- Public Cloud benefits
      - Low investment
      - Good tes/development environment for applications
- Public Cloud risks:
      - Security concerns
      - IT organization may react negatively to loss of control over data-center function
- Hybrid Cloud benefits
      - operational flexibility
      - Scalability
- Hybrid Cloud risks
      - Hybrid Clouds are still being developed
      - Control of security between private and Public Clouds



--- Cloud Computing solution components ---
A cloud computing solution is the end-to-end integration of components, each bringing a specific value to the whole


Service Catalog ---> Self Service portal ---> service Request ---> service Provisioing ---> Optimized Infrastructure ---> Charge Back ---> Self-service Portal

service catalog && self service portal
- User/IT self service
      improving customer satisfaction and responsivenes
- Standardized delivery models
      Utilize service catalog of standard components

service Request
- Capacity Management
      Reservation with connection to platform configuration
- Controlled Anticipation
      Validated change requests with automated approval work flow process

Service Provisioning
- Low or No touch deployment
      drive down operational costs and manage thru full life cycle
- Deploy new systems easier
      shorter leads times, quicker to market, agility, competitive advantage

Optimized Infrastructure
- Improve server & power utilization
      cost avodiance on new hardware, energy & cooling costs
- Consistency of configuration
      driving compliance, easier support & auditing consistent security

--- Service Catalog ---
service catalog, self service portal, service Request, Service Provisioning, Optimized Infrastructure, Charge-Back

- All offerings that the Cloud can provide in a standard way but customizable through parameters
- End-user will be offered a means (command/GUI) to consume what is represented by service catalog entries
      - Service Creation
      - Service Modification
      - Service Termination
- Entries in the service catalog are reflected in a service template
      - Service topology to offer
      - Service instance process creation details
      - Associated management functions
- Service is defined by technicial artifacts
      - Virtual image with contained operating system, middleware and software, associated VM definitions etc




--- User Self-Service Portal ---
Service catalog, Self-Service Portal, Service Request, Service Provisioning, Optimized Infrastructure, Charge-back

- Accessing the offerings in the self-service interface
- Approvals and notifications
- Creating a project and adding virtual servers
- Canceling a project
- Modifying project
- Modifying server
- Backing up and restoring server images

- Managing Image Library
- Managing Users
- Viewing requests
- Viewing the details of a submitted request
- viewing and managing requests for approval
- viewing and managing servers
- User roles

--- Service Request Management ---
- All aspects in between user actions on the portal and service
deployment with provisioning
      - Business workflows between cloud users like approval
      - Mail integration to disseminate information and transaction lists identifying services being requested
      - Capacity planning and reservation
      - Change Management allowing re-configuration of the deployed service

--- Provisioning ---
- Provisioning is one of the key processes that accelerated the emergence of Cloud
- Automation of pre-defined scenarios to insure their repetive, efficient and reliable execution
      - Execution steps described in provisioning workflows
      - Provisioning runtime monitoring workflow execution to proper completion or stable recovery stage
- Goal is to keep workflow tasks as generic and platform independent as possible, relying on specific managed-through mechanisms
      - To implement workflow steps on specific platforms
      - To leverage existing tools and skills
      - To integrate provisioning with future service production
      - To limit the number of workflows to be developed and mantained
- Provisioning used in Cloud Computing as well as runtime automation in data-centers

Service Catalog -> Self-service Portal -> Service Request -> Service Provisioning -> Optimized infrastructure -> Charge-Back -> Self Service Portal


--- Optimized Infrastructure ---
Cloud Computing provides a means to manage large numbers of highly virtualized resources and control the delivery of services on these

- An optimized infrastructure for Cloud
      - Scalable
      - Available
Therefore it has to be:
      - Virtualized
      - Managed
So all the infrastucture components (servers,storage and networks) can be automatically defined and deployed

--- Charge-Back ---
- Chargeback is the component which supports the pay per use functions
      - Based on metrics provided by the optimized infrastructure
      - establishes a cost for delivered services
      - Charges are generally based on what the user uses
            - CPU, Memory, Storage
            - metrics which could be linked to a specific workload
            - metrics which can be specific to a customer environment
- Charge-back model agreement between Cloud Provider and Cloud Consumer


--- Architecture Model for Cloud Computing ---

- Service Request & Operations
      End User Requests & Operations
      Service Catalog Request UI Operational UI

- IT Infrastructure & Application Provider
      Access Services
      Datacenter Infrastructure
      Service Catalog Component Library
      Cloud Administrator
      Service Management - Various Functions comes under the umbrella
      Service Oriented Architecture
      Infrastructure Architecture
      virtualized Infrastructure
- Service Creation
      Service Designers
      Design and Build
      Service Integration
      Image

     

--- Service Management ---
User Request Management/Self Service Portal
Service Automation Management
Image Lifecycle Management
Provisioning
Performance Management
Usage Accounting - Very important for the Charge Back function
License Management
security,Integrity,Compliance

Service Oriented Architecture && Information Architecture
Optimize middleware
Image deployment
Integrity Security
workload management
high availability
Virtualized Infrastructure


--- Management aspects in cloud architecture ---
1. Service Automation Management
2. Image lifecycle Management
3. Usage and Accounting Management
4. Virtualized Resource Management
5. Security
6. Energy Efficiency
--- Expanding Role of Virtualization ---
- Physical consolidation
      Better hardware utilization
      Improved IT agility
      Lower power consumption
- Abstraction and pooling
      Improved resource optimization
      Simplified HA solutions
      Better software investment protection
      Ready-to-run packaged software
- Integration and Simplification
      Highly Virtualized Data Center
      Decouple completely from scale
      Integrated autonomic mgmt
      Dynamic energy optimization
      Data center security foundation

--- Image Management ---
- Why are virtual images important ?
Easy way to boot store, copy, backup, share OSes and applications running on hypervisors
New and emerging way to distribute software
(OS, Application & Middleware )
Installation as simple as a copy operations (Configuration still needed )
Images e.g. Virtual appliances can solve installation problems
Cloud computing paradigm uses images as base installation object

- Virtual Images create new IT challenges
Images lock in hardware/cloud platform affinity
Managing virtual images just like physical images would increase complexity & cost

- Image Management Tasks
Manage image lifecycle
Design -> Build -> store/Maintain -> Deploy -> Manage
Manage Image Library
Image repository access, organization, maintenance

--- Lifecycle of a virtual image ---
Design, Build, Store, Deploy, Manage

--- Metering/Accounting ---
Service Usage Metering
What can be metered ?
- Creation/termination of a cloud service instance e.g. duration
- Assignment of resources to a cloud service instance over a given period of time
- Capacity changes to resources assigned to an cloud service instance
- Metered by Management infrastructure

Resource Usage Metering
- Resource Utilization
      e.g. CPU usage, Memory Usage
- Resource consumption
      e.g. on a per user, per transaction base

- Accounting: What should be metered ?
Definition of an Accounting Model
Business Metris
      which entities should a consumer be billed for ?
            GB per day
      What defies price and/or cost ?
            Number of disks, servers, SW license
Relationship of Business Metris to IT Metris
      What can be collected with reasonable effort
            - Number of GB assigned, Number of GB used
            - Frequency (every hour, every 24 hour )
      And be mapped to Business metric
Define a cost and/or price (rates) for above entities
      - GB allocated by per day
      - GB used per day

Define Accounting Structure
      Assign Usage to Application, to Organization, to Services/Subscriptions

Security in cloud Computing
- Authentication and role-based access control
      - Federated identity including single sign-on
- Isolation Management
      - Server, Storage and Network
- Security for Image Management
      - security Metadata, Access Control, Authorization
- Integrity Management
      - Virtual Image integrity
- Risk and Compliance
      - Auditing and Configuration Management
      - Enterprise-level Regulatory Compliance
- Policy Management
- Threat Management

--- Definition of a Self Service Portal ---

USER    < ======  >    Cloud service

Self Service Portal
Request
Modify
Monitor
Share
Access
Delete

user_type1 user_type2 user_type3  (Web Browser)
Self Service Portal
Pool of Resources

Cloud admin, Team admin, Team User
--- Cloud Capability Overview ---
- Request Cloud Services
      - Service Catalog of offerings from which the consumer can choose
      - Process workflows to automate approval steps
      - Role-based security authentication and authorization
      - instantiate cloud services
      - Modify existing deployments by adding capacity, remove virtual servers or cancel a deployment

- Deploy Cloud Services
      - Automated resource provisioning
      - Storage Provisioning
      - Bare Metal OS provisioning
      - Capture and Deploy images
      - Install full SW stacks onto images
      - Create virtual machines VMware, AIX Lpars, WPars, zVM, Solaris Zones
      - Create platform services with Websphere and DB2
      - Compliance Maintenance such as management of software patches, version updates

- Manage Cloud Services
      - Deploy monitoring agents onto Cloud service components
      - Integrated OMDB for resource pool management
      - Integrate incident management, change, configuration and release management
      - Metering and Billing
      - Ability for administrators to customize and create new cloud service offerings
      - High Availability and Failover
      - Workload Management

--- Tivoli Service Automation Manager (TSAM) ---
- Integrated Management Solution for deploying & managing Cloud Services in a datacenter environment
      - Dynamic instantiation and management of cloud services along their entire lifecycle
      - Automation based on build & management plans including humans and management components
      - Enables users to request, deploy, monitor and manage cloud computing services

      - Raises the level of abstraction for Service Management in data centers from single LPARs, storage volumes, SW installations to Cloud Services as the units of management

--- Good points ----
Automating the end-to-end provisioning process
provisioning automation , network resources

Reference : https://www.opengroup.org/cloudcomputing

Generally accepted best practices when starting a cloud transformation
- Make your own experience with Cloud
- Associate the business needs to the experience
- Leverage Cloud infrastructure internally
      - Hardware and server workload abstraction is key
- Build your own cloud and grow it

What workloads are we seeing move to Cloud delivery ?
- Single virtual appliance workloads
- Test and pre-production systems
- Mature packaged offerings, like e-mail and collaboration
- Software development environments
- Batch processing jobs with limited security requirements
- Isolated workloads where latency between components is not an issue
- Storage solutions/Backup & Restore as a service
- Some date intensive workloads if the provider has a cloud storage offerings tied to the cloud compute offering


Implementation
- Easy to access, easy to use Service Request Catalog
- Hides underlying complex infrastructure from user and shifts focus to services provided
- Enables the ability to provide standardized and lower cost services
- Facilitates a granular level of services metering and billing
- Eases complexity due to workload standardization


Six step approach to adopting Cloud computing
1. Start with a transformation roadmap
2. Adopt the architectural model for cloud computing
3. conduct detailed workload analysis
4. Decide the Right mix for your enterprise
5. Back it up with a detailed ROI analysis
6. Proceed to implementation



      Infrastructure-as-a-Service
The capability provided to the consumer is to rent processing, storage, networks, and other fundamental computing resources where the consumer is able to deploy and run arbitrary software, which can include operating systems and applications. The consumer does not manage or control the underlying cloud infrastructure but has control over operating systems, storage, deployed applications, and possibly select networking components (e.g., firewalls, load balancers).

      Platform-as-a-Service
The capability provided to the consumer is to deploy onto the cloud infrastructure consumer-created applications using programming languages and tools supported by the provider (e.g., java, python, .Net). The consumer does not manage or control the underlying cloud infrastructure, network, servers, operating systems, or storage, but the consumer has control over the deployed applications and possibly application hosting environment configurations.

      Software-as-a-Service
The capability provided to the consumer is to use the provider's applications running on a cloud infrastructure and accessible from various client devices through a thin client interface such as a Web browser (e.g., web-based email). The consumer does not manage or control the underlying cloud infrastructure, network, servers, operating systems, storage, or even individual application capabilities, with the possible exception of limited user-specific application configuration settings.
Software-as-a-Service is also referred to as Applications-as-a-Service since SaaS is essentially about providing applications as a service (vs. software in general). This also includes content services (e.g. video-on-demand) and higher value network services (e.g. VoIP) as typically encountered in communication service provider scenarios.

      Business-Process-as-a-Service
Business process services are any business process (horizontal or vertical) delivered through the Cloud service model (Multi-tenant, self-service provisioning, elastic scaling and usage metering or pricing) via the Internet with access via Web-centric interfaces and exploiting Web-oriented cloud architecture. The BPaaS provider is responsible for the related business function(s).
Examples are processes for employee benefit management, business travel, procurement or also IT-centric processes such as software testing (where the entire testing process including testing staff is provided as an externally hosted cloud service).






Here are 5 steps that need to be taken to ensure a more systemic approach when integrating to cloud-based service providers.
Extend your SOA strategy to the Cloud. Review your current SOA strategy and extend this to accommodate cloud based as-a-service providers.
Extend Governance around Cloud Services.   Review your existing IT governance and SOA governance processes to accommodate the introduction and adoption of cloud based as-a-service providers.
Identify Cloud based Integration models. It is not a one-size fits all. Therefore multiple integration models could apply to the cloud-based service provider depending upon the enterprise integration architecture. These integration models include a) point-to-point solutions, b) cloud to on-premise ESB and c) cloud based connectors that adopt a service centric approach to integrate cloud providers to enterprise applications and/or other cloud providers.
Apply right models for right scenarios. Review the scenarios involved and apply the right models to the right scenarios.
Sustain and evolve your services taxonomy. Provide enterprise-wide visibility to the taxonomy of services – both on-premise and those identified for integration with the cloud-based service providers. Continuously evolve these services to integrate to a rationalized set of providers who cater to the integration needs of the enterprise in the cloud.

IT is headed towards a technology agnostic, service-based applications and infrastructure environment, consumed when needed, with usage-based chargeback models in place for elastic resources. A forward thinking tweet would have simply said – IT is headed for the Cloud


What started as SOA has evolved into the Cloud.  Here are five tell-tale signs:
As-a-service model:  Application interfaces being exposed as services in a standardized fashion were the technical foundation to SOA. This concept was slowly but steadily extended to the infrastructure environment leading to IaaS and eventually, [pick a letter of your choice]aaS. Infrastructure components, provisioned as services, had to be taken into account as part of the overall SOA strategy. Given the vital role of IaaS within the Cloud, a holistic SOA enterprise-wide SOA strategy is essential for successful Cloud deployment.
Location transparency: Prior to service orientation, applications had to be aware of the logistics of information sources. Service orientation introduced location transparency so that the specifics of the physical location where the services were executed did not matter as much. Extending this paradigm, Cloud leverages the available resources as and when needed for execution of the services provided.
Virtualization: Service orientation acted as a catalyst for virtualization of application interfaces wherein the standardization of the interfaces was given more importance than the actual execution of the services. Virtualization was extended to infrastructure components facilitating their rapid provisioning as long as it met the experience expectations of the consumers.
Hardware: IaaS provisioning based on virtualization along with the partitioning of existing physical hardware into logically consumable segments resulted in hardware being shared across multiple applications. Cloud extends this notion into a pool of hardware resources being shared across multiple applications.
Chargeback: SOA was initially focused on service implementation after which the focus shifted to SOA Governance and SOA Management including the tracking of metrics and chargeback mechanism. Cloud is following a similar model, which is why the challenges of metering and chargeback mechanisms that IT is dealing with in the Cloud are fundamentally similar to monitoring service consumption across the enterprise.