SlideShare ist ein Scribd-Unternehmen logo
1 von 5
Downloaden Sie, um offline zu lesen
Express-Guide
                                           ~to~
                                    Basic Setup of


                                Nagios
                    an IT Infrastructure Monitoring Solution
                                                     by, ABK ~ http://www.twitter.com/aBionic


                                     ::Task Detail::

    Setting up Nagios machine on a LAN to monitor resources and services
    Generating an e-mail notifications if any of them goes down



                                     ::Background::

Links: http://www.nagios.org/

    Nagios is one of the most popular network-based IT Infrastructure Monitoring solution
     enabling organizations identify and resolve IT Infrastructure problems.

    There is a Nagios Server box monitoring all desired hosts; hosts either run Nagios
     Clients ( like NRPE, more controllable) or get accessed over SNMP Service (this is
     better, if SNMPv3 is used).



                                 ::Execution Method::

To set up Nagios Server box and enabling Hosts to use it follow steps given below:
    Setup a Nagios Server Box
       {in respect to Fedora/CentOS, may change slightly with distro}

      ◩ Pre-Requisite:
        Installation of Apache, PHP, GCC Compiler, GD Developer Libraries as
        â–Ș #yum -y install httpd php gcc
        â–Ș #yum -y install glibc glibc-common gd gd-devel

      ◩ Installation Step:
        â–Ș Create a user account and group for it
           ‱ shell commands:
$su -l
        #useradd -m nagios
        #passwd nagios
        #groupadd nagcmd
        #usermod -a -G nagcmd nagios
        #usermod -a -G nagcmd apache

  â–Ș Download latest version of 'Nagios Core' and 'Nagios Plugins' from respective
    sections at
    [ Nagios Core: ],
    [ Nagios Plugins: http://www.nagios.org/download/plugins ]

  â–Ș Untar, Compile and Installing of Nagios {we had core-3.2.1 and plugins-1.4.14}
    ‱ shell commands:
       #tar -zxf nagios-3.2.1.tar.gz
       #tar -zxf nagios-plugins-1.4.14.tar.gz
       #cd nagios-3.2.1
       #./configure –with-command-group=nagcmd
       #make all
       #make install
       #make install-init
       #make install-config
       #make install-commandmode
       #make install web-conf
       #htpasswd -c /usr/local/nagios/etc/htpasswd.users
       nagiosadmin
       #cd ../nagios-plugins-1.4.14
       #./configure --with-nagios-user=nagios –with-nagios-
       group=nagios
       #make
       #make install
    ‱ Above when you are using 'htpasswd' utility, it will ask for a password which
       will be your password for userid 'nagiosadmin' to login to Nagios Web-App.
    ‱ If you forget the password later, just rerun that single command to change
       password.

  â–Ș Making Nagios a System Service
    ‱ shell commands:
      #chkconfig --add nagios
      #chkconfig nagios on
      #service nagios start
      Note: If SELinux is in enforcing mode then, below commands also
      #chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin
      #chcon -R -t httpd_sys_content_t usr/local/nagios/share

◩ Customizing Configuration
  â–Ș The main configuration file will be '/usr/local/nagios/etc/nagios.cfg',
    with listing of all other configuration file.
So, if any configuration file is added or removed its entry in 'nagios.cfg'
          should be altered respectively.
      â–Ș   You can configure hosts, services, host-groups, service-groups,
          contacts, contact-groups.
          You can also configure commands to be referenced in services using which
          those will be checked. Now these commands actually mention all configurations
          along-with the Script and its parameters to be executed to check for that
          service.
      â–Ș   This scripts are by default located at '/usr/local/nagios/libexec/' and
          respond in general output of return codes 0, 1, 2, 3 for OK, Warning,
          Critical, Unknown respectively.
      â–Ș   Among these commands, the SNMP based commands will also require SNMP
          Community String to be passed as an argument.
          Security Note: Don't use 'public' as your community string, its not safe
          from Security perspective.
      â–Ș   By default these settings are to be performed manually at file-level
          configuration. It gives you greater control over the configuration-model you want
          to follow; depending on count and type of hosts and services.
          But, if you want a GUI then you can download free Nagios Addons like NConf or
          NagiosQL. They are PHP-based GUI front-ends to configure your Nagios more
          easily.

 Enabling Hosts' Services to be monitored by Nagios
  ◩ some 'Nagios Client' or 'SNMP daemon' needs to be configured on hosts to be
     monitored

 for Nagios Client
  ◩ use 'NRPE' on Linux and 'NSClient++' on Windows, available free

 for SNMP
  ◩ Installation:
      â–Ș On Windows, install it from
        'Start Menu' > 'Control Panel' > 'Add or Remove Programs' > 'Add or Remove
        Windows Components' > 'Management and Monitoring Tools' > 'Details' >
        'Simple Network Management Protocol' > 'OK' > 'Next' > follow next instructions
      â–Ș On Linux Machine
        #yum -y install net-snmp net-snmp-utils

   ◩ Configuration Steps:
     â–Ș On Windows Machine
       ‱ open 'Control Panel' > 'Administrative Tools' > 'Services'
       ‱ select SNMP, open its properties
       ‱ add the Community specified in Nagios configuration
       ‱ allow access to Nagios Server IP to access SNMP Daemon.
     â–Ș On Linux Machines
       ‱ edit snmpd.conf file
       ‱ remove 'public' community
‱ add text (within '<>') changing ' yourCommunityNameSpecified' to required
            name as per your configuration
            < rocommunity yourCommunityNameSpecified >
       â–Ș These settings are really basic (quick to go) policies. For an advanced and more
         secure version, go for policies mentioned in 'SNMP for secure resource
         monitoring' article or simply use SNMPv3 if you already know it.



                           ::Tools/Technology Used::

‱   Nagios-Core    : http://www.nagios.org/download/core
‱   Nagios-Plugins : http://www.nagios.org/download/plugins
‱   Net-SNMP       : http://www.net-snmp.org/
‱   NSClient++     : http://www.nsclient.org/nscp/
‱   NRPE           : http://sourceforge.net/projects/nagios/files/nrpe-2.x/
‱   NagiosMailACK : http://exchange.nagios.org/directory/Utilities/NagiosMailACK/details



                                    ::Inference::

 It's a highly scalable IT infrastructure monitoring and alerting solution with great
  architecture allowing entire community to contribute to its features as add-ons, services
  making it the most popular solution.

 It don't have a great GUI, just a decent one. Entire configuration is directly via files
  which is in a way great, because it gives more control over what actually gets set, and
  backup-restore is too easy also.



                    ::Troubleshooting/Updates::
      these are few specific issues personally faced-&-solved

 Problem: in one pre-configured nagios box the rendering of data vanished
  Solution:
  I searched for CSS files in the Web Files directory and found that Stylesheet File
  somehow got truncated on the server, replacing them with the original files solved it.

 Problem: a problem occurred in the Nagios Box configured initially, the notification
  mails weren't getting delivered rather got piled-up in mail queue.
  Solution:
  First we thought there is some problem with mail service, so we uninstalled it and
  installed another mail-service but still it didn't got resolved.
  Checking 'Mail Queue' of standard service and new mail service showed that still all
  mails were sent via old one.
Checked for system binaries, and found there were two extra binaries per mail-service
   other than default 'mail' service on linux. So, changing nagios configuration to that
   specific binary for sending mail solved the problem.

 Requirement: Nagios Web-Interface was available only over Organization's Network,
  that's not a thing to debate or change with respect to security.
  But to acknowledge the Alert Notification Mails from it, access was required to its UI.
  So, a work-around was required. The most suitable and quick was replying to that
  Notification mail itself for Acknowledgment, as alert-mail-notification worked fine.
  Solution:
  The online popular & available solution for it was setting up a ProcMail server on
  Nagios server and make its entry in Organization's MX Server to enable it receiving all
  replies. Then getting a perl script running to check for received mails and acknowledge
  the alert on correct pattern-acknowledgment mail.
  Though it was nice, but required new entries in MX Server per Nagios box. A new
  service on a box means a new security vector.
  Also required one more server to be run on Nagios Box increasing the already spiking
  resource load.
  ◩ So, I developed a Nagios Supporting Service 'NagiosMailACK'
     { could be studied/downloaded: http://sourceforge.net/projects/nagiosmailack/ }
     It was low on resource consumption and just required a single GMail ID to receive
     acknowledgments for all Nagios Servers by using different Nagios_ID like
     parameters for different Nagios boxes.

 Requirement: a Guest user with permissions to only view Host & Service status
  Solution: firstly adding a guest user to htpasswd.users file
  ◩ at shell
     #htpasswd /usr/local/nagios/etc/htpasswd.users guestUser
     remember don't attach '-c' switch to it, otherwise old users will get replaced
  ◩ Now, open '/usr/local/nagios/etc/cgi.cfg' for editing and change in following way
     â–Ș find following (or similar) lines
        authorized_for_all_services=nagiosadmin
        authorized_for_all_hosts=nagiosadmin
     â–Ș add new user entry to make it look like
        authorized_for_all_services=nagiosadmin, guestUser
        authorized_for_all_hosts=nagiosadmin,guestUser

 Requirement: implementing Disk-Space Check for alerts
  Solution: already a Perl Script checking for desired Drive Space at SNMP was present
  online so simply downloaded (checked all its functions for security issue) and added it
  to commands list passing suitable arguments.

Weitere Àhnliche Inhalte

Mehr von Abhishek Kumar

Squid for Load-Balancing & Cache-Proxy ~ A techXpress Guide
Squid for Load-Balancing & Cache-Proxy ~ A techXpress GuideSquid for Load-Balancing & Cache-Proxy ~ A techXpress Guide
Squid for Load-Balancing & Cache-Proxy ~ A techXpress GuideAbhishek Kumar
 
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress GuideEthernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress GuideAbhishek Kumar
 
Solaris Zones (native & lxbranded) ~ A techXpress Guide
Solaris Zones (native & lxbranded) ~ A techXpress GuideSolaris Zones (native & lxbranded) ~ A techXpress Guide
Solaris Zones (native & lxbranded) ~ A techXpress GuideAbhishek Kumar
 
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidthAn Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidthAbhishek Kumar
 
An Express Guide ~ Zabbix for IT Monitoring
An Express Guide ~ Zabbix for IT Monitoring An Express Guide ~ Zabbix for IT Monitoring
An Express Guide ~ Zabbix for IT Monitoring Abhishek Kumar
 
An Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & GraphingAn Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & GraphingAbhishek Kumar
 
An Express Guide ~ SNMP for Secure Rremote Resource Monitoring
An Express Guide ~ SNMP for Secure Rremote Resource MonitoringAn Express Guide ~ SNMP for Secure Rremote Resource Monitoring
An Express Guide ~ SNMP for Secure Rremote Resource MonitoringAbhishek Kumar
 
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'Abhishek Kumar
 
XSS Defeating Concept - Part 2
XSS Defeating Concept - Part 2XSS Defeating Concept - Part 2
XSS Defeating Concept - Part 2Abhishek Kumar
 
XSS Defeating Trick ~=ABK=~ WhitePaper
XSS Defeating Trick ~=ABK=~ WhitePaperXSS Defeating Trick ~=ABK=~ WhitePaper
XSS Defeating Trick ~=ABK=~ WhitePaperAbhishek Kumar
 
FreeSWITCH on RedHat, Fedora, CentOS
FreeSWITCH on RedHat, Fedora, CentOSFreeSWITCH on RedHat, Fedora, CentOS
FreeSWITCH on RedHat, Fedora, CentOSAbhishek Kumar
 

Mehr von Abhishek Kumar (11)

Squid for Load-Balancing & Cache-Proxy ~ A techXpress Guide
Squid for Load-Balancing & Cache-Proxy ~ A techXpress GuideSquid for Load-Balancing & Cache-Proxy ~ A techXpress Guide
Squid for Load-Balancing & Cache-Proxy ~ A techXpress Guide
 
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress GuideEthernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
Ethernet Bonding for Multiple NICs on Linux ~ A techXpress Guide
 
Solaris Zones (native & lxbranded) ~ A techXpress Guide
Solaris Zones (native & lxbranded) ~ A techXpress GuideSolaris Zones (native & lxbranded) ~ A techXpress Guide
Solaris Zones (native & lxbranded) ~ A techXpress Guide
 
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidthAn Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
An Express Guide ~ "dummynet" for tweaking network latencies & bandwidth
 
An Express Guide ~ Zabbix for IT Monitoring
An Express Guide ~ Zabbix for IT Monitoring An Express Guide ~ Zabbix for IT Monitoring
An Express Guide ~ Zabbix for IT Monitoring
 
An Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & GraphingAn Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
 
An Express Guide ~ SNMP for Secure Rremote Resource Monitoring
An Express Guide ~ SNMP for Secure Rremote Resource MonitoringAn Express Guide ~ SNMP for Secure Rremote Resource Monitoring
An Express Guide ~ SNMP for Secure Rremote Resource Monitoring
 
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
Presentation on "XSS Defeating Concept in (secure)SiteHoster" : 'nullcon-2011'
 
XSS Defeating Concept - Part 2
XSS Defeating Concept - Part 2XSS Defeating Concept - Part 2
XSS Defeating Concept - Part 2
 
XSS Defeating Trick ~=ABK=~ WhitePaper
XSS Defeating Trick ~=ABK=~ WhitePaperXSS Defeating Trick ~=ABK=~ WhitePaper
XSS Defeating Trick ~=ABK=~ WhitePaper
 
FreeSWITCH on RedHat, Fedora, CentOS
FreeSWITCH on RedHat, Fedora, CentOSFreeSWITCH on RedHat, Fedora, CentOS
FreeSWITCH on RedHat, Fedora, CentOS
 

KĂŒrzlich hochgeladen

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...gurkirankumar98700
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂșjo
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

KĂŒrzlich hochgeladen (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍾 8923113531 🎰 Avail...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

An Express Guide ~ Nagios for IT Infrastructure Monitoring

  • 1. Express-Guide ~to~ Basic Setup of Nagios an IT Infrastructure Monitoring Solution by, ABK ~ http://www.twitter.com/aBionic ::Task Detail::  Setting up Nagios machine on a LAN to monitor resources and services  Generating an e-mail notifications if any of them goes down ::Background:: Links: http://www.nagios.org/  Nagios is one of the most popular network-based IT Infrastructure Monitoring solution enabling organizations identify and resolve IT Infrastructure problems.  There is a Nagios Server box monitoring all desired hosts; hosts either run Nagios Clients ( like NRPE, more controllable) or get accessed over SNMP Service (this is better, if SNMPv3 is used). ::Execution Method:: To set up Nagios Server box and enabling Hosts to use it follow steps given below:  Setup a Nagios Server Box {in respect to Fedora/CentOS, may change slightly with distro} ◩ Pre-Requisite: Installation of Apache, PHP, GCC Compiler, GD Developer Libraries as â–Ș #yum -y install httpd php gcc â–Ș #yum -y install glibc glibc-common gd gd-devel ◩ Installation Step: â–Ș Create a user account and group for it ‱ shell commands:
  • 2. $su -l #useradd -m nagios #passwd nagios #groupadd nagcmd #usermod -a -G nagcmd nagios #usermod -a -G nagcmd apache â–Ș Download latest version of 'Nagios Core' and 'Nagios Plugins' from respective sections at [ Nagios Core: ], [ Nagios Plugins: http://www.nagios.org/download/plugins ] â–Ș Untar, Compile and Installing of Nagios {we had core-3.2.1 and plugins-1.4.14} ‱ shell commands: #tar -zxf nagios-3.2.1.tar.gz #tar -zxf nagios-plugins-1.4.14.tar.gz #cd nagios-3.2.1 #./configure –with-command-group=nagcmd #make all #make install #make install-init #make install-config #make install-commandmode #make install web-conf #htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin #cd ../nagios-plugins-1.4.14 #./configure --with-nagios-user=nagios –with-nagios- group=nagios #make #make install ‱ Above when you are using 'htpasswd' utility, it will ask for a password which will be your password for userid 'nagiosadmin' to login to Nagios Web-App. ‱ If you forget the password later, just rerun that single command to change password. â–Ș Making Nagios a System Service ‱ shell commands: #chkconfig --add nagios #chkconfig nagios on #service nagios start Note: If SELinux is in enforcing mode then, below commands also #chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin #chcon -R -t httpd_sys_content_t usr/local/nagios/share ◩ Customizing Configuration â–Ș The main configuration file will be '/usr/local/nagios/etc/nagios.cfg', with listing of all other configuration file.
  • 3. So, if any configuration file is added or removed its entry in 'nagios.cfg' should be altered respectively. â–Ș You can configure hosts, services, host-groups, service-groups, contacts, contact-groups. You can also configure commands to be referenced in services using which those will be checked. Now these commands actually mention all configurations along-with the Script and its parameters to be executed to check for that service. â–Ș This scripts are by default located at '/usr/local/nagios/libexec/' and respond in general output of return codes 0, 1, 2, 3 for OK, Warning, Critical, Unknown respectively. â–Ș Among these commands, the SNMP based commands will also require SNMP Community String to be passed as an argument. Security Note: Don't use 'public' as your community string, its not safe from Security perspective. â–Ș By default these settings are to be performed manually at file-level configuration. It gives you greater control over the configuration-model you want to follow; depending on count and type of hosts and services. But, if you want a GUI then you can download free Nagios Addons like NConf or NagiosQL. They are PHP-based GUI front-ends to configure your Nagios more easily.  Enabling Hosts' Services to be monitored by Nagios ◩ some 'Nagios Client' or 'SNMP daemon' needs to be configured on hosts to be monitored  for Nagios Client ◩ use 'NRPE' on Linux and 'NSClient++' on Windows, available free  for SNMP ◩ Installation: â–Ș On Windows, install it from 'Start Menu' > 'Control Panel' > 'Add or Remove Programs' > 'Add or Remove Windows Components' > 'Management and Monitoring Tools' > 'Details' > 'Simple Network Management Protocol' > 'OK' > 'Next' > follow next instructions â–Ș On Linux Machine #yum -y install net-snmp net-snmp-utils ◩ Configuration Steps: â–Ș On Windows Machine ‱ open 'Control Panel' > 'Administrative Tools' > 'Services' ‱ select SNMP, open its properties ‱ add the Community specified in Nagios configuration ‱ allow access to Nagios Server IP to access SNMP Daemon. â–Ș On Linux Machines ‱ edit snmpd.conf file ‱ remove 'public' community
  • 4. ‱ add text (within '<>') changing ' yourCommunityNameSpecified' to required name as per your configuration < rocommunity yourCommunityNameSpecified > â–Ș These settings are really basic (quick to go) policies. For an advanced and more secure version, go for policies mentioned in 'SNMP for secure resource monitoring' article or simply use SNMPv3 if you already know it. ::Tools/Technology Used:: ‱ Nagios-Core : http://www.nagios.org/download/core ‱ Nagios-Plugins : http://www.nagios.org/download/plugins ‱ Net-SNMP : http://www.net-snmp.org/ ‱ NSClient++ : http://www.nsclient.org/nscp/ ‱ NRPE : http://sourceforge.net/projects/nagios/files/nrpe-2.x/ ‱ NagiosMailACK : http://exchange.nagios.org/directory/Utilities/NagiosMailACK/details ::Inference::  It's a highly scalable IT infrastructure monitoring and alerting solution with great architecture allowing entire community to contribute to its features as add-ons, services making it the most popular solution.  It don't have a great GUI, just a decent one. Entire configuration is directly via files which is in a way great, because it gives more control over what actually gets set, and backup-restore is too easy also. ::Troubleshooting/Updates:: these are few specific issues personally faced-&-solved  Problem: in one pre-configured nagios box the rendering of data vanished Solution: I searched for CSS files in the Web Files directory and found that Stylesheet File somehow got truncated on the server, replacing them with the original files solved it.  Problem: a problem occurred in the Nagios Box configured initially, the notification mails weren't getting delivered rather got piled-up in mail queue. Solution: First we thought there is some problem with mail service, so we uninstalled it and installed another mail-service but still it didn't got resolved. Checking 'Mail Queue' of standard service and new mail service showed that still all mails were sent via old one.
  • 5. Checked for system binaries, and found there were two extra binaries per mail-service other than default 'mail' service on linux. So, changing nagios configuration to that specific binary for sending mail solved the problem.  Requirement: Nagios Web-Interface was available only over Organization's Network, that's not a thing to debate or change with respect to security. But to acknowledge the Alert Notification Mails from it, access was required to its UI. So, a work-around was required. The most suitable and quick was replying to that Notification mail itself for Acknowledgment, as alert-mail-notification worked fine. Solution: The online popular & available solution for it was setting up a ProcMail server on Nagios server and make its entry in Organization's MX Server to enable it receiving all replies. Then getting a perl script running to check for received mails and acknowledge the alert on correct pattern-acknowledgment mail. Though it was nice, but required new entries in MX Server per Nagios box. A new service on a box means a new security vector. Also required one more server to be run on Nagios Box increasing the already spiking resource load. ◩ So, I developed a Nagios Supporting Service 'NagiosMailACK' { could be studied/downloaded: http://sourceforge.net/projects/nagiosmailack/ } It was low on resource consumption and just required a single GMail ID to receive acknowledgments for all Nagios Servers by using different Nagios_ID like parameters for different Nagios boxes.  Requirement: a Guest user with permissions to only view Host & Service status Solution: firstly adding a guest user to htpasswd.users file ◩ at shell #htpasswd /usr/local/nagios/etc/htpasswd.users guestUser remember don't attach '-c' switch to it, otherwise old users will get replaced ◩ Now, open '/usr/local/nagios/etc/cgi.cfg' for editing and change in following way â–Ș find following (or similar) lines authorized_for_all_services=nagiosadmin authorized_for_all_hosts=nagiosadmin â–Ș add new user entry to make it look like authorized_for_all_services=nagiosadmin, guestUser authorized_for_all_hosts=nagiosadmin,guestUser  Requirement: implementing Disk-Space Check for alerts Solution: already a Perl Script checking for desired Drive Space at SNMP was present online so simply downloaded (checked all its functions for security issue) and added it to commands list passing suitable arguments.