SNMP problem - No data received from host

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.
Locked
horizn
Posts: 10
Joined: Tue Oct 07, 2014 8:57 am

SNMP problem - No data received from host

Post by horizn »

Hi,
I am trying to add my APC ups in to my NAgios configuration, using this tutorial:
http://mihai.radoveanu.ro/2010/02/tutor ... th-nagios/
but for example, when i try:
/usr/lib/nagios/plugins/check_snmp -H 10.171.24.53 -C 'public' -o 'sysUpTime.0'
SNMP OK - Timeticks: (10145300) 1 day, 4:10:53.00 | DISMAN-EXPRESSION-MIB::sysUpTimeInstance=Timeticks: (10145300) 1 day, 4:10:53.00

I am a beginner, what is wrong?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SNMP problem - No data received from host

Post by abrist »

From that output, nothing! The following is what you expect to be output from the check:

Code: Select all

SNMP OK - Timeticks: (10145300) 1 day, 4:10:53.00 | DISMAN-EXPRESSION-MIB::sysUpTimeInstance=Timeticks: (10145300) 1 day, 4:10:53.00
Where do you see the "no data received" error?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
horizn
Posts: 10
Joined: Tue Oct 07, 2014 8:57 am

Re: SNMP problem - No data received from host

Post by horizn »

here:

Image

I don't have problem with monitoring the rest of my devices including storage/memory usage etc.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SNMP problem - No data received from host

Post by abrist »

Ah, so the check from the cli works, but not from nagios. Could you post the command config and service config for one of these failing snmp checks?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
horizn
Posts: 10
Joined: Tue Oct 07, 2014 8:57 am

Re: SNMP problem - No data received from host

Post by horizn »

command:

Code: Select all

# 'notify-host-by-email' command definition
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/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

# 'notify-service-by-email' command definition
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/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

define command {
        command_name    notify-host-by-html-email
        command_line    /etc/nagios3/conf.d/templates/host.php | /usr/bin/mail -s "* $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ *" -a "MIME-Version: 1.0" -a "Content-type: text/html; charset=iso-8859-1" $CONTACTEMAIL$
        }

define command {
        command_name    notify-service-by-html-email
        command_line    /etc/nagios3/conf.d/templates/service.php | /usr/bin/mail -s "* $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ *" -a "MIME-Version: 1.0" -a "Content-type: text/html; charset=iso-8859-1" $CONTACTEMAIL$
        }

define command {
        command_name    host-html-email
        command_line    $USER1$/send_html_mail.php host
        }

define command {
        command_name    service-html-email
        command_line    $USER1$/send_html_mail.php service
        }

# 'process-host-perfdata' command definition
define command{
        command_name    process-host-perfdata
        command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/nagios3/host-perfdata.out
        }

# 'process-service-perfdata' command definition
define command{
        command_name    process-service-perfdata
        command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/lib/nagios3/service-perfdata.out
        }

# 'check_local_disk' command definition
define command{
        command_name    check_local_disk
        command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
        }


# 'check_local_load' command definition
define command{
        command_name    check_local_load
        command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
        }


# 'check_local_procs' command definition
define command{
        command_name    check_local_procs
        command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
        }


# 'check_local_users' command definition
define command{
        command_name    check_local_users
        command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
        }


# 'check_local_swap' command definition
define command{
        command_name    check_local_swap
        command_line    $USER1$/check_swap -w $ARG1$ -c $ARG2$
        }


# 'check_local_mrtgtraf' command definition
define command{
        command_name    check_local_mrtgtraf
        command_line    $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
        }

# 'check_snmp' command definition
define command{
        command_name    check_snmp
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
        }

define command {
        command_name    check_http_site
        command_line    $USER1$/check_http -H $HOSTNAME$ -u "$ARG1$" -s "$ARG2$" -w $ARG3$ -c $ARG4$
        }

define command {
        command_name    check_http_plain_site
        command_line    $USER1$/check_http -H $HOSTNAME$ -s "$ARG1$" -w $ARG2$ -c $ARG3$
        }

define command {
        command_name    check_http_virtual_site
        command_line    $USER1$/check_http -H $ARG1$ -u "$ARG2$" -s "$ARG3$" -w $ARG4$ -c $ARG5$
        }

define command {
        command_name    check_http_authsite
        command_line    $USER1$/check_http -H $HOSTNAME$ -u $ARG1$ -w $ARG2$ -c $ARG3$ --expect=HTTP/1.1
        }

define command {
        command_name    check_https_site
        command_line    $USER1$/check_http -H $HOSTNAME$ --ssl -u "$ARG1$" -s "$ARG2$" -w $ARG3$ -c $ARG4$
        }

define command {
        command_name    check_https_virtual_site
        command_line    $USER1$/check_http -H $ARG1$ --ssl -f follow -u "$ARG2$" -s "$ARG3$" -w $ARG4$ -c $ARG5$
        }

define command {
        command_name    check_https_plain_virtual_site
        command_line    $USER1$/check_http -H $ARG1$ --ssl -f follow -s "$ARG2$" -w $ARG3$ -c $ARG4$
        }

# This one is for ssl sites with self-issued certificates, which are not present on histidine
define command {
        command_name    check_https_site2
        command_line    $USER1$/check_http -H $HOSTNAME$ --ssl -u "$ARG1$" -w $ARG2$ -c $ARG3$
        }

# And now for a HTTPS site, which has a different host header
define command {
        command_name    check_https_other
        command_line    $%USER1$/check_http -H $ARG1$ --ssl -u "$ARG2$" -w $ARG3$ -c $ARG4$
        }

define command{
        command_name    check_ping_other
        command_line    /usr/lib/nagios/plugins/check_ping -H '$ARG1$' -w '$ARG2$' -c '$ARG3$'
        }

define command {
        command_name    check_dns_internal
        command_line    $USER1$/check_dns -H dns1 -s $HOSTADDRESS$ -a ip
        }

define command {
        command_name    check_dns_external
        command_line    $USER1$/check_dns -H http://www.domain.com -s $ARG1$ -a ip
        }

define command {
        command_name    check_ldap_internal
        command_line    $USER1$/check_ldap -H '$HOSTADDRESS$' -b 'cn=Users,cn=Builtin,dc=domain,dc=com' -D cn=LDAPsearch,cn=Users,dc=domain,dc=com -P password -3 -w $ARG1$ -c $ARG2$
        }

define command {
        command_name    check_tunnel
        command_line    $USER1$/check_snmp -P 2c -C some -H $HOSTADDRESS$ -o 1.3.6.1.2.1.2.2.1.7.$ARG1$ -w 1 -c 1
        }

define command {
        command_name    check_snmp_mem
        command_line    $USER1$/check_snmp_mem.pl -H $HOSTADDRESS$ -C some -2 -N -w $ARG1$ -c $ARG2$
}

define command }
        command_name    check_ssh_mem
        command_line    $USER1$/check_by_ssh -H $HOSTADDRESS$ -l nagios -i /home/nagios/.ssh/id_rsa -C '/usr/lib/nagios/check_mem.pl -u -w $ARG1$ -c $ARG2$'
        }

define command {
        command_name    check_snmp_drives
        command_line    $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C some -2 -f -T pu -m 'Swap|[Mm]emory|[Uu]sb' -e -w $ARG1$ -c $ARG2$
}

define command{
        command_name    check_snmp_load
        command_line    $USER1$/check_snmp_load.pl -2 -C some -H $HOSTADDRESS$ -T $ARG1$ -w $ARG2$ -c $ARG3$
        }

define command }
        command_name    check_ssh_load
        command_line    $USER1$/check_by_ssh -H $HOSTADDRESS$ -l nagios -i /home/nagios/.ssh/id_rsa -C '/usr/lib/nagios/check_load -r -w $ARG1$ -c $ARG2$'
        }

define  command {
        command_name    check_snmp_procs
        command_line    $USER1$/check_snmp_process.pl -C some -2 -H $HOSTADDRESS$ -n '' -w $ARG1$ -c $ARG2$
        }

define  command {
        command_name    check_snmp_proc_by_name
        command_line    $USER1$/check_snmp_process.pl -C some -2 -H $HOSTADDRESS$ -n $ARG1$ --warn=0,1 --critical=0,2
        }

define  command {
        command_name    check_snmp_proc_by_name_and_args
        command_line    $USER1$/check_snmp_process.pl -C some -2 -H $HOSTADDRESS$ -n $ARG1$ --warn=0,1 --critical=0,2 -A
        }

define  command {
        command_name    check_snmp_procs_by_name
        command_line    $USER1$/check_snmp_process.pl -C some -2 -H $HOSTADDRESS$ -n $ARG1$ --warn=$ARG2$,$ARG3$ --critical=$ARG4$,$ARG5$
        }

define command {
        command_name    check_snmp_vm_proc_by_name
        command_line    $USER1$/check_snmp_process.pl -C some -2 -H $ARG2$ -n $ARG1$ --warn=0,1 --critical=0,2
        }

define command {
        command_name    check_snmp_windrive
        command_line    $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C some -2 -f -T pu -m ^[$ARG1$] -w $ARG2$ -c $ARG3$
        }

define command {
        command_name    check_snmp_winmem
        command_line    $USER1$/check_snmp_storage.pl -C some -H $HOSTADDRESS$ -f -m "^$ARG1$"  -w $ARG2$ -c $ARG3$
        }

define command {
        command_name    check_win_snmp_load
        command_line    $USER1$/check_win_snmp_cpuload.pl $HOSTADDRESS$ some $ARG1$ $ARG2$
        }

#'check_hpmemoryfree' commnand definition
define command{
        command_name    check_hpmemoryfree
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -C  public $ARG1$ -o .1.3.6.1.4.1.11.2.14.11.5.1.1.2.1.1.1.6.1 -w $ARG2$ -c $ARG3$ -u bytes -l free
}

#'check_hptemp' commnand definition
define command{
        command_name    check_hp_cpu
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -C  public $ARG1$ -o .1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0 -t 5 -w $ARG2$ -c $ARG3$ -u % -l '5min CPU'
}

#'check_hptemp' commnand definition
define command{
        command_name    check_hpfan
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -C  public $ARG1$ -o .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.1 -w $ARG2$ -c $ARG3$ -l 'Fan Status'
}

#'check_hptemp' commnand definition
define command{
        command_name    check_hppower
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -C  public $ARG1$ -o .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.2 -w $ARG2$ -c $ARG3$ -l 'Power Supply Status'
}

#'check_hptemp' commnand definition
define command{
        command_name    check_hptemp
        command_line    $USER1$/check_snmp -H $HOSTADDRESS$ -C  public $ARG1$ -o .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.4 -w $ARG2$ -c $ARG3$ -l 'Temperature Status'
}

# This command accepts the colour of the cartridge as argument, or any other consumable (eg fuser, waste, etc.)
# User 'ALL' for all consumables in one go.
define command {
        command_name    check_printer
        command_line    $USER1$/check_snmp_printer.sh $HOSTADDRESS$ public CONSUM $ARG1$
        }

# This command accepts the number of a tray to be checked
define command {
        command_name    check_printer_tray
        command_line    $USER1$/check_snmp_printer.sh $HOSTADDRESS$ public TRAY $ARG1$
        }

################################################################################
#
# Stream checks
#
# I (WSZ) have written a shell script that uses mplayer and allows to check
# whether a particular stream is running and matches given values
# The first argument must always be a complete url, e.g. udp://1.2.3.4:1234
# or anything else that mplayer can open and run
#
################################################################################

# This command expects as second argument a list of NAME=value pairs, separated by colons
define command {
        command_name    check_stream
        command_line    $USER1$/check_stream.sh $ARG1$ $ARG2$
        }
# This command expects as second argument the name of the video code, and third argument the name of the audio codec
define command {
        command_name    check_stream_simple
        command_line    $USER1$/check_stream.sh $ARG1$ $ARG2$ $ARG3$
        }

define command {
        command_name   check_snmp_inverter
        command_line      $USER1$/check_snmp_inverter.sh -H $HOSTADDRESS$ -C $ARG1$ -o $ARG2$
        }
services are in external ups.cfg file:

Code: Select all

define host{
        use generic-apc
        host_name apc86a09d
        alias this is a standard apc ups
        address 10.171.24.53 ; IP address of the device
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all
        service_description PING
        check_command check_ping!200.0,20%!600.0,60%
        normal_check_interval 5
        retry_check_interval 1
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all
        service_description Uptime
        check_command check_snmp!-C Default_snmp_string -o sysUpTime.0
        }


#################################
#                               #
#       APC UPS Checks          #
#                               #
#################################

define service{
        use generic-service ;
        hostgroup_name 007-ups-all-apc
        service_description APC Battery temperature
        check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.2.2.2.0 -C Default_snmp_string -w 35 -c 45 -u C
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all-apc
        service_description APC Battery run time remaining
        check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.2.2.3.0 -C Default_snmp_string
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all-apc
        service_description APC Battery needs replacement
        check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.2.2.4.0 -C Default_snmp_string -c 2
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all-apc
        service_description APC Line-in voltage
        #check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.3.2.1.0 -C Default_snmp_string -w 280 -c 300 -u VAC
        check_command check_snmp_inverter!Default_snmp_string!.1.3.6.1.4.1.318.1.1.1.3.2.1.0 -w 200 -c 100 -u VAC
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all-apc
        service_description APC UPS load
        check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.4.2.3.0 -C Default_snmp_string -w 70 -c 90 -u %
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all-apc
        service_description APC output current
        check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.4.2.4.0 -C Default_snmp_string -w 40 -c 50 -u A
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all-apc
        service_description APC output voltage
        check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.4.2.1.0 -C Default_snmp_string -w 230 -c 245 -u VAC
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all-apc
        service_description APC status
        check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.4.1.1.0 -C Default_snmp_string -c 3
        }

define service{
        use generic-service ;
        hostgroup_name 007-ups-all-apc
        service_description APC UPS Model
        check_command check_snmp!-o .1.3.6.1.4.1.318.1.1.1.1.1.1.0 -C Default_snmp_string
        }
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: SNMP problem - No data received from host

Post by lmiltchev »

Are you sure that you are using the correct OID? Have you tested running these checks from the CLI?

Code: Select all

./check_snmp -H 10.171.24.53 -C 'community' -o .1.3.6.1.4.1.318.1.1.1.2.2.2.0
Be sure to check out our Knowledgebase for helpful articles and solutions!
horizn
Posts: 10
Joined: Tue Oct 07, 2014 8:57 am

Re: SNMP problem - No data received from host

Post by horizn »

lmiltchev wrote:Are you sure that you are using the correct OID? Have you tested running these checks from the CLI?

Code: Select all

./check_snmp -H 10.171.24.53 -C 'community' -o .1.3.6.1.4.1.318.1.1.1.2.2.2.0
yes that was the problem. I have fixed it before you've answered me. however thank you.
Locked