Welcome to docs.opsview.com

Differences

This shows you the differences between two versions of the page.

opsview-core:upgrading:nagios4commandarguments [2013/05/22 12:47] (current)
pknight created
Line 1: Line 1:
 +====== Nagios 4 Command Arguments ======
 +
 +Nagios 4 includes improvements to the command arguments parsing to make it more "shell-like". This means that single quotes, double quotes and back slashes should work in a more logical way.
 +
 +One side effect is that Opsview's [[opsview-core:testservicecheck|Test Service Check]] feature now more closely matches with the expected results when Nagios executes plugins.
 +
 +However, this means that there may be arguments that used to work for Opsview 3.20120925 which do not work for later versions of Opsview. Possible results that you may get:
 +^ Output ^ Notes ^
 +|''(No output on stdout) stderr: /bin/sh: Syntax error: Unterminated quoted string'' | Unnecessary backslash escaping of quote symbols|
 +|''(No output on stdout) stderr: /bin/sh: Syntax error: ( unexpected'' | Check for use of parenthesis. Must be quoted correctly |
 +|''WMIQuery failed: ConnectServer failed!:failed to lookup error code: 2147749902( reson: 317)'' | Unnecessary backslashes when defining wmi query location |
 +|''CRITICAL: Hyper-V: not found (critical), Heartbeat: not found (critical), Service: not found (critical)'' | Incorrect quoting of services with spaces using the CheckServiceState check |
 +
 +This affects service checks that use a backslash (\) in the arguments. This is usually Windows agents checks.
 +
 +To help with the transition, there is a {{:opsview-core:upgrading:nagios_3-4_servicechecks.pl|tool}} available to take you through potential issues. Save the tool as ''/usr/local/nagios/installer/nagios_3-4_servicechecks.pl''. This will run through the Opsview database and find arguments for service checks, host/host template exceptions, timed host/host template exceptions that may be an issue.
 +
 +On the command line as the nagios user, execute:
 +<code>
 +/usr/local/nagios/installer/nagios_3-4_servicechecks.pl
 +</code>
 +
 +You will be prompted with a changes ("C") or list ("L") question as to whether you wish to make changes or just list would-be changes. Listing changes ("L") will go through all service checks and show you what would have happened. If you choose to make changes ("C"), the opsview database will firstly be backed up to ''/usr/local/nagios/var/backups/opsview-db-[timestamp]-nagios_3-4-servicechecks.gz'', and you will be prompted to confirm each change if necessary, which will then update the database. Changes will be logged to the audit log. You can use the [[opsview-core:testservicecheck|Test Service Check]] feature to try your changes before confirming the change, but you should use the results from Nagios as the definitive status.
 +
 +**Note**: Running the tool twice will give unpredictable results because the conversion is not idempotent. Take special care if running multiple times.
 +
 +**Note**: The tool may not always calculate the correct arguments to use. If you find that you have not been given the correct value, please let us know via your support account or the [[http://www.opsview.com/technology/forum|forums]]. We will need to know the old Opsview argument and, if possible the output, the argument that works for the new version of Opsview, and the new output.
 +
 +If you have exceptions (timed or normal on host or host templates), you may find that the host is listed in the first list of service checks. For instance:
 +<code>
 +Suspect ID: 349: Win Hyper-V
 +Host: ov-hv-win2k8-base OUTPUT=....
 +Host: bob STATE=unknown OUTPUT=....
 +Host: crummock STATE=critical OUTPUT=CHECK_NRPE: Socket timeout after 10 seconds.
 +Host: ov-dev STATE=ok OUTPUT=....
 +Change -H $HOSTADDRESS$ -c CheckWMI -a Query='Select * from Msvm_VirtualSystemManagementServiceSettingData' namespace='root\\virtualization'
 +to     -H $HOSTADDRESS$ -c CheckWMI -a Query='Select * from Msvm_VirtualSystemManagementServiceSettingData' namespace='root\virtualization'
 +y/n? y
 +Updated
 +</code>
 +
 +In the above, crummock is listed. But as crummock has a host exception, it will also be shown later on:
 +<code>
 +Suspect host timed override exception on host: crummock, for service check: Win Hyper-V - TESTING
 +Change -H $HOSTADDRESS$ -c CheckWMI -a Query='Select * from Msvm_VirtualSystemManagementServiceSettingData' namespace='root\\virtualization'
 +to     -H $HOSTADDRESS$ -c CheckWMI -a Query='Select * from Msvm_VirtualSystemManagementServiceSettingData' namespace='root\virtualization'
 +y/n? y
 +Updated
 +</code>
 +
 +As the tool is trying to locate arguments across Opsview, it may find possible problems in various locations for the same host. This is fine.
Navigation
Print/export
Toolbox