2

When we run the Nagios check_procs module in redhat7 os, we are facing below error. By googling we found that we need to reinstall procps package. We also reinstalled procps package but the module is working for first attempt and then its getting failed.

Error: System call sent warnings to stderr: error: unsupported option (BSD syntax)
4

Error: System call sent warnings to stderr: error: unsupported option (BSD syntax)

The problem is that there's a mis-match between the check_procs plug-in and your operating system's ps command.

Nagios' check_procs plug-in spawns the ps command to check processes, applying a scanf()-style format string to the command's output to find out what it needs to know about running processes. Given the wide variance in ps commands across operating systems, it has to tailor this to each operating system's ps command.

This it does when the check_procs plug-in is compiled from source to binary. There's a 400-odd-line configuration script that laboriously checks each known combination of ps arguments+options and scanning format string in turn, until one works. This combination is then hardwired into the compiled plug-in.

If the combination turns out to be wrong for the actual system where check_procs is run, ps either generates output in the wrong format (witness MacPorts bug #28801 and monitoring-plugins issue #1328) or generates error messages to standard error (witness Debian Bug #296003) which are picked up by the plug-in and alerted on. The latter is what is happening here.

This has various consequences:

  • If you are building the plug-in from source, you need to build it with the same ps command installed as will be installed on the eventual production machine.
  • If you are using a pre-built binary, that binary needs to have been built on a system whose ps command matches the one on your machine where you are running the plug-in. If you didn't build the binary yourself, you need to talk to the person who did, or at the very least to the package maintainer if you are using a packaged-up pre-built binary.
  • But the check_procs script is working once we reinstall the procps-ng package but it is working only for few minutes. Then same error existing. Please provide a solution for this. i have Redhat 7.1 version installed. – pravin09 Dec 23 '15 at 11:16
0

We have done a script for total check process, which solves the Error: System call sent warnings to stderr: error: unsupported option (BSD syntax) issue.

Please find the script below.

 #!/bin/bash
#
# Script to check Process usage on Linux. Ignores Process used by disk cache.
#
# Requires the bc command
#                $1 $2 $3 $4
# ./check_Process -w 85 -c 95
print_help() {
    echo "Usage:"
    echo "[-w] Warning level as a percentage"
    echo "[-c] Critical level as a percentage"
    exit 0
}

while test -n "$1"; do
    case "$1" in
        --help|-h)
            print_help
            exit 0
            ;;
        -w)
            warn_level=$2
            shift
            ;;
        -c)
            critical_level=$2
            shift
            ;;
        *)
            echo "Unknown Argument: $1"
            print_help
            exit 3
            ;;
    esac
    shift
done

if [ "$warn_level" == "" ]; then
    echo "No Warning Level Specified"
    print_help
    exit 3;
fi

if [ "$critical_level" == "" ]; then
    echo "No Critical Level Specified"
    print_help
    exit 3;
fi

count=`ps -ef | wc -l`

###################

if [ "$count" -lt "$warn_level" ]; then
    echo "Process OK:$count | 'Process' =$count;$warn_level;$critical_level"
    exit 0;
elif [ "$count" -ge "$warn_level" ] && [ "$count" -le "$critical_level" ]; then
    echo "Process WARNING: $count | 'Process'=$count;$warn_level;$critical_level"
    exit 1;
elif [ "$count" -gt "$critical_level" ]; then
    echo "Process CRITICAL: $count | 'Process'=$count;$warn_level;$critical_level"
    exit 2;
fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.