Icinga 2 API - set service group in maintenance? - nagios

How does one fire off a web request to icinga2 to set a service group into maintenance? Documentation is tough to find.
We frequently encounter false positive alerts during deployment (due to app-spinup) and would like to be able to programattically disable checking on service groups until deployment is finished.

There is no unified api yet (that's something we plan for 2.4 later this year). You should use the external commands for that - given that You must first fetch all servicegroup members and send a command ffor each I'd suggest using Livestatus. Details at http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/alternative-frontends#setting-up-livestatus

Related

Send Dynamic data to Azure Logic app based on fixed schedule

I've a logic app, let's name it as 'LA1' having HTTP trigger. This logic app can accept multiple request types (see Request 1 and Request 2 below) and can call respective nested logic apps based on request fields -
Request 1 -
{
"Format":"F1",
"Time":"T1"
}
Request 2 -
{
"Format":"F2",
"Time":"T2"
}
Now I wanted the above requests to be sent to LA1 on specific time intervals. Say Request 1 to be sent to LA1 every 1 minute and Request 2 to be sent to LA1 every 2 minutes. This was accomplished successfully using Scheduler Job Collections in Azure portal where I'd create couple of schedulers to run every 1 or 2 minutes and configure Request 1 and Request 2 in them.
Now that as Microsoft has retired Scheduler Job Collections I would like to know different alternate options in hand to send dynamic data (scheduled at specific intervals) to LA1 Logic app.
I understand that creating multiple logic apps with recurrence trigger and passing different JSON is one option however I would like to avoid the same as I would end up creating too many logic apps and in case of any changes this would need a deployment of Logic apps on every environment.
I would like to have something that's configurable (one time configuration on every environment) something that was catered perfectly by Scheduler Job Collections. Any thoughts/ideas are much appreciated!
Thanks!
One choice is Azure Function, it has Timer Trigger binding, it uses CRON expressions to define your schedule. Further more information you could refer to this doc: Timer trigger for Azure Functions.
Also Azure provides Azure Automation and the Azure Automation supports schedule a runbook. You could use powershell to manage schedules. Further more details you could check this doc: Scheduling a runbook in Azure Automation.

Can I use StackDriver Trace PHP application in GKE?

I want to check latencies of RPC every day about CakePHP Application each endpoints running in GKE cluster. I found it is possible using php google client or zipkin server by reading documents , but I don't know how easy to introduce to our app though both seem tough for me.
In addition, I'm concerned about GKE cluster configuration has StackDriver Trace option though our cluster it sets disabled.Can we trace span if it sets enable?
Could you give some advices?
I succeeded to send gcp's trace api in php client via REST. It can see trace set by php client parameters , but my endpoint for trace api has stopped though I don't know why.Maybe ,it is not still supported well because the document have many ambiguous expression so, I realized watching server response by BigQuery with fluentd and DataStudio and it seem best solution because auto span can be set by table name with yyyymmdd and we can watch arbitrary metrics with custom query or calculation field.

Where to find the OSB Business service configuration details in the underlying database?

In OSB Layer when the endpoint uri is changed, I need to alert the core group that the endpoint has changed and to review it. I tried SLA Alert rules but it does not have options for it. My question is, the endpoint uri should be saved somewhere in the underlying database. If so what is the schema and the table name to query it.
URI or in fact any other part of OSB artifact is not stored in relational database but rather kept in memory in it's original XML structure. It can be only accessed thru dedicated session management API. Interfaces you will need to use are part o com.bea.wli.sb.management.configuration and com.bea.wli.sb.management.query packages. Unfortunately it is not as straightforward as it sounds, in short, to extract URI information you will need to:
Create session instance(SessionManagementMBean)
Obtain ALSBConfigurationMBean instance that operates on SessionManagementMBean
Create Query object instance(BusinessServiceQuery) an run it on ALSBConfigurationMBean to get ref object to osb artifact of your interest
Invoke getServiceDefinition on your ref object to get XML service
definition
Extract URI from XML service definition with XPath
Downside of this approach is that you are basically pooling configuration each time you want to check if anything has changed.
More information including JAVA/WLST examples can be found in Oracle Fusion Middleware Java API Reference for Oracle Service Bus
There is also a good blog post describing OSB customization with WLST ALSB/OSB customization using WLST
The information about services and all its properties can be obtained via Java API. The API documentation contains sample code, so you can get it up and running quite quickly, see the Querying resources paragraph when following the given link.
We use the API to read the service (both proxy and business) configuration and for simple management.
As long as you only read the properties you do not need to handle management sessions. Once you change the values, you need to start a session and activate it once you are done -- a very similar approach to Service bus console.

Nagios3 configuration for sending simple text message on some port

I am developing an application and decided Nagios3 for performing monitoring stuff. But I am stuck at two points. I am using check_http plug-in for monitoring load on my service api. Now I want to perform below tasks.
I need to set a threshold in check_http for performing some task after crossing that threshold. I tried below command
'check_command check_nrpe_1arg!check_service_api'
but it only tells me the load, not any threshold is set. while below one doesn't work.
'check_command check_service_api!100!200'
I need to send simple text message on some port(my application).
I am new to Nagios, so please help me figuring out the solution except email notification stuff.
There is a check command that you can download called "notify_sms" that integrates with an API server hosted by a company called Esendex. They charge for their service but it works well.

Using 1 intance of google-app-engine to monitor external service

I planning to create a NodeJS program, that work 24/7, that ping and make requests to an external server (outside of google cloud) every minute. Just to see that it the external services are are live.
If there is any error it will notify me by SMS & Email.
I don't need any front-end for this app, and no one needs to connect to it. Just simple NodeJS program.
The monitoring and configuration will be by texts files.
Now the questions:
It looks like it will cost me just $1.64. It sounds very cheap. Am I missing something?
It needs to work around the clock, I will request it to start it once, and it need to continue working, (by using setInterval). Is it will be aborted?
What it is exactly mean buy 1 instance. What an instance can do? Only respond to one request or what?
I tried to search in Google: appengine timeout, but didn't found anything that helps.
Free Quota
If you write your application in Python, PHP, Go or Java it can fit in free usage quota:
https://cloud.google.com/appengine/docs/quotas
So there will be absolutely no costs to run it on Google App Engine platform.
There are limit of 657,000 UrlFetch API Calls per day (more than 450 calls per minute in 24/7 mode) for free apps. 4GB traffic may also be sufficient for this kind of work.
Keep in mind there is no SMS sending services provided by Google App Engine and you will need to spend additional UrlFetch API calls to use external SMS services.
Email sending is also limited to 100 Emails per day (or 5000 Emails to admin address), so try not so send repeated notifications about same monitored server every minute, or you'll deplete your Email quote in 1.5 hours.
Scheduled Tasks
There is no way to run single process indefinitely without interruption on App Engine. But you don't have to!
You'll need to encapsulate all the work you're planning to execute in every iteration into single task and then schedule it to run every minute with Cron. See this documentation for Python: https://cloud.google.com/appengine/docs/python/config/cron
It is recommended to have some configuration page where you can set some internal configuration or see monitoring statistics, at least manage flag to temporarily pause tasks execution without redeploying your app.

Resources