Friday, June 29, 2018

Nagios do2db-3x: mysql_error: 'Incorrect key file for table

Nagios do2db-3x: mysql_error: 'Incorrect key file for table

Nagios Error Code:-

Jun 23 16:15:40 eznag ndo2db-3x: mysql_error: 'Incorrect key file for table './nagios/nagios_timedevents.MYI'; try to repair it'
Jun 23 16:15:40 eznag ndo2db-3x: Error: mysql_query() failed for 'DELETE FROM nagios_timedeventqueue WHERE instance_id='1' AND scheduled_time<FROM_UNIXTIME(1529750740)'
Jun 23 16:15:40 eznag ndo2db-3x: mysql_error: 'Incorrect key file for table './nagios/nagios_timedeventqueue.MYI'; try to repair it'
Jun 23 16:15:40 eznag ndo2db-3x: Error: mysql_query() failed for 'INSERT INTO nagios_hostchecks SET instance_id='1', host_object_id='406', check_type='0', is_raw_check='0', current_check_attempt='1', max_check_attempts='10', state='0', state_type='1', start_time=FROM_UNIXTIME(1529750740), start_time_usec='126616', end_time=FROM_UNIXTIME(0), end_time_usec='0', timeout='30', early_timeout='0', execution_time='0.000000', latency='0.126000', return_code='0', output='', long_output='', perfdata='', command_object_id='1', command_args='', command_line='/usr/local/nagios/libexec/check_ping -H 192\.168\.10\.3 -w 3000\.0,80% -c 5000\.0,100% -p 5' ON DUPLICATE KEY UPDATE instance_id='1', host_object_id='406', check_type='0', is_raw_check='0', current_check_attempt='1', max_check_attempts='10', state='0', state_type='1', start_time=FROM_UNIXTIME(1529750740), start_time_usec='126616', end_time=FROM_UNIXTIME(0), end_time_usec='0', timeout='30', early_timeout='0', execution_time='0.000000', latency='0.126000', return_code='0', output='', long_output='', perfdata='''
Jun 23 16:15:40 eznag ndo2db-3x: mysql_error: 'Incorrect key file for table './nagios/nagios_hostchecks.MYI'; try to repair it'

Resolution:-

Run below Mysql Linux command on Nagios Linux node.

[root@eznag log]#mysqlcheck --user=nagios --password=nagios --repair --all-databases
[root@eznag log]#myisamchk --safe-recover /var/lib/mysql/*/*.MYI

Recover DB safer mode. You can see logs all status "OK".

[root@eznag log]# mysqlcheck -u nagios -p nagios
Enter password:
nagios.nagios_acknowledgements                     OK
nagios.nagios_commands                             OK
nagios.nagios_commenthistory                       OK
nagios.nagios_comments                             OK
nagios.nagios_configfiles                          OK
nagios.nagios_configfilevariables                  OK
nagios.nagios_conninfo                             OK
nagios.nagios_contact_addresses                    OK
nagios.nagios_contact_notificationcommands         OK
nagios.nagios_contactgroup_members                 OK
nagios.nagios_contactgroups                        OK
nagios.nagios_contactnotificationmethods           OK
nagios.nagios_contactnotifications                 OK
nagios.nagios_contacts                             OK
nagios.nagios_contactstatus                        OK
nagios.nagios_customvariables                      OK
nagios.nagios_customvariablestatus                 OK
nagios.nagios_dbversion                            OK
nagios.nagios_downtimehistory                      OK
nagios.nagios_eventhandlers                        OK
nagios.nagios_externalcommands                     OK
nagios.nagios_flappinghistory                      OK
nagios.nagios_host_contactgroups                   OK
nagios.nagios_host_contacts                        OK
nagios.nagios_host_parenthosts                     OK
nagios.nagios_hostchecks                           OK
nagios.nagios_hostdependencies                     OK
nagios.nagios_hostescalation_contactgroups         OK
nagios.nagios_hostescalation_contacts              OK
nagios.nagios_hostescalations                      OK
nagios.nagios_hostgroup_members                    OK
nagios.nagios_hostgroups                           OK
nagios.nagios_hosts                                OK
nagios.nagios_hoststatus                           OK
nagios.nagios_instances                            OK
nagios.nagios_logentries                           OK
nagios.nagios_notifications                        OK
nagios.nagios_objects                              OK
nagios.nagios_processevents                        OK
nagios.nagios_programstatus                        OK
nagios.nagios_runtimevariables                     OK
nagios.nagios_scheduleddowntime                    OK
nagios.nagios_service_contactgroups                OK
nagios.nagios_service_contacts                     OK
nagios.nagios_servicechecks                        OK
nagios.nagios_servicedependencies                  OK
nagios.nagios_serviceescalation_contactgroups      OK
nagios.nagios_serviceescalation_contacts           OK
nagios.nagios_serviceescalations                   OK
nagios.nagios_servicegroup_members                 OK
nagios.nagios_servicegroups                        OK
nagios.nagios_services                             OK
nagios.nagios_servicestatus                        OK
nagios.nagios_statehistory                         OK
nagios.nagios_systemcommands                       OK
nagios.nagios_timedeventqueue                      OK
nagios.nagios_timedevents                          OK
nagios.nagios_timeperiod_timeranges                OK
nagios.nagios_timeperiods                          OK
nagios.snmptt                                      OK
nagios.snmptt_archive                              OK
nagios.snmptt_unknown                              OK
[root@eznag log]#

Nagios ndomod Still unable to connect to data sink Error

Nagios ndomod Still unable to connect to data sink Error


Nagios Error Code:-

[root@eznag log]# tail -f messages
Jun 17 03:51:44 eznag nagios: ndomod: Still unable to connect to data sink.  3585388 items lost, 5000 queued items to flush.
Jun 17 03:52:00 eznag nagios: ndomod: Still unable to connect to data sink.  3585561 items lost, 5000 queued items to flush.
Jun 17 03:52:16 eznag nagios: ndomod: Still unable to connect to data sink.  3585774 items lost, 5000 queued items to flush.
Jun 17 03:52:32 eznag nagios: ndomod: Still unable to connect to data sink.  3585877 items lost, 5000 queued items to flush.
Jun 17 03:52:48 eznag nagios: ndomod: Still unable to connect to data sink.  3585970 items lost, 5000 queued items to flush.

Resolution:-

Run below Linux commands.

[root@eznag log]#service nagios stop

Delete the sock file.
[root@eznag log]#rm /usr/local/nagios/var/ndo.sock

[root@eznag log]#service nagios start

Check logs, It will stop "Still unable to connect to data sink" error logs.

[root@eznag log]# tail -f messages
Jun 23 16:31:43 eznag nagios: ndomod: Successfully connected to data sink.  8 queued items to flush.
Jun 23 16:31:43 eznag nagios: ndomod: Successfully flushed 8 queued items to data sink.
Jun 23 16:31:43 eznag nagios: Event broker module '/usr/local/nagios/bin/ndomod-3x.o' initialized successfully.
Jun 23 16:31:43 eznag nagios: npcdmod: Copyright (c) 2008-2009 Hendrik Baecker (andurin@process-zero.de) - http://www.pnp4nagios.org
Jun 23 16:31:43 eznag nagios: npcdmod: /usr/local/nagios/etc/npcd.cfg initialized
Jun 23 16:31:43 eznag nagios: npcdmod: spool_dir = '/usr/local/nagios/var/spool/'.
Jun 23 16:31:43 eznag nagios: npcdmod: perfdata file '/usr/local/nagios/var/perfdata.dump'.
Jun 23 16:31:43 eznag nagios: npcdmod: Ready to run to have some fun!
Jun 23 16:31:43 eznag nagios: Event broker module '/usr/local/nagios/lib/npcdmod.o' initialized successfully.
Jun 23 16:31:43 eznag nagios: Finished daemonizing... (New PID=10457)

Monday, February 19, 2018

Friday, November 24, 2017

Error 404 page not found on Blogger Custom Domain

Error 404 page not found on Blogger Custom Domain


If anybody facing issue blogger below error message. please implement the below steps in your blogger settings.

  • 404 error page not found
  • Error 404 instead of my blogger custom domain
  • domain 404 error issue in Blogger


Solution:-

Settings -> Publishing -> Blog Address -> Edit -> Simply enable checkbox Redirect warje.com to www.warje.com -> Click Save Option.







Friday, November 10, 2017

MySQL Database Purge Binary Logs on any Windows / Linux Platforms

MySQL Database Purge Binary Logs on any Windows / Linux Platforms

The binary log is a set of files that contain information about data modifications made by the MySQL server. The log consists of a set of binary log files.

The PURGE BINARY LOGS statement deletes all the binary log files listed in the log index file prior to the specified log file name or date. BINARY and MASTER are synonyms. Deleted log files also are removed from the list recorded in the index file, so that the given log file becomes the first in the list.

How to Delete Binary Logs and Master Logs on Windows Platforms Steps.

First Open MySQL admin command prompt. Type root id and root user password.

Step -1

Show list of binary logs files on MySQL Server.

mysql>SHOW BINARY LOGS;



Step -2

Display master logs file and Delete master log file using command marked Red color in a screenshot.

mysql>SHOW MASTER STATUS;
mysql>RESET MASTER;




Step -3

Delete single binary log file using command marked Red color in a screenshot.




Step -4

Delete all binary log file using command marked Red color in a screenshot. Specify the correct date which dates older files you want to delete.

mysql>PURGE BINARY LOGS BEFORE '2017-10-27 00:00:00';



Step -5

Show list of binary logs files on MySQL Server. Now showing only one, rest all deleted.



Thursday, March 16, 2017

Run Multiple Instances of Google Drive on Windows 7 / 8 /10 to Sync Multiple Accounts

Run Multiple Google Backup and Sync Accounts
Configure on Windows 7 / 8 /10 

Step 1: 

Please Install Google Drive Backup and Sync on your computer. Download available below link.

https://www.google.com/drive/download/


After installation, Please configure your First Google Drive account.

Step 2: 

For Second Google Drive account; Please create one New folder at any location on your windows 7/8/10 system/laptop.

Create one new mohan.bat or XXXXXX.bat file and open in notepad , add below mention entry.

@ECHO OFF
SET USERNAME=mohan@ gmail.com
SET USERPROFILE=%~dp0%USERNAME%
MD "%USERPROFILE%\AppData\Roaming">nul
MD "%USERPROFILE%\AppData\Local\Application Data">nul
MD "%USERPROFILE%\Application Data">nul
MD "%USERPROFILE%\Local Settings\Application Data">nul
MD "%USERPROFILE%\My Documents">nul
MD "%USERPROFILE%\Documents">nul
START googledrivesync
                                                                                                                                                        

Reference Note:-

mohan à Replace with your mail account name [Or] Other name which you like "My mail" or "My Inbox". Remaining scripts Don't change / Don't  Remove any space between letter/words.


Step 3:


Copy googledrivesync.exe file from Existing installed google drive location 
(C:\Program Files (x86)\Google\Drive ) to New folder location which you created. Refer below screen shot.



Step 4:

Simply open mohan.bat (XXXXX.bat)  file. It will open new google drive backup and sync login windows (Reference below screen shot)..You can add another gmail account and configure it.






After configure you can see Two Google Drive icon in task bar.



Step 5:

New Google Drive Account Auto start option. Create shortcut using mohan.bat / XXXXX.bat file and cut, paste shortcut to windows startup location.

Windows 10 windows startup location:

C:\Users\Dell\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup



After the reboot of system. Google drive second account will start automatically.




If need more account to be configure. Please follow Step 2 to Step 5.



Saturday, January 14, 2017

Setup External SMTP Server to Send Nagios Notifcation Alerts on CentOS/Linux

Setup External SMTP Server to Send Nagios Notifcation Alerts on Linux


Setup up Nagios to use an external SMTP server.


1. Download the SendEmail setup tar file from below link.

[or ]   Directly use wget command on Linux command prompt.

root#wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz

2. Extract, and copy sendEmail to /usr/local/bin

root#tar -xvzf sendEmail-v1.56.tar.gz
root#cp sendEmail-v1.56/sendEmail /usr/local/bin

3. SendEmail requires the Net::SSLeay and IO::Socket::SSL perl modules be installed to function, so install these if they're not already:

root#yum install perl-Net-SSLeay
root#yum install perl-IO-Socket-SSL

For Testing run below command on Linux command prompt. You will get Test Mail. If receiving Test mail. Your external mail server installed successfully.

root#/usr/local/bin/sendEmail -f mohan@mohansundaram.com -t mohan@mohansundaram.com -u TestMail -m TestMail -s smtp.mail.com:587 -xu alert@mohansundaram.com -xp help@123 -o tls=yes

Note:- Change below Parameters respectively to your mail config details.

mohan@mohansundaram.com -> From Address
smtp.mail.com -> SMTP Outgoing Server 
587 -> SMTP Server port with TLS
alert@mohansundaram.com -> Mail Server Username
help@123 -> Password


4. Now modify the notify-host-by-email and notify-service-by-email commands in Nagios' commands.cfg file as follows:

root#vi /usr/local/nagios/etc/objects/commands.cfg

define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/local/bin/sendEmail -f mohan@mohansundaram.com -s smtp.mail.com:587 -xu alert@mohansundaram.com -xp help@123 -o tls=yes -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -t $CONTACTEMAIL$
}

define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/local/bin/sendEmail -f mohan@mohansundaram.com -s smtp.mail.com:587 -xu alert@mohansundaram.com -xp help@123 -o tls=yes -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -t $CONTACTEMAIL$
}


5.Update below entry on contacts.cfg file.

root#vi /usr/local/nagios/etc/objects/contacts.cfg

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           ITHELPDESK@mohansundaram.com  ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS *****

service_notification_period             24x7
host_notification_period        24x7
        service_notification_options            w,u,c,r,f,s
        service_notification_commands           notify-service-by-email
        host_notification_period                24x7
        host_notification_options               d,u,r,f,s
        host_notification_commands              notify-host-by-email
        }


define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }


6. Restart your Nagios service.

root# /etc/init.d/nagios restart
Your done. Nagios will now send alert notifcations via your external SMTP server.


Gitlab Automation Project Showcase

My GitLab Projects Showcase 🚀 Welcome to my portfolio of GitLab projects. Each repository reflects my journey as an engineer, focusing...