I am establishing alert notifications monitoring for my JBoss Fuse Karaf OSGI containers using Nagios Core 4.3.2. Jboss Fuse is 6.3 release comes with camel 2.17 bundled.
I need to report on the counts on camel routes. I've been able to get much on JBoss Fuse container monitored EXCEPT the camel routes. ???
It seems to not be aware of the MBeans for the camel routes?
do I need to do anything special to expose camel routes in Jboss Fuse container under JMX?
I've been able to get much monitored under Nagios for the container. list below. right now I'm only concerned with getting the services working. Later I'd like to migrate to using config files. thanks! Now ALL THESE WORK!!! I just can't seem to reach camel routes mbeans??? Just want to show that it is not the nagios setup, etc...
define command{
command_name check_local_container_heap_memory_usage
command_line $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ --path $ARG6$ --base $ARG7$ $ARG8$
}
define command{
command_name check_remote_container_heap_available
command_line $USER1$/check_jmx4perl $ARG1$
}
define command{
command_name check_local_container_broker_health
command_line $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6$ $ARG7$
}
define command{
command_name check_remote_container_broker_health
command_line $USER1$/check_jmx4perl $ARG1$ $ARG2$
}
define command{
command_name check_local_container_thread_count
command_line $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6
}
define command{
command_name check_remote_container_thread_count
command_line $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
}
define command{
command_name check_local_container_peak_thread_count
command_line $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6
}
define command{
command_name check_remote_container_peak_thread_count
command_line $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
}
define command{
command_name check_local_container_non_heap_used
command_line $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ --path $ARG6$ --base $ARG7$ $ARG8$ $ARG9$
}
define command{
command_name check_remote_container_non_heap_used
command_line $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
}
#container uptime
define command{
command_name check_remote_container_uptime
command_line $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
}
define command{
command_name check_local_container_uptime
command_line $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6
}
#Open File Descriptors
define command{
command_name check_remote_container_open_file_descriptors
command_line $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
}
define command{
command_name check_local_container_open_file_descriptors
command_line $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6
}
define command{
command_name check_remote_container_context_state
command_line $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
}
define command{
command_name check_local_container_context_state
command_line $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ --path $ARG6$ $ARG7$ $ARG8$
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container PassThru Heap
check_command check_nrpe!check_passthru_container_heap
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container IPRCMT1 Heap
check_command check_nrpe!check_iprcmt1_container_heap
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta MRO Heap
check_command check_nrpe!check_deltamro_container_heap
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta FADEC Heap
check_command check_nrpe!check_deltafadec_container_heap
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container PassThru Heap Available
check_command check_nrpe!check_remote_container_heap_avail!-a '--user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Memory --attribute HeapMemoryUsage --path used --base java.lang:type=Memory/HeapMemoryUsage/max --critical :95'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container IPRCMT1 Heap Available
check_command check_nrpe!check_remote_container_heap_avail!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Memory --attribute HeapMemoryUsage --path used --base java.lang:type=Memory/HeapMemoryUsage/max --critical :95'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta MRO Heap Available
check_command check_nrpe!check_remote_container_heap_avail!-a '--user deltamro --password F#c3B00k --url http://localhost:9092/jolokia --mbean java.lang:type=Memory --attribute HeapMemoryUsage --path used --base java.lang:type=Memory/HeapMemoryUsage/max --critical :95'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta FADEC Heap Available
check_command check_nrpe!check_deltafadec_container_heap!-a '--user deltafadec --password B#dM0nk3y --url http://localhost:9093/jolokia --mbean java.lang:type=Memory --attribute HeapMemoryUsage --path used --base java.lang:type=Memory/HeapMemoryUsage/max --critical :95'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta FADEC Broker Health
check_command check_nrpe!check_remote_container_broker_health!-a "--user deltafadec --password B#dM0nk3y --url http://localhost:9093/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta MRO Broker Health
check_command check_nrpe!check_remote_container_broker_health!-a "--user deltamro --password F#c3B00k --url http://localhost:9092/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container IPRCMT1 Broker Health
check_command check_nrpe!check_remote_container_broker_health!-a "--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container PassThru Broker Health
check_command check_nrpe!check_remote_container_broker_health!-a "--user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container PassThru Non-Heap-Memory
check_command check_nrpe!check_remote_container_non_heap_used!-a '--user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Memory --attribute NonHeapMemoryUsage --path used --base java.lang:type=Memory/NonHeapMemoryUsage/committed --critical :95'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container IPRCMT1 Non-Heap-Memory
check_command check_nrpe!check_remote_container_non_heap_used!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Memory --attribute NonHeapMemoryUsage --path used --base java.lang:type=Memory/NonHeapMemoryUsage/committed --critical :95'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta MRO Non-Heap-Memory
check_command check_nrpe!check_remote_container_non_heap_used!-a '--user deltamro --password F#c3B00k --url http://localhost:9091/jolokia --mbean java.lang:type=Memory --attribute NonHeapMemoryUsage --path used --base java.lang:type=Memory/NonHeapMemoryUsage/committed --critical :95'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta FADEC Non-Heap-Memory
check_command check_nrpe!check_remote_container_non_heap_used!-a '--user deltafadec --password B#dM0nk3y --url http://localhost:9091/jolokia --mbean java.lang:type=Memory --attribute NonHeapMemoryUsage --path used --base java.lang:type=Memory/NonHeapMemoryUsage/committed --critical :95'
}
# Thread Count
define service{
use generic-service
host_name alphprdfuse1i
service_description Container PassThru Thread Count
check_command check_nrpe!check_remote_container_thread_count!-a '--user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Threading --attribute ThreadCount --critical 90:200'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container IPRCMT1 Thread Count
check_command check_nrpe!check_remote_container_thread_count!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Threading --attribute ThreadCount --critical 90:200'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta MRO Thread Count
check_command check_nrpe!check_remote_container_thread_count!-a '--user deltamro --password F#c3B00k --url http://localhost:9091/jolokia --mbean java.lang:type=Threading --attribute ThreadCount --critical 90:200'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta FADEC Thread Count
check_command check_nrpe!check_remote_container_thread_count!-a '--user deltafadec --password B#dM0nk3y --url http://localhost:9091/jolokia --mbean java.lang:type=Threading --attribute ThreadCount --critical 90:200'
}
#Peak Thread Count
define service{
use generic-service
host_name alphprdfuse1i
service_description Container PassThru Peak Thread Count
check_command check_nrpe!check_remote_container_peak_thread_count!-a '--user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Threading --attribute PeakThreadCount --critical :250'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container IPRCMT1 Peak Thread Count
check_command check_nrpe!check_remote_container_peak_thread_count!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Threading --attribute PeakThreadCount --critical :250'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta MRO Peak Thread Count
check_command check_nrpe!check_remote_container_peak_thread_count!-a '--user deltamro --password F#c3B00k --url http://localhost:9092/jolokia --mbean java.lang:type=Threading --attribute PeakThreadCount --critical :250'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta FADEC Peak Thread Count
check_command check_nrpe!check_remote_container_peak_thread_count!-a '--user deltafadec --password B#dM0nk3y --url http://localhost:9093/jolokia --mbean java.lang:type=Threading --attribute PeakThreadCount --critical :250'
}
#Container Uptime
#./check_jmx4perl --user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Runtime --attribute Uptime
define service{
use generic-service
host_name alphprdfuse1i
service_description Container PassThru Uptime
check_command check_nrpe!check_remote_container_uptime!-a '--user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Runtime --attribute Uptime'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container IPRCMT1 Uptime
check_command check_nrpe!check_remote_container_uptime!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Runtime --attribute Uptime'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta MRO Uptime
check_command check_nrpe!check_remote_container_uptime!-a '--user deltamro --password F#c3B00k --url http://localhost:9092/jolokia --mbean java.lang:type=Runtime --attribute Uptime'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta FADEC Uptime
check_command check_nrpe!check_remote_container_uptime!-a '--user deltafadec --password B#dM0nk3y --url http://localhost:9093/jolokia --mbean java.lang:type=Runtime --attribute Uptime'
}
#Open File Descriptors
define service{
use generic-service
host_name alphprdfuse1i
service_description Container PassThru File Descriptors
check_command check_nrpe!check_remote_container_open_file_descriptors!-a '--user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=OperatingSystem --attribute OpenFileDescriptorCount --warning 500 --critical 600'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container IPRCMT1 File Descriptors
check_command check_nrpe!check_remote_container_open_file_descriptors!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=OperatingSystem --attribute OpenFileDescriptorCount --warning 500 --critical 600'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta MRO File Descriptors
check_command check_nrpe!check_remote_container_open_file_descriptors!-a '--user deltamro --password F#c3B00k --url http://localhost:9092/jolokia --mbean java.lang:type=OperatingSystem --attribute OpenFileDescriptorCount --warning 500 --critical 600'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta FADEC File Descriptors
check_command check_nrpe!check_remote_container_open_file_descriptors!-a '--user deltafadec --password B#dM0nk3y --url http://localhost:9093/jolokia --mbean java.lang:type=OperatingSystem --attribute OpenFileDescriptorCount --warning 500 --critical 600'
}
#Container Context State
define service{
use generic-service
host_name alphprdfuse1i
service_description Container PassThru Context State
check_command check_nrpe!check_remote_container_context_state!-a '--user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean org.apache.karaf:type=admin,name="PassThru MultiTenant" --attribute Instances --path "PassThru MultiTenant"/State --critical' 'Started'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container IPRCMT1 Context State
check_command check_nrpe!check_remote_container_context_state!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean org.apache.karaf:type=admin,name="Multi-Tenant I MEP Service" --attribute Instances --path "Multi-Tenant I MEP Service"/State --critical' 'Started'
}
#/check_jmx4perl --user passthru --password B#dC0mpany --url http://localhost:9092/jolokia --mbean org.apache.karaf:type=admin,name="Delta Maintenance Repair and Overhaul - MRO MEP" --attribute Instances --path 'Delta Maintenance Repair and Overhaul - MRO MEP'/State --critical '!Started'
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta MRO Context State
check_command check_nrpe!check_remote_container_context_state!-a '--user deltamro --password F#c3B00k --url http://localhost:9092/jolokia --mbean org.apache.karaf:type=admin,name="Delta Maintenance Repair and Overhaul - MRO MEP" --attribute Instances --path "Delta Maintenance Repair and Overhaul - MRO MEP"/State --critical' 'Started'
}
define service{
use generic-service
host_name alphprdfuse1i
service_description Container Delta FADEC Context State
check_command check_nrpe!check_remote_container_context_state!-a '--user deltafadec --password B#dM0nk3y --url http://localhost:9093/jolokia --mbean org.apache.karaf:type=admin,name="GE-IP Delta FADEC PROD ENV" --attribute Instances --path "GE-IP Delta FADEC PROD ENV"/State --critical' 'Started'
examples showing how it works and doesn't with the mbeans using jmx4perl for testing.
./jmx4perl http://localhost:9090/jolokia read java.lang:type=Runtime StartTime
1563297082466
./jmx4perl http://localhost:9090/jolokia read java.nio:name=direct,type=BufferPool Count
19
NOW attempting a camel route
./jmx4perl http://localhost:9090/jolokia read org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext" ExchangesTotal
ERROR: javax.management.InstanceNotFoundException : org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name=com.ge.digital.passthru.coreCamelContext
it just doesn't seem like jmx is exposing the camel routes? the above example should return a count.
I just stumpled on to something, more syntax related than anything. don't understand it, but, it is a break through, can build from this. placing single quote ' around the MBean seems to work.
./jmx4perl http://localhost:9090/jolokia read 'org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext"'
{
AllowUseOriginalMessage => '[false]',
ApplicationContextClassName => 'BundleDelegatingClassLoader(passthrumt1.core [309])',
CamelId => 'com.ge.digital.passthru.coreCamelContext',
CamelVersion => '2.17.0.redhat-630310',
ClassResolver => 'org.apache.camel.core.osgi.OsgiClassResolver',
DeltaProcessingTime => 0,
ExchangesCompleted => 5836,
ExchangesFailed => 0,
ExchangesInflight => 0,
ExchangesTotal => 5836,
ExternalRedeliveries => 0,
FailuresHandled => 0,
FirstExchangeCompletedExchangeId => 'ID-alphprdfuse2i-45162-1563297115702-3-3',
FirstExchangeCompletedTimestamp => '2019-07-16T13:12:00-04:00',
FirstExchangeFailureExchangeId => undef,
FirstExchangeFailureTimestamp => undef,
InflightExchanges => 0,
LastExchangeCompletedExchangeId => 'ID-alphprdfuse2i-45162-1563297115702-3-11672',
LastExchangeCompletedTimestamp => '2019-07-17T13:30:30-04:00',
LastExchangeFailureExchangeId => undef,
LastExchangeFailureTimestamp => undef,
LastProcessingTime => 0,
Load01 => '',
Load05 => '',
Load15 => '',
ManagementName => 'passthrumt1.core-com.ge.digital.passthru.coreCamelContext',
ManagementStatisticsLevel => 'Default',
MaxProcessingTime => 271,
MeanProcessingTime => 0,
MessageHistory => '[true]',
MinProcessingTime => 0,
PackageScanClassResolver => 'org.apache.camel.core.osgi.OsgiPackageScanClassResolver',
Properties => {
'http.proxyHost' => 'PITC-Zscaler-Americas-Cincinnati3PR.proxy.corporate.gtm.ge.com',
'http.proxyPort' => '80'
},
Redeliveries => 0,
ResetTimestamp => '2019-07-16T13:11:58-04:00',
ShutdownNowOnTimeout => '[true]',
StartTimestamp => '2019-07-16T13:11:58-04:00',
StartedRoutes => 6,
State => 'Started',
StatisticsEnabled => '[true]',
TimeUnit => 'SECONDS',
Timeout => 300,
TotalProcessingTime => 3744,
TotalRoutes => 8,
Tracing => '[true]',
Uptime => '1 day',
UptimeMillis => 87522386,
UseBreadcrumb => '[true]',
UseMDCLogging => '[false]'
}
./jmx4perl http://localhost:9090/jolokia read 'org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext"' ExchangesCompleted
5844
./check_jmx4perl --user passthru --password B#dC0mpany --url http://localhost:9090/jolokia --mbean 'org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext"' --attribute ExchangesCompleted
OK - [org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext",ExchangesCompleted] : Value 5852 in range | [org.apache.camel:context#passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type#context,name#"com.ge.digital.passthru.coreCamelContext",ExchangesCompleted]=5852;;
I am building a custom RPM for WildFly 10. I am stuck on deploying the systemd service. The spec file is able to deploy the code as well as create a user, however, no matter what avenue I try, I cannot get the RPM to create the service. I have tried install -m 644 but rpmbuild has tries finding the file, even if I specify full path:
e.g. install -m 644 %{buildroot}/opt/%{name}/docs/contrib/scripts/systemd/%{name}.service %{buildroot}/usr/lib/systemd/system/%{name}.service
I have also tried a series of systemd scriptlets as noted in https://fedoraproject.org/wiki/Packaging:Scriptlets, but that does nothing (the RPM will build with exit 0 status, but the service is never created). Any assistance would be appreciated.
$ cat SPECS/wildfly.spec
Name: wildfly
Version: 10.0.0.Final
Release: 1%{?dist}
Summary: WildFly (JBoss) Application Server
Group: System Environment/Daemons
License: LGPL 2.1
URL: http://wildfly.org
Source0: http://download.jboss.org/wildfly/%{version}/%{name}-%{version}.tar.gz
ExclusiveArch: x86_64 i686
ExclusiveOS: Linux
%{?systemd_requires}
Requires: systemd
Requires: shadow-utils
Requires: java >= 1.8.0
Requires: /etc/init.d/functions
Provides: %{name}
%description
WildFly Application Server packaged from the binary distribution.
%prep
%setup -q -n %{name}-%{version}
%install
mkdir -p %{buildroot}/opt/%{name}
mkdir -p %{buildroot}/var/log/%{name}
mkdir -p %{buildroot}/var/run/%{name}
cp -R . %{buildroot}/opt/%{name}
%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
useradd -r -g %{name} -d /opt/%{name} -s /sbin/nologin %{name}
%post
alternatives --install /etc/alternatives/%{name} %{name} /opt/%{name} 100
%systemd_post %{name}.service
%postun
alternatives --remove %{name} /opt/%{name}
%systemd_postun %{name}.service
userdel %{name}
%files
%defattr(-,root,root,0755)
%dir /opt/%{name}
/opt/%{name}/appclient
/opt/%{name}/bin
/opt/%{name}/docs
/opt/%{name}/domain
/opt/%{name}/jboss-modules.jar
/opt/%{name}/modules
%attr(-,%{name},%{name}) /opt/%{name}/standalone
/opt/%{name}/welcome-content
%dir /var/log/%{name}
%dir /var/run/%{name}
%doc /opt/%{name}/copyright.txt
%doc /opt/%{name}/LICENSE.txt
%doc /opt/%{name}/README.txt
I am using psloglist to get the eventlogs from remote computers. It works fine for one remote computer but doesn't work for multiple computers.
Works fine:
psloglist - \\Server1 -h 4 system -i 7036 -o "Service Control Manager" > c:\temp\logs.txt
Doesn't work:
psloglist - \\Server1,Server2 -h 4 system -i 7036 -o "Service Control Manager" > c:\temp\logs.txt
Please suggest.
(for %%a in ( Server1 Server2 ) do (
psloglist - \\%%a -h 4 system -i 7036 -o "Service Control Manager"
)) > c:\temp\logs.txt
Iterate over the list of servers
I am using Nagios XI. I issued following command from the Nagios Server:
nagiossrv root [libexec] > check_nrpe -H 128.19.5.131 -t 30 -c check_users -w 5 -c 10
It is giving me following error:
-bash: check_nrpe: command not found
I have also added the IP address of the Nagios server (nagiossrv) to the /usr/local/nagios/etc/nrpe.cfg file at the host's (128.19.5.131) side.
What is the issue?
After a little research, I got above error resolved. Just had to enter the command as follows:
nagiossrv root [libexec] > /usr/local/nagios/libexec/check_nrpe -H 128.19.5.131 -t 30 -c check_users -a '-w 5 -c 10'
And the output would look like:
USERS OK - 1 users currently logged in |users=1;5;10;0
I'm trying to set up a simple loop to periodically query a database table in bash. Normally I seem to have to do:
sqsh -s SERV -U user -P passwd -D db -L bcp_colsep=','
then within sqsh I have to type:
select * from some_table where foo=bar
\go -m bcp > /path/to/output.out
I was trying to use the -C option to sqsh to pass in the command like this:
sqsh -s SERV -U user -P passwd -D db -L bcp_colsep=',' -C 'select * from some_table where foo=bar \go -m bcp > /path/to/output.out'
but I keep getting:
Incorrect syntax near '\'.
How can I get the desired effect?
When you use the -C option to pass on a SQL statement to sqsh, the \go command will be implicitly executed. To get the output in 'bcp' result style you need to set the variable 'style=bcp' using the -L parameter or use -mbcp as a commandline parameter and just redirect the output to a file, or use the sqsh -o parameter to specify a filename for output. So basically your command would look like:
sqsh -S SERV -U user -P passwd -D db -L bcp_colsep=',' -m bcp \
-C 'select * from some_table where foo=bar' > /path/to/output.out
HTH, Martin