I'm going to create a check command that is written in C. Like those built-in ones that come with Nagios Core, I want to make it able to get the argument such as hostaddress, warning and critical threshold.
I've checked check_ping and check_snmp, then I found that they all rely on an unknown variable "optarg". It's not declared in the codes so I assume it's included in one of those headers (common.h, utils.h, etc.).
The problem is those headers have dependency with the other headers that make it impossible to include all of them.
If I know where and how that "optarg" is declared, I can just simply skip those unnecessary library/header. My problem is, I've no idea where it is.
How to utilise macros "HOSTADDRESS" in my code
Re: How to utilise macros "HOSTADDRESS" in my code
I think this is what you're looking for:
https://github.com/nagios-plugins/nagio ... l/getopt.c
But there's a variety of ways to handle command-line arguments in C.
https://github.com/nagios-plugins/nagio ... l/getopt.c
But there's a variety of ways to handle command-line arguments in C.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/