Page 1 of 3
plugin output ommited
Posted: Mon Aug 13, 2018 4:08 am
by amprantino
I am running check_mssql_health and part of the output is ommited or missing.
For example:
./check_mssql_health --server SQLSERVER --username 'domain\usernagios' --password '123456789' --mode=database-data-free --name=datanexus --commit
OK - database DataNexus has 23.74% free space left | 'db_datanexus_free_pct'=23.74%;10:;5:;0;100 'db_datanexus_free'=253505.69MB;106772.6625:;53386.3313:;0;1067726.625 'db_datanexus_allocated_pct'=81.68%;;;0;100
What I see to the nagios web interface is the OK output only and everything else is missing.
Any ideas why part of the output is missing?
Re: plugin output ommited
Posted: Mon Aug 13, 2018 7:47 am
by scottwilkerson
you should verify nagios see's the same information your root user sees by running the command as nagios
Code: Select all
su nagios -c "/usr/local/nagios/libexec/check_mssql_health --server SQLSERVER --username 'domain\usernagios' --password '123456789' --mode=database-data-free --name=datanexus --commit"
Re: plugin output ommited
Posted: Mon Aug 13, 2018 9:09 am
by amprantino
Same output as nagios user
# su nagios
$ ./check_mssql_health --server SQLSERVER --username 'domain\usernagios' --password '123456789' --mode=database-data-free --name=datanexus --commit
OK - database DataNexus has 23.70% free space left | 'db_datanexus_free_pct'=23.70%;10:;5:;0;100 'db_datanexus_free'=253059.44MB;106772.6625:;53386.3313:;0;1067726.625 'db_datanexus_allocated_pct'=81.68%;;;0;100
Re: plugin output ommited
Posted: Mon Aug 13, 2018 2:52 pm
by scottwilkerson
Can you show the service configuration for the service in the screenshot as well as the configuration for the command the service uses?
Re: plugin output ommited
Posted: Tue Aug 14, 2018 4:33 am
by amprantino
Code: Select all
$USER9$=--username 'domain\usernagios' --password '123456789'
define command {
command_name check_mssql_health
command_line $USER1$/check_mssql_health --server $ARG1$ $USER9$ --mode $ARG2$ $ARG3$ --nooffline --commit
}
define service{
use generic-service
host_name SQLSERVER
service_description DB_datanexus_database-data-free
is_volatile 0
check_period 24x7
max_check_attempts 2
normal_check_interval 30
retry_check_interval 2
contact_groups db-admins
notification_interval 240
notification_period 24x7
notification_options c,w,r,u
check_command check_mssql_health!SQLSERVER!database-data-free!--name datanexus
}
Re: plugin output ommited
Posted: Tue Aug 14, 2018 7:52 am
by scottwilkerson
This all looks correct, the next thing I would suggest would be to turn on nagios debug log in the nagios.cfg and see if you can see what is being received when the command is run
Re: plugin output ommited
Posted: Thu Aug 16, 2018 4:40 am
by amprantino
[1534411627.179617] [2048.1] [pid=215878] **** BEGIN MACRO PROCESSING ***********
[1534411627.179629] [2048.1] [pid=215878] Processing: '$USER1$/check_mssql_health --server $ARG1$ $USER9$ --mode $ARG2$ $ARG3$ --nooffline --commit'
[1534411627.179660] [2048.1] [pid=215878] Done. Final output: '/usr/local/nagios/libexec/check_mssql_health --server SQLSERVER --username 'XXXXXXXX' --password 'XXXXXXXXX' --mode database-backup-age --nooffline --commit'
[1534411627.179674] [2048.1] [pid=215878] **** END MACRO PROCESSING *************
[1534411627.327299] [016.0] [pid=215878] ** Handling ACTIVE async check result for service 'database-backup-age' on host 'SQLSERVER' from 'Core Worker 215895'...
[1534411627.327313] [016.1] [pid=215878] * OPTIONS: 1, SCHEDULED: 1, RESCHEDULE: 1, EXITED OK: 1, RETURN CODE: 0, OUTPUT:
OK
[1534411627.327328] [001.0] [pid=215878] get_service_check_return_code()
[1534411627.327339] [016.1] [pid=215878] Service is OK
[1534411627.327350] [016.1] [pid=215878] Service was OK at last check.
[1534411627.327360] [016.1] [pid=215878] Service is still OK.
[1534411627.327372] [001.0] [pid=215878] check_for_service_flapping()
[1534411627.327383] [016.1] [pid=215878] Checking service 'database-backup-age' on host 'SQLSERVER' for flapping...
[1534411627.327394] [016.1] [pid=215878] Service is not flapping (0.00% state change).
[1534411627.327408] [001.0] [pid=215878] check_for_host_flapping()
[1534411627.327419] [016.1] [pid=215878] Checking host 'SQLSERVER' for flapping...
[1534411627.327430] [016.1] [pid=215878] Host is not flapping (0.00% state change).
[1534411627.327468] [016.1] [pid=215878] Rescheduling next check of service at Thu Aug 16 12:57:07 2018
This is strange.
The output is OK from command line but Nagios gets just an "OK" ??
Re: plugin output ommited
Posted: Thu Aug 16, 2018 8:28 am
by scottwilkerson
This is very strange.
the only thing I can this is that it is erroring somewhere when nagios runs it and we can't see the output.
Can you add the following to the end of the command and then restart nagios
This should send any error output into standard out and maybe it will display what the problem is.
Re: plugin output ommited
Posted: Fri Aug 17, 2018 5:07 am
by amprantino
define command {
command_name check_mssql_health_temp
command_line $USER1$/check_mssql_health --server $ARG1$ $USER9$ --mode $ARG2$ --name $ARG3$ --nooffline --commit 2>&1
}
No change

Re: plugin output ommited
Posted: Fri Aug 17, 2018 6:48 am
by danjoh
Try running the command from the command line and add "| hexdump -C" at the end to make sure there are no "special" characters that Nagios "chokes" on.
Code: Select all
su nagios
./check_mssql_health --server SQLSERVER --username 'domain\usernagios' --password '123456789' --mode=database-data-free --name=datanexus --commit 2>&1 | hexdump -C