Sysadmin's Shouts!

a blog for sysadmin's rants and raves…

HowTo: Find out Nagios Configuration Files

Leave a comment

It looks simple, and it should be, but as it goes, I have seen installations with different nagios versions & configurations.

In one particularly hairy case, the administrators had been migrating from one version to other, and to be on the safe side, they just installed the new nagios version in a different folder, say nagios3, but because some of the checks migrated to the new version where broken, somebody fixed them by pointing to the scripts and config files from the previous version, instead of fixing or replacing the ones in the new nagios3 folder. (Nice!)

So they ended up with a nagios folder, and nagios3 folder…

The thing is: Nagios works. And by following the rule: “If it ain’t broke, don’t fix it”, nobody has done anything with the nagios install.

What happens when you want to upgrade to a newer nagios version like nagios 4? -well, you will probably have lots of fun…


So I will just describe in some easy steps how to find out the correct config files that the “good nagios set” is using, and what is not being used & it has just been left there from previous installs or configurations.

1.- Locate the nagios binary and it’s good config file.

[root@nagserv ~]# ps -ef | grep nagios

nagios 2026 1 0 18:15 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

2.- Navigate to the path where that config file resides.
cd /usr/local/nagios/bin

3.- Execute a Nagios validation, this step must be done every time that we modify/add something in nagios, as it checks the configuration files integrity.

Note: if we don’t want to validate the integrity, just remember that nagios won’t start if it has errors, and next time the nagios service gets restarted or a new one spawn off, it will just throw back errors, until these get fixed.

./nagios -v /usr/local/nagios/etc/nagios.cfg

Once nagios does the config validation, it will report in all config files used in the actual nagios running state.

Nagios Core 3.3.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 07-25-2011
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'...
Processing object config directory '/usr/local/nagios/etc/objects/nagserv'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/contactgroups.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/hosts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/dependencies.cfg'...
Processing object config directory '/usr/local/nagios/etc/objects/nagserv/HOSTS'...
Processing object config directory '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/www_xxx.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvaaa.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvbbb.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/servnew.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvdb.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvmsg.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvapp.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvtsm.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvsap1.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvapp2.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/nagservios.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvdb2.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvtraps.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvunk.cfg'...
Processing object config directory '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/OLD'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvccc.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/servddd.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SRV/srvpre.cfg'...
Processing object config directory '/usr/local/nagios/etc/objects/nagserv/HOSTS/NETWORK'... <-- Empty directory (for nagios)
Processing object config directory '/usr/local/nagios/etc/objects/nagserv/HOSTS/SAN'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SAN/Switch_03.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SAN/Switch_04.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SAN/SAN01.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SAN/SAN02.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SAN/Switch_02.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SAN/Switch_01.cfg'...
Processing object config directory '/usr/local/nagios/etc/objects/nagserv/HOSTS/SAN/OLD'... <-- Empty directory (for nagios)
Processing object config directory '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/sp-1.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/sp-2.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/cmm-1.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/sp-8.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/cmm-2.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/sp-9.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/sp-10.cfg'...
Processing object config directory '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/OLD'... <-- Empty directory (for nagios)
Processing object config file '/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/sp-xxx.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/nagserv/hostgroups.cfg'...
Read object config files okay...
---cut---
4.- From the validation, we can see that most nagios objects are stored in the path /usr/local/nagios/etc/objects
so, we have a look there:
cd /usr/local/nagios/etc/objects
ls -l
total 96

-rw-r--r-- 1 nagios nagios 8362 Oct 1 2013 commands.cfg
-rw-r--r-- 1 nagios nagios 8362 Oct 1 2013 commands.cfg.bak
-rw-rw-r-- 1 nagios nagios 2167 Oct 11 2013 contacts.cfg
-rw-rw-r-- 1 nagios nagios 5441 Aug 6 2013 localhost.cfg
drwxrwxr-x 2 nagios nagios 4096 Nov 12 2013 nagios3
-rw-rw-r--. 1 nagios nagios 3124 Apr 4 2012 printer.cfg

drwxrwxr-x 3 nagios nagios 4096 Sep 9 17:45 nagserv
-rw-rw-r--. 1 nagios nagios 3293 Apr 4 2012 switch.cfg
-rw-rw-r-- 1 nagios nagios 11225 Apr 4 2012 templates.cfg
-rw-rw-r--. 1 nagios nagios 10812 Apr 4 2012 templates.cfg.original
-rw-rw-r-- 1 nagios nagios 4428 Sep 9 18:38 timeperiods.cfg
-rw-rw-r-- 1 nagios nagios 1221 Nov 26 2013 timeperiods.cfg.old.bz2
-rw-rw-r-- 1 nagios nagios 4037 Aug 13 2013 timeperiods.cfg.wip

-rw-rw-r--. 1 nagios nagios 4019 Apr 4 2012 windows.cfg

5.- The files in red are not being used by nagios (specially important is nagios3 directory, which in this case contains lots of config files for alarms, hosts, etc, and it’s not being used anymore).

The directory nagserv, is where all the good config files are stored.

So, if we wanted to do a bit of cleanup, we could safely delete the following folders:

/usr/local/nagios/etc/objects/nagserv/HOSTS/NETWORK
/usr/local/nagios/etc/objects/nagserv/HOSTS/SAN/OLD
/usr/local/nagios/etc/objects/nagserv/HOSTS/SP/OLD
/usr/local/nagios/etc/objects/nagios3

Before that tho, might as well double check that they don’t contain any files, or backup the folders with TSM or whatever backup product you use, and then delete them.
Having folders lying around without a good use, it’s bound to be counterproductive soon or later.

So there you go, we’ve identified the good folders and .cfg files used by nagios; any other file that does not use a .cfg extension, won’t be picked up by nagios (all the files listed here with extensions like: cfg.bak, cfg.original, cfg.old.bz2, cfg.wip, etc, are just backups of the real config files).

This gallery contains 0 photos


Leave a comment

VMware Product Acronyms Dictionary

Don’t tell me that you’ve never found yourself thinking about what vMA or vCO or vCAC is in a documentation, because with soo many VMware products, there is another world out there to be remembered.

Well, in that case, don’t fear, as I have collected a VMware Acronyms list for your product searching pleasure.

Hey!, and it’s a nice downloadable PDF, to boot!

VMware_Acronyms_v1.0

But in case you need to have a quick look and don’t need to download the file, here is the list:

Acronym Full Product/Technology Name Product Description
AIO Asynchronous I/O A process that handles blocking system calls for asynchronous I/O, or nonblocking I/O. AIO is a form of input and output processing that permits other processing to continue before the transmission finishes.
COS ESX Service Console OS Its Linux kernel loads the VMkernel as a module and then passes complete control over the system to it. The VMkernel hypervisor in turn will then run the COS as a privileged VM.
DPM Distributed Power Management VMware Distributed Power Management provides power savings by dynamically consolidating workloads during periods of low resource utilization. VMs are migrated onto fewer hosts and unneeded ESXi hosts are powered off.
DRS Distributed Resource Scheduler VMware DRS manages the allocation of resources to a set of virtual machines running on a cluster of ESX hosts with the goal of fair and effective use of resources.
EVC Enhanced vMotion Compatibility vSphere virtualization that allows VMs to move between ESX/ESXi hosts on different CPUs (masks CPUs technologies to make a match between 2 or more CPUs from the same manufacturer)
EVO:RAIL EVO:RAIL EVO:RAIL combines VMware compute, networking, and storage resources into a hyper-converged infrastructure appliance to create a simple, easy to deploy, all-in-one solution offered by VMware partners.
Fling Vmware Labs Flings Apps and tools built by VMare engineers that are intended to be played with and explored.    For more info, see     https://labs.vmware.com/flings
FT vSphere Fault Tolerance VMware vSphere Fault Tolerance provides continuous availability for applications in the event of server failures by creating a live shadow instance of a virtual machine that is always up-to-date with the primary virtual machine.
GOS Guest Operating System An operating system that runs inside a virtual machine (Windows, Linux, Solaris x86, etc).
HOL Vmware Hands-On Labs VMware Hands-on Labs, are lab deployments for students.  For more info, see    http://labs.hol.vmware.com/HOL/catalogs/
Horizon VMware Horizon VDI desktop-virtualization product. Delivers virtualized and remote desktops and applications through a single platform and supports end users with access to all of their Windows and online resources through one unified  workspace.
NEE Next Education Environment project (now known as HOL) Next-gen concept for education environments, where Vmware creates a full deployment for the estudent to learn with.
NSX VMware NSX Virtualized Network similar to a virtual machine for compute, a virtualized network is a fully functional network in a software container, provisioned independent of underlying hardware or topology.
The NSX network virtualization platform operates on any hypervisor (not just VMware), any network hardware and integrates with any cloud management platform.
Onyx VMware Project Onyx (Fling) Project Onyx is a new tool in that generates code based on the mouse clicks you make in the vSphere Client.
OVA Open Virtualization Format Open Virtualization Format is an open standard for packaging and distributing virtual appliances or more generally software to be run in virtual machines.
OVF Open Virtual Appliance Single file distribution of a OVF package, stored in the TAR format. (can be opened with tar or WinRAR to see it’s contents).
OVF Tool VMware OVF Tool The OVF Tool is a a command line utility that supports importing and exporting of OVF packages to and from many VMware products.
P2V Physical to Virtual Physical to Virtual conversion process, where a VM is made from a physical machine. Can be performed by using Vmware Converter.
PowerCLI VMware vSphere PowerCLI PowerCLI provides more than 150 commands that give you the power to automate all aspects of VMware vSphere: storage, network, ESX, VM and more. Based on Windows PowerShell.
PSOD Purple Screen Of Death Similar to Windows BSOD, is a diagnostic screen (white text on purple background) that is displayed when the ESXi’s VMkernel carshes due to a critical error.
RDM Raw Device Mapping A mechanism that enables a virtual machine to have direct access to a LUN on the physical storage subsystem (Fibre Channel or iSCSI only).
SDRS Storage DRS Provides recommendations for VM disk placement and migration to balance space and I/O resources across the datastores in a datastore cluster.
SRM vCenter Site Recovery Manager Disaster recovery solution that provides automated orchestration and non-disruptive testing of centralized recovery plans for all virtualized applications.
ThinApp VMware ThinApp Agentless application virtualization solution that isolates applications from their underlying operating systems to eliminate application conflict and streamline delivery and management.
VAAI vStorage APIs for Array Integration VMware API framework that enables storage tasks (like thin provisioning) to be offloaded from the ESXi host to the storage array, accelerating vSphere.
vApp vSphere vApp (Virtual Application) A vApp is a container, like a resource pool and can contain one or more virtual machines. A vApp also shares some functionality with virtual machines. A vApp can power on and power off, and can also be cloned.
VASA vSphere Storage APIs – Storage Awareness Vmware API framework to share information from the storage to the ESXi, like health, provisioning, space conmomption, etc.
VCA VMware Certified Associate Certification program which validates your knowledge of virtualization business challenges and the VMware products that solve them.
vCAC vCloud Automation Center VMware vCloud Automation Center drives business agility by automating the delivery of personalized IT services.
VCA-Cloud VMware Certified Associate – Cloud Define cloud computing and provide use case scenarios of how vCloud and cloud computing can take advantage of private and public clouds without changing existing applications and leverage a common management, orchestration, networking, and security model.
vCAD vCloud Application Director vCloud Application Director (formerly known as vFabric Application Director) lets you build deployment blueprints with a drag-and-drop interface.
VCA-DCV VMware Certified Associate – Data Center Virtualization Certified technicians will be able to define data center virtualization and provide use case scenarios of how vSphere and data center virtualization can provide cost and operational benefits.
VCAP5-DCA VMware Certified Advanced Professional 5 – Data Center Administration Demonstrates your expertise with VMware vSphere 5, as well as your ability to use automation tools and implement virtualized environments.
VCAP5-DCD VMware Certified Advanced Professional 5 – Data Center Design Certification designed for IT architects who design and integrate VMware solutions in multi-site, large enterprise, virtualized environments.
VCAP-CG VMware Certified Advanced Professional – Cloud Governance Coming Soon
VCAP-CIA VMware Certified Advanced Professional – Cloud Infrastructure Administration Certification that validates ability to install, configure, and administer complex, single and multi-tenant public/private/hybrid VMware vCloud environments.
VCAP-CID VMware Certified Advanced Professional – Cloud Infrastructure Design Certification that verifies that you can define goals for your cloud infrastructure architecture, analyze elements of the framework, and make design decisions that ensure the proper physical and virtual components exist in the design.
VCAP-DCA VMware Certified Advanced Professional 5 – Data Center Administration Unique, lab-based exam where you will perform tasks using actual equipment to verify your skill at installing, configuring, and administering large and complex virtualized environments.
VCAP-DTA VMware Certified Advanced Professional – Desktop Administration Certification that validates advanced proficiency with deploying, administering, and troubleshooting large-scale, production ready, virtual desktop infrastructures that enable workforce mobility. Demonstrates your ability to install and manage highly-available and recoverable Horizon View environments, establishing policies and settings for a secure virtualized infrastructure.
VCAP-DTD VMware Certified Advanced Professional – Desktop Design Certification that validates your ability to design, plan, and optimize VMware View solutions. This certification signals a strong understanding of VMware View core components and their relation to the data center, as well as View design methodologies and principles.
VCA-WM VMware Certified Associate – Workforce Mobility You will be able to define workforce mobility and provide use case scenarios of how Horizon and workforce mobility can deliver freedom, flexibility, and manageability while connecting people to their data, applications, and desktops.
vCD vCloud Director VMware vCloud Director provisions software-defined data center services as virtual data centers that provide virtualized compute, networking, storage and security.
vCD-SP vCloud Director for Service Providers VMware vCloud Director-SP enables cloud service providers to build differentiated cloud services that are inherently hybrid aware and best fit for enterprise class organizations.
VCDX VMware Certified Design Expert VCDX is the highest level of certification offered by VMware. The VCDX certification allows you to highlight your enterprise-class skills in VMware Solution design and implementation.
VCDX5-DCV VMware Certified Design Expert 5 – Data Center Virtualization VCDX5-DCV certification is achieved through the unique design defense process, where all candidates must submit and successfully defend a production-ready VMware Solution before a panel of veteran VCDX-DCV holders.
VCDX-Cloud VMware Certified Design Expert – Cloud VCDX-Cloud requires enterprise-class vSphere and data center virtualization skills but the focus is on adding the VMware vCloud Suite, building out the software-defined-data center, and delivering Infrastructure-as-a-Service with comprehensive management and security.
VCDX-DT VMware Certified Design Expert – Desktop VCDX-DT requires enterprise-class vSphere and data center virtualization skills but the focus is on delivering virtual desktops and mobile computing solutions with the VMware Horizon Suite™ and building out the infrastructure to deliver a consistent, rich end-user experience across multiple devices.
VCDX-NV VMware Certified Design Expert – Network Virtualization VCDX-NV requires enterprise-class networking and network virtualization skills with a focus on VMware NSX; a revolutionary technology that transforms network operations and economics in the software-defined data center.
vCenter VMware vCenter Server Centralized platform for managing your VMware vSphere environments, can be installed on a Window Server, or in a preconfigured Virtual Appliance (VCSA)
VCIX-NV VMware Certified Implementation Expert – Network Virtualization Validates your ability to install, configure, and administer NSX virtual networking implementations in a demanding hands-on lab environment. The lab is not a simulation, candidates will work within a live and fully operational virtual appliance to complete all the objectives.
vCLI vSphere Command-Line Interface Command set of more than 30 command-line utilities that allows you to run sysadmin commands against ESXi systems from any machine to help you provision, configure and maintain your ESX and ESXi hosts.
vCMA vCenter Mobile Access A fully configured and ready to run virtual appliance that is required to manage your datacenter from mobile devices such as smartphones and tablets (iPad).
vCO vCenter Orchestrator VMware vCenter Orchestrator simplifies the automation of complex IT tasks and integrates with VMware vCloud Suite components, to adapt and extend service delivery and operational management.
VCOPS VMware vCenter Operations Manager VMware vCenter Operations Manager is the key component of the VMware vCenter Operations Management Suite. It provides comprehensive visibility and insights into the performance, capacity and health of your infrastructure.
VCP4-DT VMware Certified Professional 4 – Desktop Directed toward Virtualization Systems Engineers who seek to demonstrate their ability to install and configure the VMware View environment and enable View Client users. Candidates must be able to configure the vSphere environment, possess a deep understanding of VMware core components and their relation to storage and networking and be proficient in data center design methodologies.
VCP5-DCV VMware Certified Professional 5 – Data Center Virtualization Confirms that you have the education needed to successfully install, deploy, scale and manage VMware vSphere environments, as well as the skills obtained by a minimum of six months experience with VMware infrastructure technologies.
VCP5-DT VMware Certified Professional 5 – Desktop Directed toward Virtualization Systems Engineers who seek to demonstrate their ability to install and configure the VMware View environment and enable View Client users. Candidates must be able to configure the vSphere environment, possess a deep understanding of VMware core components and their relation to storage and networking and be proficient in data center design methodologies.
VCP-Cloud VMware Certified Professional – Cloud Validates your ability to install, configure and administer a Cloud environment using vCloud Director and related components.
VCP-NV VMware Certified Professional – Network Virtualization Validates your ability to install, configure, and administer NSX virtual networking implementations, regardless of the underlying physical architecture.
vCSA vCenter Server Appliance OVF to Quickly deploy vCenter Server and manage vSphere using a Linux-based virtual appliance.
VDI Virtual Desktop Infrastructure A Virtual Desktop Infrastructure (VDI) is a desktop-oriented service that hosts user-desktop environments on remote servers. In the vSphere world VDI means Horizon View or just Horizon.
VIEW Horizon View or Horizon (with View) See the entry for Horizon
vMA vSphere Management Assistant Virtual Appliance that allows administrators and developers to run scripts and agents to manage ESXi and vCenter Server systems. vMA packages the vCLI Command Line Interface, the vSphere SDK for Perl, as well as logging and authentication modules. vMA can also host 3rd-party agents for added management power.
VMDK Virtual Machine Disk Open Source File Format (developed by Vmware), acts as a container for virtual hard disk drives to be used in virtual machines like VMware Workstation or VirtualBox.
VMFS Virtual Machine File System High performance cluster file system which provides storage virtualization that is optimized for VMs. Each virtual machine is encapsulated in a small set of files (VMDKs).
vMotion Virtual Motion Technology to move a VMs between ESXi hosts without downtime.
VSA vSphere Storage Appliance Software-based shared storage solution that enables high availability and automation in vSphere without shared storage hardware.
VSAN VMware Virtual SAN Virtual SAN is a software-defined storage solution specifically designed for the software-defined datacenter.
Virtual SAN’s hypervisor-converged architecture enables storage and compute to run in the same physical host with minimal overhead; management is made simple through seamless integration with the vSphere Web Client and the entire VMware stack.
vShield VMware vShield Group of networking and security products for virtualized IT infrastructures, comprising vShield Manager, vShield Edge, vShield Zones, vShield App, vShield Data Security and vShield Endpoint. There are AV products for vShield.
VUM VMware Update Manager VMware vSphere Update Manager automates patch management and eliminates manual tracking and patching of vSphere hosts and virtual machines. It compares the state of vSphere hosts with baselines, then updates and patches to enforce compliance.
VVOL Virtual Volumes Next-gen concept for storage cabinets: a LUN that is VMDK-aware. So the ESXi host can offload tasks to the storage system per VMDK granularity.
VXLAN Virtual Extensible LAN Network virtualization technology that attempts to correct scalability problems associated with large cloud computing deployments. It uses a VLAN-like encapsulation to encapsulate MAC-based Layer 2 Ethernet frames within Layer 4 UDP packets.