I have a service that runs from a bash script that relies on one command line argument.
I created a command with command line /path/to/bash.sh $ARG1$
I created a service with the check command and added 1 host to it
IN the host config, I added -H 192.168.1.2 in ARG1 field.
The host is not passing off the ARG1 field for some reason.
For the life of me I can't figure out what I'm doing wrong. Any help is appreciated.
$ARG1$
Re: $ARG1$
Hello @SoCalMike,
Thank you for reaching out!
For the "Command Line" part of your commands config, instead of:
Try:
Let me know if that helps!
Thank you for reaching out!
For the "Command Line" part of your commands config, instead of:
Code: Select all
/path/to/bash.sh $ARG1$Code: Select all
/path/to/bash.sh -H $ARG1$Re: $ARG1$
Hi AJcoil
Thanks for the help!
I did as you suggested. The command line variable still isn't getting passed off from the host config.
Command is now
/path/to/bash.sh -H $ARG1$
In the Service Config, $ARG1$ field is blank
In the Host Config, $ARG1$ field is populated
Thanks for the help!
I did as you suggested. The command line variable still isn't getting passed off from the host config.
Command is now
/path/to/bash.sh -H $ARG1$
In the Service Config, $ARG1$ field is blank
In the Host Config, $ARG1$ field is populated
Re: $ARG1$
Hello @ SoCalMike,
Thank you for getting back to me!
After rereading your issue, I think the issue might relate to the host/service structure.
You will want the add the command and fill out the ARG fields in the service of your host.
Do let me know if this helps!
Thank you for getting back to me!
After rereading your issue, I think the issue might relate to the host/service structure.
You will want the add the command and fill out the ARG fields in the service of your host.
Do let me know if this helps!
Re: $ARG1$
Maybe the OP should post the command and service text.
I'd also ask what is bash.sh? Might want to post that as text as well.
I'd also ask what is bash.sh? Might want to post that as text as well.
Re: $ARG1$
It definitely works that way. I was trying to avoid having to create a separate service for each server that needs to use this service.ajcoil wrote: ↑Thu Jun 27, 2024 11:19 am Hello @ SoCalMike,
Thank you for getting back to me!
After rereading your issue, I think the issue might relate to the host/service structure.
You will want the add the command and fill out the ARG fields in the service of your host.
Do let me know if this helps!
-
swolf
Re: $ARG1$
Hi @SoCalMike,
I think you'll want to use the built-in macros instead of user argument ("ARG") macros.
Try setting your check command to this:
Then set up a service that uses this command. In addition, I'm going to recommend that you put the service onto a host group and add all of the relevant servers' host entries to that hostgroup. That way you can just manage one service entry for the check you want to run.
Here is a full list of the built-in macros. If you find that you want to set custom macros per-host, you can also use Custom Object Variables.
Hopefully that helps, and please let me know if anything needs clarification.
-Sebastian
I think you'll want to use the built-in macros instead of user argument ("ARG") macros.
Try setting your check command to this:
Code: Select all
/path/to/bash.sh -H $HOSTADDRESS$Here is a full list of the built-in macros. If you find that you want to set custom macros per-host, you can also use Custom Object Variables.
Hopefully that helps, and please let me know if anything needs clarification.
-Sebastian
-
danielmese76
- Posts: 2
- Joined: Thu May 08, 2025 3:00 am
Re: $ARG1$
Thanks @swolf, that clears it up a lot.
I was definitely overcomplicating things trying to handle each server individually. Using drive mad $HOSTADDRESS$ and setting up a hostgroup makes way more sense, especially since the script is the same across the board. Appreciate the tip on avoiding $ARGn$ for this—I'll switch over to built-in macros.
I was definitely overcomplicating things trying to handle each server individually. Using drive mad $HOSTADDRESS$ and setting up a hostgroup makes way more sense, especially since the script is the same across the board. Appreciate the tip on avoiding $ARGn$ for this—I'll switch over to built-in macros.
Re: $ARG1$
You’ve defined $ARG1$ in the command slither io definition, and expected it to be pulled from the host config's ARG1 field, but Nagios doesn’t do that.