Monday, 25 April 2016

Script to gather server information



Create a file called systeminfo.sh
# touch systeminfo.sh
 


#!/bin/bash
## Purpose: Collecting system Information Gather server information within a second
## Author Name: Sankar
## Date: 26th Apr 2016
MAILIST=sankarrhcss@gmail.com
DOMAIN=domain
TEMP=/tmp/temp
FILE=/tmp/asset/info.txt
USERID=`id -g`
if [ $USERID == 0 ]; then
echo "Script is Running ..."
else
echo "Please run the script using root user"
exit
fi
mkdir /tmp/asset
touch /tmp/temp
touch /tmp/asset/info.txt
echo -e "\n" > $FILE
echo "Collecting System Information" >> $FILE
echo -e "\n" >> $FILE
echo "collecting information...."
echo "Date: `date`" >> $FILE
echo "HostName: `hostname`" >> $FILE
echo "Installed OS Version: `cat /etc/issue |head -1`" >> $FILE
echo "`/sbin/ifconfig -a |grep "inet addr" | awk 'BEGIN { FS = ":" } ; { print $2 }'`" > $TEMP
echo "IP Address : `egrep '^10' $TEMP |awk '{ print $1}'`" >> $FILE
## Identifying Hardware Platform ##
HF=`uname -i`
if [ $HF == i386 ]; then
echo "Hardware Platform: 32Bit" >> $FILE
else if [ $HF == x86_64 ]; then
echo "Hardware Platform: 64Bit" >> $FILE
else
echo "Hardware Not Matched" >> $FILE
fi
fi
## Colleting Hardware Details ##
echo " " >> $FILE
echo "## Hardware Information" >> $FILE
echo " " >> $FILE
echo "Serial Number     : `lshal |grep system.hardware.serial`" >> $FILE
echo "Serial Number     : `/usr/sbin/dmidecode -s system-serial-number`" >> $FILE
echo "Model Number      : `lshal |grep system.hardware.product`" >> $FILE
echo "Model Number      : `/usr/sbin/dmidecode |grep "SKU Number"`" >> $FILE
echo "Hardware Vendor   : `lshal |grep system.hardware.vendor`" >> $FILE
echo "Hardware Info     : `dmesg |grep DMI`" >> $FILE
## Redhat Version ##
echo " " >> $FILE
echo "## OS Version" >> $FILE
head -n1 /etc/issue >> $FILE
echo -en '\n' >> $FILE
uname -a >> $FILE
## CPU Info ##
echo " " >> $FILE
echo " " >> $FILE
echo "## CPU Information" >> $FILE
grep "model name" /proc/cpuinfo >> $FILE
## RAM/MEMORY Info ##
echo " " >> $FILE
echo " " >> $FILE
echo "## Memory Information" >> $FILE
grep MemTotal /proc/meminfo >> $FILE
y=`grep MemTotal /proc/meminfo |awk '{ print $2 }'`
mb="$(( $y / 1024 ))"
gb="$(( $mb / 1024 ))"
echo "RAM : $gb GB" >> $FILE
## Verify the machine is using NIS ##
echo -e '\n' >> $FILE
cat /etc/yp.conf |grep $DOMAIN > /tmp/yptemp.txt
count=`cat /tmp/yptemp.txt | wc -l`
if [ $count -gt 0 ];
then
echo "`hostname` is part of NIS Domain" >> $FILE
cat /etc/yp.conf |grep finnis >> $FILE
else
echo "`hostname` is not part of NIS" >> $FILE
fi
echo -e '\n' >> $FILE
cat /etc/yp.conf |grep domain >> $FILE
echo -e '\n' >> $FILE
echo "Hard Disk Info" >> $FILE
fdisk -l 2>&1 | grep Disk | grep -v "identifier" | grep -v "valid partition" | awk '{print $2,$3,$4}' >> $FILE
echo -e '\n' >> $FILE
echo "Running Services" >> $FILE
service --status-all |grep running. |awk '{ print $1,$5}' >> $FILE
/bin/mail -s "Linux Asset Inventory `hostname`" $MAILIST < $FILE

Top 5 Enterprise opensource monitoring tools

1. Nagios

Nagios project is started in 1999. Nagios Enterprise monitoring tool will monitor your entire IT infrastructure to ensure systems, applications, services and business process are functioning properly. Which has two types of Software’s one is Nagios Core which is fully free (opensource) we have to configure everything by our own. Another one is Nagios XI which has beautiful GUI interface it is very easy to configure monitoring.
Nagios monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, Nagios can alert technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers. With Nagios you’ll never be left having to explain why an unseen infrastructure outage hurt your organization’s bottom line.

Few Advantages using Nagios Core

  1. Monitor your entire IT infrastructure
  2. Spot problems before they occur
  3. Know immediately when problems arise
  4. Share Available data with stakeholders
  5. Detect security breaches
  6. Plan and budget for IT upgrades
  7. Schedule Planed down times

Download Nagios Core

Nagios Core Installation and configuration Guide
nagios core
Nagios Webconsole - Tech Tutorials

2. Icinga

Monitoring Servers and networking devices with icinga2 is very easy. You can download and add plugins as many as like. No need to make set-up or maintenance of the monitoring system itself any more complex. That’s why Icinga 2 features a new configuration format that is intuitive to write, efficient to execute and even adjusts to the changing conditions of your environment at run-time.
Clear-cut, object-based configuration
Icinga 2 introduces a new object-based, rule-driven configuration format, which offers user-friendly features such as apply rules for dynamic object generation.
Taking inspiration from Puppet formats, Icinga 2 offers clear, “one best way” configuration rules. This allows Icinga 2 to depart from Nagios(TM)’s multiple configuration formats (e.g. defining host/service dependencies and parent/child relationships for hosts) – the cause of much user confusion.
The Icinga 2 configuration format is currently set as text files, in preparation for later transition to configuration via API, or GUI and CLI. A configuration migration script that translates existing Icinga 1 / Nagios configurations into the new Icinga 2 format also makes migration easier.
Apply & assign attributes
Keep configuration work to a minimum by defining templates to ”apply” to configuration objects. Apply services and notifications to hosts, or downtimes and dependencies to services.
Clever commands & runtime macros
Commands in Icinga 2 are smarter than their Nagios™-style cousins. To begin with, Icinga 2 offers three distinct command types: Check, notification and event commands. They can be given default values, custom attributes, runtime macros and conditional behaviours. Each additional option can be given precedence over the other, so that your configuration intelligently adapts at runtime to changing monitoring conditions.
Logical Dependencies
Say goodbye to confusing parent/child relationships. Dependencies in Icinga 2 are straightforward; they can be defined as host-host, service-service or mixed (host-service and service-host) and all work in the same manner.
Dynamic Notifications
Similar to Icinga 1, event handlers and notifications are supported. Thanks to the new dynamic configuration format, users can adjust notification settings at runtime (e.g. in order to implement on-call rotation).
For example, new notification objects replace notification-specific attributes for services, while user and user groups replace contact and contact groups. This new format allows notifications to be defined more precisely and intuitively. On top of this, escalations in Icinga 2 are configured as notifications with a defined beginning and end, as are recurring downtimes.

Download Icinga

Icinga

3. OpenNMS

OpenNMS is the world’s first Enterprise opensource monitoring tool. Which is capable of monitoring Servers and Networking devices using SNMP protocol. OpenNMS has more and more features such as
  1. Automated and Directed discovery and provisioning
  2. Event and Notification Management
  3. Service Assurance
  4. Performance Measurement
Open Source: OpenNMS is 100% Free and Open Source software, with no license fees, software subscriptions or special “enterprise” versions.

Download OpenNMS

openNMS monitoring tool
openNMS monitoring tool

4. zabbix

Using zabbix enterprise level monitoring tool, we can monitorr real time thousands of servers, networking devices, virtual machines simultaneously.  Along with storing the data, visualization features are available (overviews, maps, graphs, screens, etc), as well as very flexible ways of analyzing the data for the purpose of alerting.  Zabbix offers great performance for dat gathering and can be scaled to very large environments.

Features

  1. Monitor Everything
  2. Enterprise Ready
  3. Proactive Monitoring
  4. Capacity Planning
  5. True Open Source
  6. Business Solutions

Download Zabbix

zabbix arkit
Top 5 Enterprise opensource monitoring tools

5. cacti

Cacti mainly used for Network device monitoring. We can create templates. Download performance data as CSV and we can do whatever we want. User Management and graphs. Cacti makes use of RRDTool  to generate graphs and collect data from Networking devices.  The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG.

Features

  1. Graphs
  2. Datasources
  3. Data Gathering
  4. Template creation
  5. Graph Display
  6. User Management
  7. Graph templates enable common graphs to be grouped together by templating. Every field for a normal graph can be templated or specified on a per-graph basis.
  8. Data source templates enable common data source types to be grouped together by templating. Every field for a normal data source can be templated or specified on a per-data source basis.
  9. Host templates are a group of graph and data source templates that allow you to define common host types. Upon the creation of a host, it will automatically take on the properties of its template.
  10. The tree view allows users to create “graph hierarchies” and place graphs on the tree. This is an easy way to manage/organize a large number of graphs.
  11. The list view lists the title of each graph in one large list which links the user to the actual graph.
  12. The preview view displays all of the graphs in one large list format. This is similar to the default view for the 14all cgi script for RRDTool/MRTG.

Download Cacti

Top 5 Enterprise opensource monitoring tools

That’s About Top 5 Enterprise opensource monitoring tools