These definition can be placed in their own file or added to

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
bmurtha
Posts: 27
Joined: Tue Feb 23, 2016 11:08 am

These definition can be placed in their own file or added to

Post by bmurtha »

You'll need to create service object definition in order to monitor MSSQL server jobs. These definition
can be placed in their own file or added to an already exiting object configuration file.

define service{
use generic-service
host_name mssql-server
service_description Failed_Jobs
check_command check_sqllog!sa!s22css
}

I'm new to Nagios and recent versions of Linux. My question is what is an existing object configuration file?
Regards,
Bryan
Last edited by tmcdonald on Thu Mar 03, 2016 2:38 pm, edited 1 time in total.
Reason: Moved out of Plugin Development forum
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: These definition can be placed in their own file or adde

Post by bwallace »

I don't mean to just dump a KB article on you, but everything is there. Please give it a read and hopefully it will answer more questions than it creates. Let us know if this clears things up or not, thanks.

https://assets.nagios.com/downloads/nag ... bject.html
https://assets.nagios.com/downloads/nag ... tions.html
Be sure to check out the Knowledgebase for helpful articles and solutions!
bmurtha
Posts: 27
Joined: Tue Feb 23, 2016 11:08 am

Re: These definition can be placed in their own file or adde

Post by bmurtha »

It did clear things up for me, although I'm still a little confused. I issued /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg which after a couple of tries I was able to work out the bugs, it said all is fine. So I restarted Nagios:
service nagios restart. It stopped and started no problem. I was expecting to see a new configuration wizard but no such luck. I'm wondering how do I see the output of this plugin? The documentation says:
"Once you configured service reload/restart nagios service successfully. In the nagios screen you will see output like if jobs get failed (“CRITICAL: Number of Jobs Failed:25 “) unless (“OK: Number of Jobs Failed:0”). The check_sqllog plugin output is a clickable html link. If you click on the link you will get into a html page which consists of list of jobs failed currently and history of job failed for current date in a separate table."
What I can't figure out is where is this link?
Regards,
Bryan
bmurtha
Posts: 27
Joined: Tue Feb 23, 2016 11:08 am

Re: These definition can be placed in their own file or adde

Post by bmurtha »

I finally found the html link they were talking about. But it was in Unhandled and an exception:
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_sqllog, ...) failed. errno is 2: No such file or directory
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: These definition can be placed in their own file or adde

Post by bwallace »

What directory did you install the plugins in, and on what OS/version is this install occurring?
Be sure to check out the Knowledgebase for helpful articles and solutions!
bmurtha
Posts: 27
Joined: Tue Feb 23, 2016 11:08 am

Re: These definition can be placed in their own file or adde

Post by bmurtha »

The version of is CentOS release 6.7 (Final)
The directory I installed it in was: /usr/local/nagios/libexec
Thanks in advance,
Bryan
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: These definition can be placed in their own file or adde

Post by jolson »

Can you show us the configuration files that you modified to attempt getting this plugin working? I assume that there's the plugin itself, a command (perhaps in your command.cfg), a host, and a service configuration. If you can show us those configuration files and the changes you made, we may be able to help you resolve this problem. I'm also interested in your nagios.cfg file:

Code: Select all

cat /usr/local/nagios/etc/nagios.cfg
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
bmurtha
Posts: 27
Joined: Tue Feb 23, 2016 11:08 am

Re: These definition can be placed in their own file or adde

Post by bmurtha »

Thanks Jolson!


/usr/local/nagios/etc/nagios.cfg:

Code: Select all

# MODIFIED
admin_email=root@localhost
admin_pager=root@localhost
translate_passive_host_checks=1
log_event_handlers=0
use_large_installation_tweaks=1
enable_environment_macros=0


# NDOUtils module
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg


# PNP settings - bulk mode with NCPD
process_performance_data=1
# service performance data
service_perfdata_file=/usr/local/nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$\tSERVICEOUTPUT::$SERVICEOUTPUT$\tLONGSERVICEOUTPUT::$LONGSERVICEOUTPUT$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file-bulk
# host performance data
host_perfdata_file=/usr/local/nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tHOSTOUTPUT::$HOSTOUTPUT$\tLONGHOSTOUTPUT::$LONGHOSTOUTPUT$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file-bulk


# OBJECTS - UNMODIFIED
#cfg_file=/usr/local/nagios/etc/objects/commands.cfg
#cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
#cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
#cfg_file=/usr/local/nagios/etc/objects/templates.cfg
#cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg


# STATIC OBJECT DEFINITIONS (THESE DON'T GET EXPORTED/IMPORTED BY NAGIOSQL)
cfg_dir=/usr/local/nagios/etc/static

# OBJECTS EXPORTED FROM NAGIOSQL
cfg_file=/usr/local/nagios/etc/contacttemplates.cfg
cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
cfg_file=/usr/local/nagios/etc/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/commands.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/servicegroups.cfg
cfg_file=/usr/local/nagios/etc/hosttemplates.cfg
cfg_file=/usr/local/nagios/etc/servicetemplates.cfg
cfg_file=/usr/local/nagios/etc/servicedependencies.cfg
cfg_file=/usr/local/nagios/etc/serviceescalations.cfg
cfg_file=/usr/local/nagios/etc/hostdependencies.cfg
cfg_file=/usr/local/nagios/etc/hostescalations.cfg
cfg_file=/usr/local/nagios/etc/hostextinfo.cfg
cfg_file=/usr/local/nagios/etc/serviceextinfo.cfg
cfg_dir=/usr/local/nagios/etc/hosts
cfg_dir=/usr/local/nagios/etc/services

# GLOBAL EVENT HANDLERS
global_host_event_handler=xi_host_event_handler
global_service_event_handler=xi_service_event_handler



# UNMODIFIED
accept_passive_host_checks=1
accept_passive_service_checks=1
additional_freshness_latency=15
auto_reschedule_checks=1
auto_rescheduling_interval=30
auto_rescheduling_window=45
bare_update_check=0
cached_host_check_horizon=15
cached_service_check_horizon=15
check_external_commands=1
check_for_orphaned_hosts=1
check_for_orphaned_services=1
check_for_updates=1
check_host_freshness=0
check_result_path=/usr/local/nagios/var/spool/checkresults
check_result_reaper_frequency=10
check_service_freshness=1
command_file=/usr/local/nagios/var/rw/nagios.cmd
daemon_dumps_core=0
date_format=us
debug_file=/usr/local/nagios/var/nagios.debug
debug_level=0
debug_verbosity=1
enable_event_handlers=1
enable_flap_detection=1
enable_notifications=1
enable_predictive_host_dependency_checks=1
enable_predictive_service_dependency_checks=1
event_broker_options=-1
event_handler_timeout=30
execute_host_checks=1
execute_service_checks=1
high_host_flap_threshold=20.0
high_service_flap_threshold=20.0
host_check_timeout=30
host_freshness_check_interval=60
host_inter_check_delay_method=s
illegal_macro_output_chars=`~$&|'"<>
illegal_object_name_chars=`~!$%^&*|'"<>?,()=
interval_length=60
lock_file=/usr/local/nagios/var/nagios.lock
log_archive_path=/usr/local/nagios/var/archives
log_external_commands=0
log_file=/usr/local/nagios/var/nagios.log
log_host_retries=1
log_initial_states=0
log_notifications=1
log_passive_checks=0
log_rotation_method=d
log_service_retries=1
low_host_flap_threshold=5.0
low_service_flap_threshold=5.0
max_check_result_file_age=3600
max_check_result_reaper_time=30
max_concurrent_checks=0
max_debug_file_size=1000000
max_host_check_spread=30
max_service_check_spread=30
nagios_group=nagios
nagios_user=nagios
notification_timeout=30
object_cache_file=/usr/local/nagios/var/objects.cache
obsess_over_hosts=0
obsess_over_services=0
ocsp_timeout=5
passive_host_checks_are_soft=0
perfdata_timeout=5
precached_object_file=/usr/local/nagios/var/objects.precache
resource_file=/usr/local/nagios/etc/resource.cfg
retained_contact_host_attribute_mask=0
retained_contact_service_attribute_mask=0
retained_host_attribute_mask=0
retained_process_host_attribute_mask=0
retained_process_service_attribute_mask=0
retained_service_attribute_mask=0
retain_state_information=1
retention_update_interval=60
service_check_timeout=60
service_freshness_check_interval=60
service_inter_check_delay_method=s
service_interleave_factor=s
soft_state_dependencies=0
state_retention_file=/usr/local/nagios/var/retention.dat
status_file=/usr/local/nagios/var/status.dat
status_update_interval=10
temp_file=/usr/local/nagios/var/nagios.tmp
temp_path=/tmp
use_aggressive_host_checking=0
use_regexp_matching=0
use_retained_program_state=1
use_retained_scheduling_info=1
use_syslog=1
use_true_regexp_matching=0
cat url.properties
HTML_DIR=/usr/local/nagios/share
HTML_LINK=/usr/local/nagios/sqllog

Code: Select all

#!/bin/sh

PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
#. $PROGPATH/utils.sh
javacmd=`which java`
CLASSPATH=/usr/local/nagios/libexec/:/usr/local/nagios/libexec/sqljdbc.jar
export CLASSPATH
. /usr/local/nagios/libexec/utils.sh

argc=$#

print_usage() {
        echo "Usage: $PROGNAME -H hostaddress -u {username} -p {password}"
        }
print_help() {
        print_usage
        echo ""
        echo "-h for help"
        echo ""
        echo "-H (hostaddress)"
          echo "-u (username)"
          echo "-p (password)"
        echo "Example command"
        echo "check_sqljob -H 10.70.5.45 -u sa -p s22css"
        echo ""
        exit 0
}

case "$1" in
        -h)
                print_help
                exit 0
                ;;
        -v)
                print_revision $PROGNAME $REVISION
                exit 0
                ;;
        -H)
                if [ $argc -eq 6 ]
                then
                   ret=`$javacmd SqlJobMon $2 $4 $6`
                fi
                ret1=`echo  $ret | grep CRITICAL| awk '{print $4}'`
                if [ "$ret1" =  "CRITICAL:" ]
                then
                  echo $ret
                  exit 2
                fi
                ret2=`echo  $ret | grep OK| awk '{print $4}'`
                if [ "$ret2" = "OK:"  ]
                then
                  echo $ret
                  exit 0
                else
                  echo "UNKNOWN:"
                  exit 3
                fi
                ;;
         *)
                print_help
                exit $STATE_UNKNOWN
                ;;
esac
Last edited by tmcdonald on Tue Mar 08, 2016 2:51 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
bmurtha
Posts: 27
Joined: Tue Feb 23, 2016 11:08 am

Re: These definition can be placed in their own file or adde

Post by bmurtha »

After some more detective work, I tried to just execute the shell script check_sqljob.sh
./check_sqljob.sh: line 42: /usr/local/nagios/libexec/SqlJobMon.class: cannot execute binary file
UNKNOWN:
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: These definition can be placed in their own file or adde

Post by hsmith »

Where did you get this script from?
Former Nagios Employee.
me.
Locked