Question

Edit locked commands

  • 14 April 2023
  • 4 replies
  • 118 views

Userlevel 1
Badge +5

Hello,

I have the four checks related to OS-Linux-SNMP which are bugged.
Indeed, these are configured as follows:

$CENTREONPLUGINS$/centreon_linux_snmp.pl --plugin=os::linux::snmp::plugin --mode=cpu --hostname=$HOSTADDRESS$ --snmp-version='

So, I wanted to modify them.
To do this, I go to /etc/centreon-engine/commands.cfg and I make the necessary changes to the commands having the problem.
However, when I reload my pollers, the commands return to their initial state, before modification.

How to make so that the modifications are integrated and remain so?

Thanks in advance


4 replies

Userlevel 2
Badge +11

Hi,

You’d better unlock the command (directly in database), then clone it, re-lock it, and then modify the cloned command. Then you can link the new command to the *-custom template.

To unlock the command :
 - get its ID, you can get it looking at the link URL when passing your mouse over the command in the UI
 - On the database : update command set command_locked = 0 where command_id = << the ID >>;
 - clone it via the UI
 - On the database : update command set command_locked = 1 where command_id = << the ID >>;

Userlevel 1
Badge +6

Hi, I prefer to not touch the database unless it’s really necessary, so when I want to modify a locked command, I prefer to simply copy the old one and paste&modify in a new one.

A question and a note:

Userlevel 2
Badge +11

Hi,

Don’t have a precise exemple in mind but “bugs” are mismatches between the options present in the command definitions and options expected by the plugin. Also, no macro dedicated for SNMPv3 are present so it requires (if not creating an ad-hoc command) to put all those options in the EXTRAOPTIONS macro and so, to protect all the macro content to protect only the passphrases.

In addition, it often makes the command not showing in the interface (in the service details part), with the message “

Unable

to

hide

passwords

in

command

(Reason:

Configuration

has

changed)



although the configuration has been deployed. (but this is another problem).

A third bug is that the displayed command is not exactly what is really executed (and what we have then copying the command using the copy button), like missing quotes and such.

Userlevel 1
Badge +5

Thank you for your answers,

So I duplicated the command and modified it, it's a functional alternative but it makes avoidable duplicates.
I voted for the idea quoted, thank you! :)

Reply