Missing commands after plugin installation

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
giant69
Posts: 17
Joined: Thu Nov 19, 2015 8:33 am
Location: Zuerich, Switzerland
Contact:

Re: Missing commands after plugin installation

Post by giant69 »

I tried to install the oracle plugin twice without any effect - regarding the missing commands in nagiosxi.
I'm quite sure, I didn't delete any command definition so far. And since I installed the oracle instant client in order of the installation process of the plugin, I'm quite sure I did nothing invasive modification to the nagios installation. If I only understand, which installation process was providing these commands - the nagiosxi oder oracle plugin?

I will check the restore-script tomorrow. Since this is an evaluation system for monitoring solutions of our 250+ Oracle&Hana based SAP environment - we can easily start from the scratch.
Is the day not your friend, it will be your teacher.
giant69
Posts: 17
Joined: Thu Nov 19, 2015 8:33 am
Location: Zuerich, Switzerland
Contact:

Re: Missing commands after plugin installation

Post by giant69 »

I've learned, the command definition is stored inside the database and will be recreated during the import of the SQL-File nagiosql_defaults.sql. I also see, that these commands are quite equal except their command definition name. So, I could just easily redefine those commands - if I want to make use of these three oracle wizards, couldn't I?

Furthermore I've checked the database content also and found something curious:
Since I have some command definition written on my own, I see another problem arising - beside the three missing command definition: The column command_line of the table nagios_commands inside the mysql database nagios has a length of only varchar(255).
I see my own command definition incomplete and only in full length in the commands.cfg file?! How would a later backup and recovery reflect this topic?

This is from the database:
/usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib ORACLE_HOME=/usr/lib/oracle/12.1/client64 $USER1$/check_oracle_health --connect '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$ARG1$)(PORT=$ARG2$))(CONNECT_DATA=(SID=$ARG3$)))' --username monitor

And this is the corresponding line inside the commands.cfg:
define command {
command_name check_oracle_datafile-io-traffic
command_line /usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib ORACLE_HOME=/usr/lib/oracle/12.1/client64 $USER1$/check_oracle_health --connect '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$ARG1$)(PORT=$ARG2$))(CONNECT_DATA=(SID=$ARG3$)))' --username monitor --password 12345678 --mode datafile-io-traffic
}

Could you please enlighten me?
Is the day not your friend, it will be your teacher.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Missing commands after plugin installation

Post by rkennedy »

You can make your own commands, and reference your own scripts.

The size of this will set as the same size it was in your previous version. Thought I do see your concern, as it does inded truncate.

This command should work to expand the table -

Code: Select all

echo "use nagios;alter table nagios_commands modify command_line varchar(1024) not null;" | mysql -pnagiosxi
Former Nagios Employee
giant69
Posts: 17
Joined: Thu Nov 19, 2015 8:33 am
Location: Zuerich, Switzerland
Contact:

Re: Missing commands after plugin installation

Post by giant69 »

The extention on 1024byte is even for your own commands - for example the nagioscore notification handler (913 chars) - barely enough:

/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=service --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --service="$SERVICEDESC$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$" --datetime="$LONGDATETIME$"


The background of my question about the database and configfiles: I try to understand the mechanismen of nagiosxi for possible ways of automatic service configuration at nagiosxi.
Is the day not your friend, it will be your teacher.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Missing commands after plugin installation

Post by tmcdonald »

You can increase it higher if you want, really shouldn't cause any problems.

Regarding automation, I do need to point out that manually modifying the database can cause serious damage if done improperly, and is not something we can recommend or support.
Former Nagios employee
giant69
Posts: 17
Joined: Thu Nov 19, 2015 8:33 am
Location: Zuerich, Switzerland
Contact:

Re: Missing commands after plugin installation

Post by giant69 »

tmcdonald wrote:You can increase it higher if you want, really shouldn't cause any problems.
Yes, I guessed that already. I just wonder about the short default setting where even your own command definitions wont fit in. Are you really working with this database or tables or is this for "future use" or something? You couldn't rely on this really...
Regarding automation, I do need to point out that manually modifying the database can cause serious damage if done improperly, and is not something we can recommend or support.
Manually modifying the database is nothing we have in mind. As you can imagine, we don't wont to setup every database service by hand - even in our small environment of 80 hosts with 200 databases and roundabout 400 services in it.
Most of our database and host provisioning is nearly automated, and so the implementation of new services and hosts in Nagios should be.
Is the day not your friend, it will be your teacher.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Missing commands after plugin installation

Post by tgriep »

For your reference, here are how the commands and service templates are defined. You may have to edit the LIBRARY_PATH and ORACLE_HOME paths to match your environment.

Service Templates

Code: Select all

define service {
       name                                     xiwizard_oraclequery_service
       use                                      xiwizard_generic_service
       check_command                            check_xi_oraclequery
       register                                 0
       
}
       
define service {
       name                                     xiwizard_oracleserverspace_service
       use                                      xiwizard_generic_service
       check_command                            check_xi_oracleserverspace
       register                                 0
       
}
 
define service {
       name                                     xiwizard_oracletablespace_service
       use                                      xiwizard_generic_service
       check_command                            check_xi_oracletablespace
       register                                 0   
       
}
Commands definitions

Code: Select all

define command {
       command_name                             check_oracle_db
       command_line                             /usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib ORACLE_HOME=/usr/lib/oracle/12.1/client64 TNSADMIN=/usr/lib/oracle/12.1/client64/network/admin /usr/local/nagios/libexec/check_oracle_health --connect '$ARG1$' --username '$USER13$' --password '$USER14$' --mode $ARG2$ $ARG3$
}

define command {
       command_name                             check_xi_oraclequery
       command_line                             /bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib ORACLE_HOME=/usr/lib/oracle/11.2/client64 $USER1$/check_oracle_health $ARG1$
}
 
define command {
       command_name                             check_xi_oracleserverspace
       command_line                             /usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client $USER1$/check_oracle_health $ARG1$
}
 
define command {
       command_name                             check_xi_oracletablespace
       command_line                             /usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client $USER1$/check_oracle_health $ARG1$
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
giant69
Posts: 17
Joined: Thu Nov 19, 2015 8:33 am
Location: Zuerich, Switzerland
Contact:

Re: Missing commands after plugin installation

Post by giant69 »

tgriep wrote:For your reference, here are how the commands and service templates are defined....
Thank you very much!
Is the day not your friend, it will be your teacher.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Missing commands after plugin installation

Post by rkennedy »

Do you mind if I mark this as resolved, and close this thread out?
Former Nagios Employee
giant69
Posts: 17
Joined: Thu Nov 19, 2015 8:33 am
Location: Zuerich, Switzerland
Contact:

Re: Missing commands after plugin installation

Post by giant69 »

rkennedy wrote:Do you mind if I mark this as resolved, and close this thread out?
Not all my questions are answered, but yes - close it - most of them are off topic.
Is the day not your friend, it will be your teacher.
Locked