command_type changes when updating command via API

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
IPOInS
Posts: 25
Joined: Tue Jan 14, 2020 6:08 am

command_type changes when updating command via API

Post by IPOInS »

Hi,

I'm using a custom script for a service event handler. The command defined in Nagios XI is set as a Misc command in order to be able to assign it as a script in the event handler section of the service. This is all working fine.
However, when this command is updated via the API the command_type is being automatically re-assigned as a check command.
When viewing the event handler section of the check via the GUI the script no longer appears, yet under the hood the check is still using the same script for events. Manually changing the command type back to Misc, all is well again in the GUI (obviously because of the NagiosQL filtering as stated in the documentation).

I'm using Nagios XI 5.7.3 and the API doesn't have any option to define command_type when creating or changing any commands.
It would be nice to include command_type in the API, or at the very least stop command_type being change.
IPOInS
Posts: 25
Joined: Tue Jan 14, 2020 6:08 am

Re: command_type changes when updating command via API

Post by IPOInS »

It's worth noting as well that even if commands are defined as unclassified, they don't appear in the check command or event handler list. Even though the documentation states they should appear everywhere.
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Re: command_type changes when updating command via API

Post by SteveBeauchemin »

I am not using API and I have been having commands change to "misc command" that have been a "check command" all along.
I am not able to make it happen. It just happen for no reason that I can spot.
Then I have to debug and change it back.
Nagios is Fun.
Steve B
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: command_type changes when updating command via API

Post by dchurch »

Yes, those are both good issues. The first one, the API PUT request causing the command to switch types was one I was able to reproduce.

I've told our team about it so hopefully it will get some attention before the next release.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Locked