Nagios Automated Script for CentOS


Installing Basic Packages
yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp

Downloading Nagios Sources
cd /tmp

Adding users
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios

Unpacking Sources
tar zxvf nagios-4.0.1.tar.gz
tar zxvf nagios-plugins-1.5.tar.gz

Configuring & Making Nagios Core
cd nagios-4.0.1
./configure –with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

Copying Files
cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Starting Services
/etc/init.d/nagios start
/etc/init.d/httpd start
/etc/init.d/httpd restart
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Configuring & Making Nagios Plugins
cd /tmp/nagios-plugins-1.5
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make install

Configuring Startup Services
chkconfig –add nagios
chkconfig –level 35 nagios on
chkconfig –add httpd
chkconfig –level 35 httpd on

Installation Completed


Nagios Automated Another Script for Ubuntu


/bin/echo “You must run this script as user root! Are you root? (y/n)”
read rootpriv
case $rootpriv in
/bin/echo “Not root, exiting…”
exit 2
/usr/sbin/useradd nagios
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/bin/apt-get update
/usr/bin/apt-get -y install build-essential apache2 php5-gd wget libgd2-xpm libgd2-xpm-dev libapache2-mod-php5 sendmail daemon
/bin/tar -xvzf nagios-4.0.2.tar.gz
cd nagios-4.0.2/
./configure –with-nagios-group=nagios –with-command-group=nagcmd –with-mail=/usr/bin/sendmail
/usr/bin/make all
/usr/bin/make install
/usr/bin/make install-init
/usr/bin/make install-config
/usr/bin/make install-commandmode
/usr/bin/make install-webconf
cd ..
/bin/cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
/bin/chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
/bin/echo “”
/bin/echo “Nagios init script does not work properly on default Nagios install.”
/bin/echo “Do you want to apply Nagios init script hack? (y/n)”
read inithack
case $inithack in
/bin/echo “Fixing Nagios init script for Ubuntu Server 12.04 LTS…”
/bin/sed -i “s/^.\ \/etc\/rc.d\/init.d\/functions$/.\ \/lib\/lsb\/init-functions/g” /etc/init.d/nagios
/bin/sed -i “s/status\ /status_of_proc\ /g” /etc/init.d/nagios
/bin/sed -i “s/daemon\ –user=\$user\ \$exec\ -ud\ \$config/daemon\ –user=\$user\ –\ \$exec\ -d\ \$config/g” /etc/init.d/nagios
/bin/sed -i “s/\/var\/lock\/subsys\/\$prog/\/var\/lock\/\$prog/g” /etc/init.d/nagios
/bin/sed -i “s/\/sbin\/service\ nagios\ configtest/\/usr\/sbin\/service\ nagios\ configtest/g” /etc/init.d/nagios
/bin/sed -i “s/\”\ \=\=\ \”/\”\ \=\ \”/g” /etc/init.d/nagios
/bin/sed -i “s/##killproc\ -p\ \${pidfile}\ -d\ 10/killproc\ -p \${pidfile}/g” /etc/init.d/nagios
/bin/sed -i “s/runuser/su/g” /etc/init.d/nagios
/bin/sed -i “s/use_precached_objects=\”false\”/&\ndaemonpid=\$(pidof daemon)/” /etc/init.d/nagios
/bin/sed -i “s/killproc\ -p\ \${pidfile}\ -d\ 10\ \$exec/\/sbin\/start-stop-daemon\ –user=\$user\ \$exec\ –stop/g” /etc/init.d/nagios
/bin/sed -i “s/\/sbin\/start-stop-daemon\ –user=\$user\ \$exec\ –stop/&\n\tkill -9 \$daemonpid/” /etc/init.d/nagios
/bin/echo “Skipping init hack…”
/bin/echo “Unknown choice, skipping init hack…”
/bin/echo “Please enter nagiosadmin password!”
/usr/bin/htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
/bin/tar -xvzf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5/
./configure –with-nagios-user=nagios –with-nagios-group=nagios
/usr/bin/make install
/bin/cp /etc/apache2/conf.d/nagios.conf /etc/apache2/sites-available/nagios
/bin/ln -s /etc/apache2/sites-available/nagios /etc/apache2/sites-enabled/nagios
/bin/chown nagios:www-data /usr/local/nagios/var/rw
/bin/ln -s /etc/init.d/nagios /etc/rcS.d/S98nagios
/bin/ln -s /etc/init.d/apache2 /etc/rcS.d/S99apache2
/etc/init.d/nagios start
/etc/init.d/apache2 restart
/bin/echo “”
/bin/echo “Open http://IPADDRESS/nagios or http://FQDN/nagios in your browser and enter nagiosadmin username and password!”
/bin/echo “Unknown choice, exiting…”
exit 2

Nagios Automated Script for Ubuntu

#! /bin/bash

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install openssh-server build-essential libgd2-xpm-dev apache2 php-pear rrdtool librrds-perl php5-gd php5-common php5 libapache2-mod-php5
sudo gedit/etc/apache2/apache2.configure

sudo /etc/init.d/apache2 restart

sudo useradd -m nagios
sudo passwd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd www-data

sudo mkdir downloads
cd downloads
tar -xvf nagios-3.4.4.tar.gz
tar -xvf nagios-plugins-1.4.16.tar.gz

cd nagios
./configure –with-command-group=nagcmd
sed -i ‘s:for file in includes/rss/;:for file in includes/rss/.;:g’ ./html/Makefile
sed -i ‘s:for file in includes/rss/extlib/;:for file in includes/rss/extlib/.
;:g’ ./html/Makefile
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
make install-exfoliation
make install-classicui
mkdir /usr/local/nagios/etc
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

cd /home/ourquiza/downloads
cd nagios-plugins-1.4.16
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make all
make install
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
chown nagios.nagcmd /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
/etc/init.d/nagios restart
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Information

An open-source computer-software application, monitors systems, networks and infrastructure. Nagios offers monitoring and alerting services for servers, switches, applications and services. It alerts users when things go wrong and alerts them a second time when the problem has been resolved.

Nagios was originally designed to run under Linux, but it also runs well on other Unix variants. It is free software licensed under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.



Operating Nagios
Monitoring of network services (SMTP, POP3, HTTP, NNTP, ICMP, SNMP, FTP, SSH)
Monitoring of host resources (processor load, disk usage, system logs) on a majority of network operating systems, including Microsoft Windows with the NSClient++ plugin or Check MK.
Monitoring of anything else like probes (temperature, alarms,etc.) which have the ability to send collected data via a network to specifically written plugins
Monitoring via remotely run scripts via Nagios Remote Plugin Executor
Remote monitoring supported through SSH or SSL encrypted tunnels.
A simple plugin design that allows users to easily develop their own service checks depending on needs, by using their tools of choice (shell scripts, C++, Perl, Ruby, Python, PHP, C#, etc.)
Available data graphing plugins
Parallelized service checks
The ability to define network host using ‘parent’ hosts, allowing the detection of and distinction between hosts that are down or unreachable
Contact notifications when service or host problems occur and get resolved (via e-mail, pager, SMS, or any user-defined method through plugin system)
The ability to define event handlers to be run during service or host events for proactive problem resolution
Automatic log file rotation
Support for implementing redundant monitoring hosts
An optional web-interface for viewing current network status, notifications, problem history, log files, etc.
Data storage via text files rather than database


Nagios Agents
Nagios Remote Plugin Executor (NRPE) is a Nagios agent that allows remote system monitoring using scripts that are hosted on the remote systems. It allows for monitoring of resources such as disk usage, system load or the number of users currently logged in. Nagios periodically polls the agent on remote system using the check_nrpe plugin.
Nagios Remote Data Processor (NRDP) is a Nagios agent with a flexible data transport mechanism and processor. It is designed with an architecture that allows it to be easily extended and customized. NRDP uses standard ports and protocols (HTTP(S) and XML) and can be implemented as a replacement for NSCA.
This program is mainly used to monitor Windows machines. Being installed on a remote system NSClient++ listens to port TCP 12489. Nagios plugin that is used to collect information from this addon is called check_nt. As NRPE, NSClient++ allows to monitor the so-called ‘private services’ (memory usage, CPU load, disk usage, running processes, etc.) Nagios is a host and service monitor which is designed to inform your network problems.

Dude Automated Script For Ubuntu


Updating System
sudo apt-get update

Installing WINE
apt-get install wine msttcorefonts

cp /usr/share/fonts/truetype/msttcorefonts/* ~/.wine/drive_c/windows/Fonts/

Downloading & Installing Dude

wine ~/dude-install-3.5.exe &

Running Dude on Linux
wine ~/.wine/drive_c/Program\ Files/Dude/dude.exe &

Dude Manual Installation For Ubuntu

Dude Requirements
WGET (could already be installed on your Linux system, but installation instructions are still provided)
Microsoft TrueType Core Fonts

Start the Installer
Click Next


Choose Language


License Agreement
Accept I Agree


User Can Choose
Which Components of Dude to Install


Dude will be installed to c:\Program Files\Dude by default


Installation is Completed
Click on Finish


MRTG Information

The Multi Router Traffic Grapher, or just simply MRTG, is free software for monitoring and measuring the traffic load on network links. It allows the user to see traffic load on a network over time in graphical form.

It was originally developed by Tobias Oetiker and Dave Rand to monitor router traffic, but has developed into a tool that can create graphs and statistics for almost anything.


MRTG uses the Simple Network Management Protocol (SNMP) to send requests with two object identifiers (OIDs) to a device. The device, which must be SNMP-enabled, will have a management information base (MIB) to look up the OIDs specified. After collecting the information it will send back the raw data encapsulated in an SNMP protocol. MRTG records this data in a log on the client along with previously recorded data for the device. The software then creates an HTML document from the logs, containing a list of graphs detailing traffic for the selected devices in the server.


MRTG Features
Measures two values (I for Input, O for Output) per target.
Gets its data via an SNMP agent, or through the output of a command line.
Typically collects data every five minutes (it can be configured to collect data less frequently).
Creates an HTML page per target that features four graphs (GIF or PNG images).
Results are plotted vs time into day, week, month and year graphs, with the I plotted as a full green area, and the O as a blue line.
Automatically scales the Y axis of the graphs to show the most detail.
Adds calculated Max, Average and Current values for both I and O to the target’s HTML page.
Can also send warning emails if targets have values above a certain threshold.

Cacti Information

Cacti is an open-source, web-based network monitoring and graphing tool designed as a front-end application for the open-source, industry-standard data logging tool RRDtool. Cacti allows a user to poll services at predetermined intervals and graph the resulting data. It is generally used to graph time-series data of metrics such as CPU load and network bandwidth utilization.A common usage is to monitor network traffic by polling a network switch or router interface via Simple Network Management Protocol (SNMP).

The front end can handle multiple users, each with their own graph sets,so it is sometimes used by web hosting providers (especially dedicated server,virtual private server, and collocation providers) to display bandwidth statistics for their customers. It can be used to configure the data collection itself, allowing certain setups to be monitored without any manual configuration of RRDtool.Cacti can be extended to monitor any source via shell scripts and executables.

Cacti can use one of two back ends: “cmd.php”, a PHP script suitable for smaller installations, or “Spine” (formerly Cactid), a C-based poller which can scale to thousands of hosts.


Cacti History
On September 13, 2004, version 0.8.6 was released,and with it came more developers and, later on, greater program speed and scalability.
Version 0.8.7 was released for use in October 2007.In June 2012, a roadmap on the website indicated that version 1.0.0 was scheduled for release in the first quarter of 2013,but by August 2013 it was replaced by a notice that “This roadmap is out of date. We are reorganizing to improve the development cycle of Cacti. More information coming before the end of 2013”.
Version 0.8.8c was released in August 2014 with numerous bug and security issues patched, and a few new features.
Version 0.8.8d was released in June 2015 with numerous bugs patched.
Version 0.8.8e was released in July 2015 with numerous bug and security issues patched.
Version 0.8.8f was released in July 2015 with some bugs patched.

Cacti Features
UnLimited graph items
Auto-padding support for graphs
Graph data manipulation
Flexible data sources
Data gathering on a non-standard timespan
Custom data-gathering scripts
Built-in SNMP support
Graph templates
Data source templates
Host templates
Tree, List & Preview views of graph data
User-Based Management & Security

Cacti Installation For CentOS

Installation Prerequisites rrdtool, apache, mysql, cron & gcc
yum -y install mysql-server php php-cli php-mysql net-snmp-utils rrdtool \ php-snmp gcc mysql-devel net-snmp-devel autoconf automake libtool dos2unix

Enabling Chkconfig
chkconfig httpd on
chkconfig mysqld on

Cacti Files
cd /var/www/html

Downloading Cacti File

Untar Cacti
tar -xzvf cacti-0.8.8b.tar.gz

ln -s cacti-0.8.8b cacti

Cron & File Permissions
adduser cacti
echo “*/5 * * * * cacti php /var/www/html/cacti/poller.php &>/dev/null” >> /etc/cron.d/cacti
cd /var/www/html/cacti
chown -R cacti.apache rra log
chmod 775 rra log

Download Cacti Patch File
patch -p1 -N < security.patch

Cacti Database
mysqladmin -u root -p create cacti
mysql -p cacti < /var/www/html/cacti/cacti.sql
mysql -u root -p
mysql > GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘cacti’;
mysql > flush privileges;
mysql > exit

Setting Database Credentials for Cacti config file
cd /var/www/html/cacti/include/
vim config.php

Checking Database Details
$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “MyV3ryStr0ngPassword”;
$database_port = “3306”;
$database_ssl = false;

URL Path for Cacti in Config File
$url_path = “/cacti/”;

Installation is Completed
Please Check the Cacti http://IP-Address/cacti

Click on Next


Please Select New Install
Click Next


Check Following Paths
Click Finish


Default Password is admin
After that Change to New Password