check_tcp keeps throwing "Port must be a positive integer"


#1

This one’s driving me mad. I’m even explicitly naming the port:

check_command check_tcp!-H $HOSTNAME$ -p 9000 -w 5 -c 10

I’ve tried all of these variants:

check_command check_tcp!-H $HOSTNAME$ -p9000 -w 5 -c 10 (no space before the port)

check_command check_tcp!-H $HOSTNAME$ 9000 -w 5 -c 10 (no “-p” before the port)

check_command check_tcp!-H $HOSTNAME$ -w 5 -c 10 -p 9000 (port specified at the end)

check_command check_tcp!-p 9000 -H $HOSTNAME$ -w 5 -c 10 (port specified at the beginning)

None of these will work. Anyone see what I’m doing wrong?


#2

that’s a bad way of parametrizing.
should be something like:
check_command check_tcp!9000!5!10
and the comand definition should then be:
check_tcp -H $HOSTANME$ -p $ARG1$ -w $ARG2$ -c $ARG3$

probably the command definition in commands.cfg is expecting the port number as first parameter and you are passing “-H $HOSTNAME$ -p 9000 -w 5 -c 10”, which it doesn’t like.


#3

That took care of it, many thanks. I guess I misunderstood some of the docs.