background preloader

Nagios

Facebook Twitter

Nagios nrpe and sudo: “NRPE: Unable to read output” | cyberz.org. [RESOLU] Problèmes d'arguments avec CHECK_NRPE et check_disk. Check_by_ssh. Attention, je modifie le document, les informations sont mouvantes, … (Pierre, le 24/03/2010) Pour effectuer des check_by_ssh avec Nagios, il faut au préalable procéder à l’échange de clés entre le serveur nagios et l’hôte supervisé.

Génération des clefs sur le serveur nagios Sur le serveur nagios, se connecter avec l’utilisateur nagios et entrer la commande suivante : su - nagios cd ~ mkdir .ssh ssh-keygen -b 2048 -t rsa le terminal renvoie alors, laissez le chemin par défaut (normalement, il vous propose répertoire .ssh du home de l’utilisateur nagios) Generating public/private rsa key pair. Appuyer trois fois sur entrée pour valider la création de cette double clé public privé. Mise en place de la clef public sur les serveurs à auditer Ensuite, créer un répertoire ssh dans le répertoire de départ de la machine serveur distante si il n’existe pas gràce à la commande : ssh user@serveur_distant "mkdir .ssh; chmod 0700 .ssh" scp .ssh/id_rsa.pub user@machine_distante:.ssh/authorized_keys2 Testons. Configuration Overview. Up To: Contents See Also: Main Configuration File, Object Configuration Overview, CGI Configuration File Introduction There are several different configuration files that you're going to need to create or edit before you start monitoring anything.

Be patient! Note: Sample configuration files are installed in the /usr/local/nagios/etc/ directory when you follow the quickstart installation guide. Main Configuration File The main configuration file contains a number of directives that affect how the Nagios daemon operates. Documentation for the main configuration file can be found here. Resource File(s) Resource files can be used to store user-defined macros. You can specify one or more optional resource files by using the resource_file directive in your main configuration file. Object Definition Files Object definition files are used to define hosts, services, hostgroups, contacts, contactgroups, commands, etc. CGI Configuration File Documentation for the CGI configuration file can be found here. How To Install Nagios On CentOS 6.

Step 1 - Install Packages on Monitoring Server rpm -Uvh rpm -Uvh yum -y install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpd chkconfig httpd on && chkconfig nagios on service httpd start && service nagios start We should also enable SWAP memory on this droplet, at least 2GB: dd if=/dev/zero of=/swap bs=1024 count=2097152 mkswap /swap && chown root. /swap && chmod 0600 /swap && swapon /swap echo /swap swap swap defaults 0 0 >> /etc/fstab echo vm.swappiness = 0 >> /etc/sysctl.conf && sysctl -p Step 2 - Set Password Protection Set Nagios Admin Panel Password: htpasswd -c /etc/nagios/passwd nagiosadmin Make sure to keep this username as "nagiosadmin" - otherwise you would have to change /etc/nagios/cgi.cfg and redefine authorized admin. Now you can navigate over to your droplet's IP address and login.

Step 4 - Install NRPE on Clients.

Graph

Plugin Nagios en Perl. Entrons dans le vif du sujet !! Il est plus simple de comprendre en utilisant un exemple. Nous avons à notre disposition deux serveurs : La surveillance pourrait se faire localement, le principe est le même. Parlons maintenant Perl. Nous allons maintenant utiliser deux méthodes pour écrire nos plugins. Pour illustrer un exemple de méthode simple, créons un premier plugin avec pour nom check_file_exist . Use strict ; use warnings ; use Getopt::Long ; use File::Basename ; my ( $fichier_a_verifier ) = (); GetOptions( ' file|f=s ' = > \$fichier_a_verifier ); if ( not defined $fichier_a_verifier ) { print " Il manque l ' argument - - file ou - f\n " ; exit 0 ; } my $NOM_PROCESS = ' CheckFileExiste ' ; my $nom_fichier = basename $fichier_a_verifier ; if ( - e $fichier_a_verifier ) { print " $ NOM_PROCESS OK - $ nom_fichier exists " ; exit 0 ; } else { print " $ NOM_PROCESS CRITICAL - $ nom_fichier not exists " ; exit 2 ; } __END__ On remarque sa simplicité.

Le programme fonctionne bien. Understanding Macros and How They Work. Up To: Contents See Also: List of Available Macros Macros One of the main features that make Nagios so flexible is the ability to use macros in command defintions. Macros allow you to reference information from hosts, services, and other sources in your commands. Macro Substitution - How Macros Work Before Nagios executes a command, it will replace any macros it finds in the command definition with their corresponding values. Certain macros may themselves contain other macros. Example 1: Host Address Macro When you use host and service macros in command definitions, they refer to values for the host or service for which the command is being run. Define host{ host_name linuxbox address 192.168.1.2 check_command check_ping ... } define command{ command_name check_ping command_line /usr/local/nagios/libexec/check_ping -H $HOSTADDRESS$ -w 100.0,90% -c 200.0,60% } the expanded/final command line to be executed for the host's check command would look like this: Pretty simple, right?

On-Demand Macros. Message d'erreur Return code of 127 is out of bound. Check_ftp | Nagios Plugins. Time-Saving Tricks For Object Definitions. Or... "How To Preserve Your Sanity" Up To: Contents See Also: Object Configuration, Object Inheritance Introduction This documentation attempts to explain how you can exploit the (somewhat) hidden features of template-based object definitions to save your sanity. Object types that are not listed above (i.e. timeperiods, commands, etc.) do not support the features I'm about to describe. Regular Expression Matching The examples I give below use "standard" matching of object names and *require* use_regexp_matching to be *disabled*. If you wish, you can enable regular expression matching for object names by using the use_regexp_matching config option.

Note: Be careful when enabling regular expression matching - you may have to change your config file, since some directives that you might not want to be interpreted as a regular expression just might be! Service Definitions define service{ host_name HOST1,HOST2,HOST3,... define service{ hostgroup_name HOSTGROUP1,HOSTGROUP2,... Hostgroups. Nagios HTTP WARNING: HTTP/1.1 403 Forbidden.

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden Whenever I newly setup the nagios server I mostly get this error “Nagios HTTP WARNING: HTTP/1.1 403 Forbidden”. In dashboard it shows alert on localhost i.e our own newly set up nagios server. To solve this alert, create a index.html file inside /var/www/html in server touch /var/www/html/index.html Restart the httpd and nagios service.

/etc/init.d/nagios restart /etc/init.d/httpd restart Wait for a few minutes the alert will be gone. OK do you want to know some more,let me explain some more part of troubleshooting steps. You can use check_http plugin here with command line to check do the problem exist or not. Note: check your check_http plugin where it is located in server. Sharad chhetri (396 Posts) My name is Sharad Chhetri. Nagios pour débutants. Nous avons besoin d'un agent sur les serveurs à surveiller et des plugins Nagios. Nous utiliserons les plugins « NRPE ».NRPE(Nagios Remote Plugin Executor) est un « Addons » pour Nagios qui permet d'exécuter des plugins sur un serveur Linux/Unix distant. Cela permet de surveiller des ressources locales (charge du processeur, utilisation de la mémoire, espace disque…) qui ne sont normalement pas disponibles depuis d'autres machines. Afin d'interroger le client NRPE il faudra utiliser le greffon "check_nrpe" sur notre serveur Nagios « supervision ».

Pour ce faire il va falloir installer NRPE sur notre serveur Nagios, et sur toutes les machines à surveiller. De plus il faudra installer les plugins Nagios sur chaque serveur distant à surveiller. Avant de commencer l'installation, nous devons d'abord nous assurer de disposer de la bibliothèque « libssl-dev », sinon, il faut l'installer. Notre serveur servprod à surveiller est un serveur sous "Debian".

Téléchargement des archives Sélectionnez. How To Install Nagios On CentOS 6. Documentation. Looking for documentation on Nagios? Look no further. There are multiple sources of helpful information that can help you get up and running quickly and expand your skillset. Nagios Library The Nagios Library contains official tips, tutorials, videos, documentation, and manuals on Nagios Core, Nagios XI, Nagios V-Shell, Nagios Fusion, and other Nagios projects. Visit the Nagios Library at Quickstart Guides Get up and running with Nagios fast. Quick Links Links to commonly requested documentation and information resources are linked below. Nagios Core Documentation - Official documentation for Nagios Core, NRPE, and NDOUtilsNagios Core FAQs - Answers to Frequently Asked Questions about Nagios CoreNagios Wiki - Community contributed documentation and knowledge Training Need to get up to speed on Nagios quickly with the help of expert trainers?

How to get remote disk,swap,process status using nagios and nrpe | :: HawkEYE Expression :: For Redhat 5.4 or CentOS 5.4 can just add rpmforge repository .. then do the following to the monitoring host. yum install nagios-nrpe nagios-nrpe-plugins -y which pretty much covered in previous post regarding nagios installation. only need to ammend the file at vi /etc/nagios/objects/commands.cfg to add the following.. # 'check_nrpe' command definition define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ } and for each remote server that you want to monitor.

Yum install nagios-nrpe -y edit the /etc/nagios/nrpe.cfg find the line started with allowed_hosts, append the monitoring server ip accordingly .. so that it can access to the remote host with SSL successfully. allowed_hosts=192.168.19.31 you can also changed the following code to suit your need. then just need to start it. /etc/init.d/nrpe start chkconfig nrpe on then can test.. with something like this from the monitoring server. oh well.. that’s pretty much of it.