Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    PFSense 2.8 CE :: NRPE not providing correct status of services

    Scheduled Pinned Locked Moved General pfSense Questions
    4 Posts 2 Posters 212 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      santheerdas
      last edited by

      Hi Team,

      After upgrading to PfSense 2.8 CE, I am experiencing an issue retrieving the correct status of services via NRPE.

      For testing, I ran the following command manually:

      ./check_pf_services -name openvpn

      The response returned was:

      CRITICAL - openvpn service not running

      However, the OpenVPN service is actually running. I’m also monitoring the PfSense services through OMD Thruk using the check_nrpe plugin, and it is returning the same (incorrect) result.

      Could you please confirm if there have been any changes in the location of service status data or any modifications to service names in this release?

      For reference, the script I’m using to check service status is:

      check_pf_services

      #!/bin/sh
      
      if [ "$1" = "-name" ] && [ ! -z "$2" ]; then
              NAME=$2
      	OPTION3=$3
      	OPTION4=$4
      	if [ "$NAME" = "pinger" ]; then
      		
      		if [ -f /usr/local/bin/dpinger ]; then 
              		CHECK=$(/usr/local/sbin/pfSsh.php playback svc status dpinger $OPTION3 $OPTION4 |grep 'running' |wc -l | sed -e 's/^[ \t]*//')||exit 3
      			NAME="d"$NAME
      		else
              		CHECK=$(/usr/local/sbin/pfSsh.php playback svc status apinger $OPTION3 $OPTION4 |grep 'running' |wc -l | sed -e 's/^[ \t]*//')||exit 3
      			NAME="a"$NAME
      		fi
      
      		#CHECK=`expr $CHECK1 + $CHECK2`
      
      	else 
      		CHECK=$(/usr/local/sbin/pfSsh.php playback svc status $NAME $OPTION3 $OPTION4 |grep 'running' |wc -l | sed -e 's/^[ \t]*//')||exit 3
      	fi
              #CHECK=$(/usr/local/sbin/pfSsh.php playback svc status $NAME)||exit 3
              #echo "DEBUG:   NAME:$NAME CHECK:$CHECK"
              if [ $CHECK -lt 1 ];then
                      echo "CRITICAL - $NAME service not running"
                      exit 2
              else
                      echo "OK - $NAME service is running"
                      exit 0
              fi
      
      else
              echo "check_pf_services.sh - Nagios Plugin for checking services on pfSense "
              echo ""
              echo "Usage:    check_pf_services.sh -name <service_name>"
      	echo " "
      	echo "Note:     If captiveportal is the service getting checked, the zone name"
      	echo "          in all lowercase must follow the service_name parameter" 
      	echo "Example:  check_pf_services.sh -name captiveportal guest"
      	echo " "
      	echo "Note:     If openvpn is the service getting checked, two options must be"
      	echo "          specified -- the option "server" followed by the server id." 
      	echo "Example:  check_pf_services.sh -name openvpn server 1"
      	echo " "
      	echo "Note:     Specifying 'pinger' as the service will check both apinger"
      	echo "          as well as dpinger. You can specify directly as well."
      	echo "Example:  check_pf_services.sh -name pinger"
              exit 3
      fi
      
      

      Looking forward to your input.
      Thanks

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by stephenw10

        Did you pass the required options to it? It expects to see mode and ID:

        [2.8.0-RELEASE][admin@t70.stevew.lan]/root: pfSsh.php playback svc status openvpn
        Invalid OpenVPN mode (server, client)
        [2.8.0-RELEASE][admin@t70.stevew.lan]/root: pfSsh.php playback svc status openvpn server
        Invalid OpenVPN ID, must be numeric
        [2.8.0-RELEASE][admin@t70.stevew.lan]/root: pfSsh.php playback svc status openvpn server 1
        
        Service openvpn is running.
        

        Like it shows in the example in the script.

        S 2 Replies Last reply Reply Quote 0
        • S
          santheerdas @stephenw10
          last edited by

          @stephenw10 Yes. I tried and it showing service not running.

          [2.8.0-RELEASE][santheerdas@xxxx]/usr/local/libexec/nagios: ./check_pf_services -name openvpn server 1
          CRITICAL - openvpn service not running
          [2.8.0-RELEASE][santheerdas@xxxx]/usr/local/libexec/nagios: ./check_pf_services -name "openvpn server 1"
          CRITICAL - openvpn server 1 service not running
          [2.8.0-RELEASE][santheerdas@xxxx]/usr/local/libexec/nagios: ./check_pf_services -name "openvpn client 1"
          CRITICAL - openvpn client 1 service not running
          [2.8.0-RELEASE][santheerdas@xxxx]/usr/local/libexec/nagios: ./check_pf_services -name "nrpe"
          CRITICAL - nrpe service not running
          [2.8.0-RELEASE][santheerdas@xxxx]/usr/local/libexec/nagios: ./check_pf_services -name ipsec
          CRITICAL - ipsec service not running
          

          bd2534a1-2b78-4c02-9211-cebdf221d0f6-image.png

          1 Reply Last reply Reply Quote 0
          • S
            santheerdas @stephenw10
            last edited by

            @stephenw10 ok.when using the pfSsh.php, it is working. Ok Thanks. let me try to update the script check_pf_services.

            [2.8.0-RELEASE][santheerdas@XXX]/home/santheerdas: sudo pfSsh.php playback svc status openvpn server 1
            Password:
            
            Service openvpn is running.
            [2.8.0-RELEASE][santheerdas@XXX]/home/santheerdas: sudo pfSsh.php playback svc status nrpe
            
            Service nrpe is running.
            [2.8.0-RELEASE][santheerdas@XXX]/home/santheerdas: 
            
            
            1 Reply Last reply Reply Quote 1
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.