Saturday, January 11, 2014

FreeBSD Service Management

How to start, stop, restart a service in FreeBSD

Syntax: 
# service name {start,stop,restart}

Stop sshd:
# service sshd stop

AND

# /etc/rc.d/sshd stop


Start sshd:
# service sshd start

AND

# /etc/rc.d/sshd start

Restart sshd:
# service sshd restart

AND

# /etc/rc.d/sshd restart


Yo can find out if a service is running or not with ps or /path/to/service status:

$ ps aux | grep ssh
OR: 
/etc/*.d/ssh status

 

 

Tuesday, January 7, 2014

Windows 2012 R2 : New Features

New Features for Windows 2012 R2

Storage transformation – Delivers breakthrough performance at a fraction of the cost
  • The storage tiering feature of Storage Spaces in Windows Server 2012 R2 automatically tiers data across hard disks and solid state drives based on usage to dramatically increase storage performance and cost efficiency.
Software defined networking – Provides new levels of agility and flexibility
  • Network virtualization in Windows Server 2012 R2, along with the management capabilities in System Center 2012 R2 provides the flexibility to place any virtual machine on any node regardless of IP address with isolation. 
  • New in-box gateway in Windows Server 2012 R2 extends virtual networks to provide full connectivity to physical networks as well as access to virtual networks over the internet.
Virtualization and live migration – Provides an integrated and high-performance virtualization platform
  • Cross-version live migration enables virtual machines running on Windows Server 2012 to be migrated to Windows Server 2012 R2 hosts with no downtime.
  • Live migration compression provides dramatic time savings (approximately 50% or greater) by using spare CPU cycles to compress live migration traffic with no special hardware.
  • Live migration with RDMA enables offloading of the process to the NICs (if they support RDMA) for even faster live migrations.
Access & Information Protection – Empowering your users to be productive while maintaining control and security of corporate information with Windows Server 2012 R2
  • Enable users to work on the device of their choice (through BYOD programs or on personal devices) by providing a simple registration process to make the devices known to IT and be taken into account as part of your conditional access policies
  • Deliver policy-based access control to corporate applications and data with consistent experiences across devices
  • Protect corporate information and mitigate risk by managing a single identity for each user across both on-premises and cloud-based applications and enabling multi-factor authentication for additional user validation
Java application monitoring – Enables deep application insight into Java applications.
  • Provides performance and exception events as well as level alerting within Operations Manager for Java applications.
  • Supports Tomcat, Java JDK, and other Java web services frameworks.
  • Line-of-code level traceability with performance and exception metrics for .NET and Java application monitoring for more actionable, tool-driven dev-ops collaboration

Monday, January 6, 2014

RHEL Overview



 
 

 
 
 
  • Red Hat Enterprise Linux has a lifecycle of at least ten years for major releases and typically has a new major release every two to three years.
  • A major release is a significant enhancement to RHEL, such as the base kernel version.  For example, RHEL 5 and RHEL 6 are separate major releases.
  • Major releases require a reinstall of the OS.  There is usually no supported upgrade path between major releases, unless Red Hat Global Support Services is involved.
  • A minor release consists of all the patches to a major release up to a certain point in time.  For example, RHEL 6.1 and RHEL 6.3.
  • Minor releases are just like applying patches, so no reinstall is required.
  • There are usually three supported Red Hat Enterprise Linux major releases available at any given time.
  • Red Hat publishes the lifecycle of each release so customers can plan their environment and plan upgrades.
  • Red Hat maintains stable interfaces within a major release.
  • Customers can standardize around a major release, comfortable that they will be able to add new systems and maintain a consistent environment.
  • Binary compatibility, defined with the Application Binary Interface (ABI), guarantees that a single compiled binary will work on multiple instances of RHEL that share the same architecture.
 
 
 
  Red Hat Logo

Sunday, January 5, 2014

How to trouble shoot - RHEL



If the trouble report is coming from a user, gather more data before getting into the troubleshooting phase:
  • Ask for specific error messages and/or output.
  • Ask how the user became aware of the problem when it first occurred.
  • Determine if the problem is ongoing or intermittent
  • Ask for detailed steps on how to reproduce the issue.
  • If unknown to you, ask the user what the expected outcome should have been.
  • What changes have been made recently?
  • If the issue is reported by a user, determine what they may have changed recently.
    • Review all recent changes in available change management logs, if they exist.
    • Review patch management systems to determine if the environment has been updated.
    • Check configuration file time stamps and run comparisons on configuration files related to the issue.
    • If time permits, contact anyone who has access to make changes to the environment to discover if undocumented changes have occurred.
  • In RHEL, the main log file is /var/log/messages, this would be the first log to start looking at.
    • Not all applications write entries into this log file, and not all log files are written in the /var/log directory.
    • You may have to look at the application documentation to determine the correct log file location.
      • Documentation for most packages is available in /usr/share/doc/[packagename] for most RHEL software.
      • Using the man command against the application can also show where log file locations are as well.
  • A quick way to determine which logs are being updated in /var/log is with the ls -ltr command which lists the files in a directory by time stamp, the last file listed being the latest.


 
# ls - ltr /var/log

  • To see kernel and hardware related events you can use the dmesg command.
    • This command will display kernel related events that have occurred recently.
    • The system only keeps a small amount of this data resident and will overwrite it as new events occur.
    • The /var/log/dmesg file contains a snapshot of dmesg output at boot time, useful for determining what may have happened to a system hardware wise when the system last started.
  • Kernel events should also show up in /var/log/messages, but are some times harder to find with all the other logging that goes in that file.
  • When dealing with log files, knowing how to parse them is extremely important.
  • The grep command is probably the most used command to find text in log files.
    • The command grep “httpd” /var/log/messages will return any line containing the string httpd in /var/log/messages.
    • Conversely, grep -v “httpd” /var/log/messages will return any line not containing the string httpd in /var/log/messages.
  • The grep command can also be used to parse output of commands:
 

# ps ax | grep init

 
  • More information on grep can be obtained in its man page, grep --help, or in /usr/share/doc/grep-*.
  • Multiple strings can be specified when using grep by using the -E flag and the pipe (|) character between search strings to specify the or operator:
 
# ps ax | grep -E "findSTRING1|findSTRING2|findSTRING3"
# ps ax | grep -Ev "ignorestring1|ignorestring2"
 
  • Multiple grep commands can be used, in this example; we return lines with findstring but ignore lines with ignorestring .
 
# ps ax | grep findstring|grep -v ignorestring


Table 1: Common grep Options
Option
Function
-i
Perform a case-insensitive search

-v
Exclude lines that contain the pattern

-c

Display a count of lines with the matching pattern

-l
Only list files names, do not display the matched lines

-n
Precede matched lines with line number
--color
Highlight the matched string

-A, -B
When followed by a number, thes options print that many lines after or before each match. This is useful for seeing the context in which a match appears within a file.

-r
Perform a recursive search of files starting with the named directory

  • The head and tail commands help limit the amount of data the system administrator has to go through to read files or parse command output.
  • The head -number command will show the first number lines of command output or of a text file.
 

# head -1 /etc/passwd
root:x:0:0:root:/root:/bin/bash

 
  • The tail -number command will show the last number lines of command output or of a text file.
 

# tail -2 /etc/passwd
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin




  • The tail -n +number command will show all of the lines of command output or of a text file after line number.
  • This is useful to remove a header line in command output:
# ps aux | tail -n +2root      1       0.0     00      19328   1412    ?       Ss      May04           0:02           /sbin/initroot 2       0.0     00      0       0       ?       Ss        May04          0:02           [kthreadd]root 3       0.0     00      0       0       ?        Ss      May04          0:02           [migration/0]      
 

  • To follow a text file as it gets updated in real time use tail -f (the short command tailf can be used as well):

 
# tail -f /var/log/messagesMay 6 18:53:47  nas01     smbd[14012]:  failed to retrieve printer list: NT-STATUS_UNSUCCES