From: Eduardo M. <ema...@bs...> - 2005-03-01 18:06:26
|
Using Method4 with Nagios 1.2 Using FAQ http://wiki.perfparse.org/tiki-index.php?page=BuildingMethod4Example I have installed perfparse per the FAQ and it seems to be going ok except that I don't have any data in the mysql tables. Am I missing a step? Did I do something wrong? I abandoned my last install because nagios 2.x is in beta, you guys supported nagios 1.2 more and I receive only comments but no help on the configuration... so... Here is my next shot at this with nagios 1.2 I am using RHAS3. I've installed the following packages. +++++++++++++++++++++++++++++++++ <SHELL>rpm -ivh perl-CGI-2.81-89.10.i386.rpm <SHELL>rpm -ivh perl-DBD-MySQL-2.9003-5.i386.rpm <SHELL>rpm -ivh perl-DBI-1.32-9.i386.rpm <SHELL>rpm -ivh MySQL-client-4.1.9-0.i386.rpm <SHELL>rpm -ivh MySQL-devel-4.1.9-0.i386.rpm <SHELL>rpm -ivh MySQL-server-4.1.9-0.i386.rpm +++++++++++++++++++++++++++++++++++ Using the nagios Plugins version 1.4 ++++++++++++++++++++++++++++++++++++ <SHELL>tar -zxvf nagios-plugins-1.4.tar.gz <SHELL>./configure --prefix=/opt/nagios --with-nagios-user=nagios --with-nagios-group=nagios <SHELL>make all <SHELL>make install ++++++++++++++++++++++++++++++++++++ Using nrpe-2.0.tar.gz ++++++++++++++++++++++++++++++++++++ <SHELL>tar -zxvf nrpe-2.0.tar.gz <SHELL>./configure --prefix=/opt/nagios --with-nagios-user=nagios --with-nagios-group=nagios <SHELL>make all ...configured nrpe <SHELL>service xinetd stop <SHELL>service xinetd start <SHELL>netstat -a tcp 0 0 *:nrpe *:* LISTEN ++++++++++++++++++++++++++++++++++++ So I've decided to use Nagios Version 1.2. I've installed the following packages. +++++++++++++++++++++++++++++++++ <SHELL>rpm -ivh glib-1.2.10-11.1.i386.rpm <SHELL>rpm -ivh glib-devel-1.2.10-11.1.i386.rpm <SHELL>rpm -ivh MYlibgd-devel-2.0.23-rhas3.0_1.i386.rpm <SHELL>rpm -ivh MYlibgd-2.0.23-rhas3.0_1.i386.rpm <SHELL>rpm -ivh libjpeg-6b-30.i386.rpm <SHELL>rpm -ivh libjpeg-devel-6b-30.i386.rpm <SHELL>rpm -ivh libpng-devel-1.2.2-25.i386.rpm <SHELL>rpm -ivh libpng-1.2.2-25.i386.rpm <SHELL>rpm -ivh gd-1.8.4-12.3.1.rpm <SHELL>rpm -ivh gd-devel-1.8.4-12.3.1.rpm <SHELL>rpm -ivh glib2-2.2.3.rpm <SHELL>rpm -ivh glib2-devel-2.2.3.rpm <SHELL>rpm -ivh freetype-2.1.4-4.0.i386.rpm <SHELL>rpm -ivh freetype-devel-2.1.4-4.0.i386.rpm <SHELL>tar -zxvf nagios-1.2.tar.gz <SHELL>./configure --prefix=/opt/nagios \ --with-template-objects \ --with-template-extinfo \ --with-init-dir=/etc/rc.d/init.d/ \ --with-default-status \ --with-default-comments \ --with-default-retention \ --with-default-downtime \ --with-default-perfdata \ --with-nagios-user=nagios \ --with-nagios-group=nagios \ --with-gd-inc=/opt/local/include \ --with-gd-lib=/opt/local/lib make all (makes package) make fullinstall (installs all features) make install-config (installs example config files) ...configured Nagios to accept checks for NRPE for the following services nrpe.cfg file on the client. command[check_root]=/opt/nagios/libexec/check_disk 85 90 / command[check_boot]=/opt/nagios/libexec/check_disk 85 90 /boot command[check_home=/opt/nagios/libexec/check_disk 85 90 /home command[check_opt]=/opt/nagios/libexec/check_disk 85 90 /opt command[check_space]=/opt/nagios/libexec/check_disk 85 90 /space command[check_usr]=/opt/nagios/libexec/check_disk 85 90 /usr command[check_var]=/opt/nagios/libexec/check_disk 85 90 /var command[check_swap]=/opt/nagios/libexec/check_swap 50 20 command[check_users]=/opt/nagios/libexec/check_users 850 1000 command[check_load]=/opt/nagios/libexec/check_load 5 10 15 20 25 30 command[check_mem.pl]=/opt/nagios/libexec/check_mem.pl -u -w 85 -c 90 command[check_total_procs]=/opt/nagios/libexec/check_procs -w 150 -c 200 command[check_zombie_procs]=/opt/nagios/libexec/check_procs 5 10 -s Z ...OUTPUT for plugins is as follows DISK OK - free space: / 339 MB (45%);| /=416MB;641;679;0;755 DISK OK - free space: /boot 219 MB (87%);| /boot=31MB;212;225;0;250 DISK OK - free space: /home 779 MB (77%);| /home=233MB;859;909;0;1011 DISK OK - free space: /opt 803 MB (79%);| /opt=208MB;859;909;0;1011 DISK OK - free space: /space 1302 MB (75%);| /space=428MB;1469;1556;0;1729 DISK CRITICAL - free space: /usr 36 MB (2%);| /usr=2026MB;1751;1854;0;2061 DISK OK - free space: /var 527 MB (34%);| /var=1025MB;1318;1395;0;1551 SWAP OK: 100% free (1024 MB out of 1028 MB) |swap=1024MB;513;205;0;1027 USERS OK - 1 users currently logged in |users=1;850;1000;0 OK - load average: 0.00, 0.01, 0.01|load1=0.000000;5.000000;10.000000;0.000000 load5=0.010000;15.000000;20.000000;0.000000 load15=0.010000;25.000000;30.000000;0.000000 Memory OK - 43.1% (5012 kB) used PROCS OK: 41 processes PROCS OK: 0 processes with STATE = Z ...DEBUG Nagios with the following command.... /opt/nagios/bin/nagios -v /opt/nagios/etc/nagios.cfg Total Warnings: 0 Total Errors: 0 Things look okay - No serious problems were detected during the pre-flight check <SHELL> vi /opt/nagios/etc/nagios.cfg process_performance_data = 1 cfg_file=/opt/nagios/etc/nagios_perfparse.cfg host_perfdata_command=process-host-perfdata service_perfdata_command=process-service-perfdata <SHELL> vi /opt/nagios/etc/resource.cfg # Sets $USER2$ to be the path to perfparse $USER2$=/opt/nagios <SHELL> vi /opt/nagios/etc/misccommands.cfg #Comment out the following definitions for host and service performance data: #define command{ #command_name process-host-perfdata #... #} #define command{ #command_name process-service-perfdata #... #} +++++++++++++++++++++++++++++++++ Though I won't be getting performance data from some of those plugins this should be fine. ----MYSQL ---- installed packages shown above +++++++++++++++++++++++++++++++++++++++++++++++++ #MySQL root password change #LOG IN as the root user for the mysql database #Create perfparse database # Create Nagios User and Give Nagios User permission to write to perfparse database # Show the grants #Exit mysql <SHELL>mysqladmin password <ENTER PASSWORD HERE> <SHELL>mysql -u root -p Enter password: <ENTER PASSWORD HERE> mysql>create database perfparse; mysql> GRANT ALL ON perfparse.* TO'nagios' IDENTIFIED BY 'A Nagios Password'; mysql>show grants for 'nagios'; +-------------------------------------------------------------------------------------------------------+ | Grants for nagios@% | +-------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'nagios'@'%' IDENTIFIED BY PASSWORD '*8C00F55AEF0226B9998AC39C6C9A099B' | | GRANT ALL PRIVILEGES ON `perfparse`.* TO 'nagios'@'%' WITH GRANT OPTION | +-------------------------------------------------------------------------------------------------------+ 2 rows in set (0.02 sec) mysql>exit +++++++++++++++++++++++++++++++++++++++++++++++++ PerfParse Install (perfparse-0.105.5) +++++++++++++++++++++++++++++++++++++++++++++++++ #Unpackage PerfParse #Configure PerfParse #Create Database Tables #Edit perfparse.cfg <SHELL>./configure --prefix=/opt/nagios --with-imagedir=/opt/nagios/share/images/ --with-cgidir=/opt/nagios/sbin --with-http_image_path=/nagios/images --with-glib2=/usr/lib/glib-2.0 <SHELL>make <SHELL>make install-strip <SHELL> cat scripts/mysql_create.sql | /usr/bin/mysql -u root -p -D perfparse <SHELL>vi /opt/nagios/etc/perfparse.cfg Service_Log = "|/opt/nagios/var/perfdata-service.log" Service_Log_Position_Mark_Path = "/opt/nagios/var" Output_Log_File = "yes" Output_Log_Filename = "/var/log/perfparse_output_log" Storage_Modules_Dir = "/opt/nagios/lib" Storage_Modules_Load = "mysql" Use_Storage_Mysql = "yes" No_Raw_Data = "yes" No_Bin_Data = "yes" # Database Authentication DB_User = "nagios" DB_Name = "perfparse" DB_Pass = "A Nagios Password" DB_Host = "localhost" <SHELL> vi /opt/nagios/etc/nagios_perfparse.cfg replace perfparse_nagios_command.pl with perfparse_nagios_pipe_command.pl <SHELL> vi perfparse_nagios_pipe_command.pl #add at the end... system ('/opt/nagios/bin/perfparse-log2mysql --serviceperf-log /opt/nagios/var/perfdata-service.log'); #Permissions for "perfdata-service.log" need to be set as nagios daemon can write to the FIFO. <SHELL> touch /opt/nagios/var/perfdata-service.log <SHELL> chown nagios.nagios /opt/nagios/var/perfdata-service.log <SHELL> chmod 660 perfdata-service.log <SHELL> touch /opt/nagios/var/perfdata_log.perfdata-service.log.mark <SHELL> chown nagios.nagios /opt/nagios/var/perfdata_log.perfdata-service.log.mark <SHELL> chmod 660 perfdata_log.perfdata-service.log.mark <SHELL> touch /opt/nagios/var/perfdata-host.log <SHELL> chown nagios.nagios /opt/nagios/var/perfdata-host.log <SHELL> chmod 660 perfdata-service.log <SHELL># vi /var/spool/cron/crontabs/root # Purge PerfParse DB daily at 3 AM. 0 1 * * * /opt/nagios/bin/perfparse-db-purge ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <SHELL>/opt/nagios/bin/perfparsed --show_config Perfparsed [options] # File where Perfparse logs messages # Error_Log = "string" Error_Log = "perfparse.log" # Rotate Perfparse log files # Error_Log_Rotate = "Y/N" Error_Log_Rotate = "Yes" # Keep N days of error log. Compress recent logs and remove too old ones # Error_Log_Keep_N_Days = "value" Error_Log_Keep_N_Days = "7" # When perfparse cannot parse a line, it drops it to that file # Drop_File = "string" Drop_File = "/tmp/perfparse.drop" # # Drop_File_Rotate = "Y/N" Drop_File_Rotate = "Yes" # Keep N days of drop file log. Compress recent logs and remove too old ones # Drop_File_Keep_N_Days = "value" Drop_File_Keep_N_Days = "7" # Port for perfparsed server # Put 0 or "" to disable the server # Server_Port = "value" Server_Port = "1976" # Log source from nagios (or other tools) that perfparse will scan # Authorized values: a file name, '-' for stdin, '|' for a fifo and '>' for a host:port socket # For sockets, a command 'history' will be sent before retreiving the data # Service_Log = "string" Service_Log = "|/opt/nagios/var/perfdata-service.log" # Save the read position in the nagios log file ? If yes, perfparse will start from that position instead of from the beginning # Service_Log_Save_Position = "Y/N" Service_Log_Save_Position = "yes" # Path for files containing the read position for nagios log files # Service_Log_Position_Mark_Path = "string" Service_Log_Position_Mark_Path = "/opt/nagios/var" # Lock file for perfparsed # Daemon_Lock = "string" Daemon_Lock = "/opt/nagios/var/perfparsed.lock" # Run perfparsed as a daemon # Daemonize = "Y/N" Daemonize = "no" # Perform some periodic cleanup every day # Periodic_Cleanup = "Y/N" Periodic_Cleanup = "yes" # Lock file for perfparsed periodic cleanup process # Periodic_Cleanup_Lock = "string" Periodic_Cleanup_Lock = "/opt/nagios/var/perfparsed_periodic_cleanup.lock" # Perform some periodic cleanup every day at HHMM # Periodic_Cleanup_Hour = "value" Periodic_Cleanup_Hour = "0230" # Dummy hostname if gethostname() does not work # Dummy_Hostname = "string" Dummy_Hostname = "dummy" # Don't store raw data # No_Raw_Data = "Y/N" No_Raw_Data = "yes" # Don't store bin data # No_Bin_Data = "Y/N" No_Bin_Data = "yes" # Path where storage modules are # Storage_Modules_Dir = "string" Storage_Modules_Dir = "/opt/nagios/lib" # Modules to load (Coma separated values) # Storage_Modules_Load = "string" Storage_Modules_Load = "mysql" # File to contain Storage Modules Status # Storage_Modules_Status_File = "string" Storage_Modules_Status_File = "/opt/nagios/var/storage_modules.status" # Storage Module : mysql # ============================== # Database user # DB_User = "string" DB_User = "nagios" # Database password # DB_Pass = "string" DB_Pass = "123412341234" # Database name # DB_Name = "string" DB_Name = "perfparse" # Database hostname # DB_Host = "string" DB_Host = "localhost" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <SHELL>less perfparse.log.20050301.log 2005/03/01 10:21:10 [ storage.c:95 22822 ] storage_mysql module successfully loaded ----------------LOG IN - Cheking DATABASE in MYSQL---------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <SHELL>mysql -u root -p Enter password: <ENTER PASSWORD HERE> mysql> use perfparse; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> mysql> show tables ; +---------------------------------+ | Tables_in_perfparse | +---------------------------------+ | perfdata_bin_summary | | perfdata_bin_summary_data | | perfdata_bin_summary_del_policy | | perfdata_bin_summary_header | | perfdata_delete_policy | | perfdata_graphs | | perfdata_host | | perfdata_host_group | | perfdata_prefs | | perfdata_raw_summary | | perfdata_raw_summary_data | | perfdata_registry | | perfdata_service | | perfdata_service_bin | | perfdata_service_metric | | perfdata_service_raw | | perfdata_state | | perfdata_users | +---------------------------------+ 18 rows in set (0.00 sec) mysql> select * from perfdata_bin_summary ; Empty set (0.00 sec) mysql> select * from perfdata_bin_summary_data ; Empty set (0.00 sec) mysql> select * from perfdata_bin_summary_del_policy ; Empty set (0.00 sec) mysql> select * from perfdata_bin_summary_header ; Empty set (0.00 sec) mysql> select * from perfdata_delete_policy ; Empty set (0.00 sec) mysql> select * from perfdata_graphs ; Empty set (0.00 sec) mysql> select * from perfdata_host ; Empty set (0.00 sec) mysql> select * from perfdata_host_group ; Empty set (0.00 sec) mysql> select * from perfdata_prefs ; Empty set (0.00 sec) mysql> select * from perfdata_raw_summary ; Empty set (0.00 sec) mysql> select * from perfdata_raw_summary_data ; Empty set (0.00 sec) mysql> select * from perfdata_registry ; +-------+---------------------+--------+---------------------+ | host | rkey | rvalue | ctime | +-------+---------------------+--------+---------------------+ | dummy | pp/database/version | 0.19 | 2005-02-28 12:44:35 | +-------+---------------------+--------+---------------------+ 1 row in set (0.00 sec) mysql> select * from perfdata_service ; Empty set (0.00 sec) mysql> select * from perfdata_service_bin ; Empty set (0.00 sec) mysql> select * from perfdata_service_metric ; Empty set (0.00 sec) mysql> select * from perfdata_service_raw ; Empty set (0.00 sec) mysql> select * from perfdata_state ; Empty set (0.00 sec) mysql> select * from perfdata_users ; Empty set (0.00 sec) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Though I have nothing in the database, however, I do see the following files change frequently: <SHELL>less /opt/nagios/var/perfdata-service.log 1109695640 machine1 /var DISK OK - free space: /var 527 MB (34%): OK /var=1025MB;1318;1395;0;1551 <SHELL>less /opt/nagios/var/perfdata-service.log 1109695685 machine1 /home DISK OK - free space: /home 779 MB (77%): OK /home=233MB;859;909;0;1011 <SHELL>less /opt/nagios/var/perfdata-service.log 1109695730 machine1 / DISK OK - free space: / 339 MB (45%): OK /=416MB;641;679;0;755 <SHELL>less /opt/nagios/var/perfdata-service.log 1109695735 machine1 swap SWAP OK: 100% free (1024 MB out of 1028 MB) OK swap=1024MB;513;205;0;1027 <SHELL>less /opt/nagios/var/perfdata-host.log 1109698839 machine1 PING OK - Packet loss = 0%, RTA = 0.38 ms <SHELL>less /opt/nagios/var/perfdata-host.log 1109698899 machine1 PING OK - Packet loss = 0%, RTA = 0.33 ms <SHELL>less /opt/nagios/var/perfdata-host.log 1109698959 machine1 PING OK - Packet loss = 0%, RTA = 0.31 ms ++++++++++++++ I also see the following information in this file ++++++++++++ <SHELL> less /opt/nagios/var/status.sav # Nagios 1.2 Retention File CREATED: 1109698633 PROGRAM: 1;1;1;1;0;1;1;1 # Nagios 1.2 Retention File CREATED: 1109698633 PROGRAM: 1;1;1;1;0;1;1;1 HOST: machine1;0;1109698630;1;407755;0;0;0;0;1;1;0;1;1;1;1109290887;(Host assumed to be up) SERVICE: machine1;/;0;1109698630;0;96225;0;0;311528;0;0;1;1;1;1;0;1;1;1;1;1109602653;DISK OK - free space: / 339 MB (45%): SERVICE: machine1;/boot;0;1109698590;0;96210;0;0;311527;0;0;1;1;1;1;0;1;1;1;1;1109602662;DISK OK - free space: /boot 219 MB (87%): SERVICE: machine1;/home;0;1109698596;0;96203;0;0;311528;0;0;1;1;1;1;0;1;1;1;1;1109602668;DISK OK - free space: /home 779 MB (77%): SERVICE: machine1;/usr;2;1109698603;0;241;0;0;407486;1109291150;1;1;1;1;1;0;1;1;1;1;1109291150;DISK CRITICAL - free space: /usr 36 MB (2%): SERVICE: machine1;/var;0;1109698610;0;96159;0;0;311526;0;0;1;1;1;1;0;1;1;1;1;1109602682;DISK OK - free space: /var 527 MB (34%): SERVICE: machine1;SSH;0;1109698617;0;407682;0;0;0;0;0;1;1;1;1;0;1;1;1;1;1109290922;SSH OK - OpenSSH_3.6.1p2 (protocol 1.99) SERVICE: machine1;load;0;1109698565;0;96143;0;0;311477;0;0;1;1;1;1;0;1;1;1;1;1109602697;OK - load average: 0.00, 0.04, 0.03 SERVICE: machine1;memory.pl;0;1109698571;0;96138;0;0;2463;0;0;1;1;1;1;0;1;1;1;1;1109602702;Memory OK - 37.7% (5044 kB) used SERVICE: machine1;ping;0;1109698580;0;407547;0;0;0;0;0;1;1;1;1;0;1;1;1;1;1109290944;PING OK - Packet loss = 0%, RTA = 0.53 ms SERVICE: machine1;swap;0;1109698586;0;96215;0;0;311527;0;0;1;1;1;1;0;1;1;1;1;1109602657;SWAP OK: 100% free (1024 MB out of 1028 MB) SERVICE: machine1;total_procs;0;1109698594;0;96210;0;0;311527;0;0;1;1;1;1;0;1;1;1;1;1109602662;PROCS OK: 38 processes SERVICE: machine1;users;0;1109698600;0;96201;0;0;311526;0;0;1;1;1;1;0;1;1;1;1;1109602672;USERS OK - 0 users currently logged in SERVICE: machine1;zombie_procs;0;1109698607;0;96195;0;0;311527;0;0;1;1;1;1;0;1;1;1;1;1109602677;PROCS OK: 0 processes with STATE = Z I would really like to get this working. I will write up a thorough FAQ on this if I can get it working. Please help. -Eduardo |