How can I get Grafana to read a custom metric? - json

Currently my Grafana Dashboard reads system info from the Grafana agent that runs on my machine.
I have a script that executes hourly to do some action. If the script executes successfully then it can output that success to an XML file or create a file called "success.txt". If the script fails then it could create a file "fail.txt".
How can I get Grafana to check for the presence of a file or a file's content to get it to report back to the dashboard the status, basically a binary result, of a custom metric "Hourly script job" such as success or fail?
I've searched the web and found any-json-to-metrics exporter but not sure that'll work. I'd like to avoid hosting a web server that exposes endpoints. I'd like for the Grafana agent to pick up the custom metrics.

Related

How to get logs of eventarc events

In the documentation, the firebase resize extension has the piece of code
exports.onimageresized = onCustomEventPublished(
"firebase.extensions.storage-resize-images.v1.complete",
(event) => {
logger.info("Received image resize completed event", event);
// For example, write resized image details into Firestore.
return getFirestore()
.collection("images")
.doc(event.subject.replace("/", "_")) // original file path
.set(event.data); // resized images paths and sizes
});
only when I check for that log in the function logs, there is nothing, only a create operation log(for when the function was deployed). Weird thing is the function still writes to firestore, I actually thought it was not firing.
Where are the eventarc logs read from, I cannot seem to find them
The following types of audit logs are available for Eventarc:
Admin Activity audit logs Includes "admin write" operations that
write metadata or configuration information. You can't disable Admin
Activity audit logs.
Data Access audit logs Includes "admin read" operations that read
metadata or configuration information. Also includes "data read" and
"data write" operations that read or write user-provided data.
To receive Data Access audit logs, you must explicitly enable them.
Eventarc audit logs use the service name eventarc.googleapis.com.
Eventarc audit logs use the resource type audited_resource for all audit logs.
You can view audit logs in Cloud Logging by using the Google Cloud console, the Google Cloud CLI, or the Logging API.
To view directly using the Cloud console follow the below steps:
In the Google Cloud console, go to the Logging> Logs Explorer page
Select an existing Cloud project, folder, or organization.
In the Query builder pane,In Resource type, select the Google Cloud
resource whose audit logs you want to see and in Log name, select
the audit log type that you want to see.
If you're experiencing issues when trying to view logs in the Logs Explorer, see the troubleshooting information.
Also check the documentation for functions calling eventrac and supported events.

Is there a way to push Grafana alerts into mongoDB using webhook

I have configured alerts in grafana, I want to push the data(in JSON format) using webhook to mongo DB.
The issue is when alerts are getting triggered, its not sending data to DB. (It may be due to different format of JSON, not sure).
We have configured the endpoint by taking the reference of https://webhook.site/
Here we triggered the test alert & whatever format of JSON it gave based on that we have created the API endpoint to connect to grafana which we have configured in Grafana-> Contact Points -> URL.
Test Notification works now.
But there are real metrics like CPU, memory etc. which reaches the threshold , it does not send the data to DB. Why so?
Is every metrics sends different JSON format ?
If so How to configure such thing?

Zammad integration to 3CX

I will like to integrate a Zammad installation to 3CX PBX.
I found how to do it on the 3CX documentation but, I didn't found a great suggestion.
Am open for more suggestion especially a great example.
This is what I tried and it worked for me. it's an implementation off zammad but more in the the 3CX softphone. We get the number from the incoming call or outgoing call from the 3CX softphone before it's received by the agent or customer.
I created a batch script to search the number picked from the 3CX softphone in Zammad, Making use of the search function in zammad since users and tickets will have this number recorded, the Agent will get a pop in the default web browser of the search results in Zammad.
To connect the batch script to 3CX navigate to 3CX settings > select Advanced Settings and then select > Behavior > Tick the Launch Application on incoming call and also select the path where the batch script is saved.
Below are the commands to be saved in the batch script that will be executed every time a call is made in 3CX and it will open up a default web browser
Kindy note that you can add-in more API calls in the batch script as you wish to complete your required workflow
::3CXURL_launcher ***takes number as param #echo OFF set
param=%1 set url1=https://zammad_domain_url/#search/ set
full=%url1%%param% #echo ON #start %full%

Ejabberd 17: How to create a hook which is called for offline messages?

I want to create a hook which is called whenever an offline message is created. Example: user-a(online) send a message to user-b(offline). Then as per ejabberd the message is stored and sent when user-b comes online. But in this situation, I want to call a local server POST URL with the data. How to create such a hook?
This hook is created so that I can from the local server send a push notification. Thus whenever a user comes online he/she will get the offline message as the push notification.
There is no step by step implementation for this. If anyone knows this it will be of great help.
There are two hooks called when a message is sent to a local account that is offline: ejabberd_sm calls offline_message_hook. And mod_offline calls store_offline_message. Search for that in the ejabberd source code, and you will find example code to use them.
Building on Badlop's answer, I have created a module that does exactly what you need to achieve from an offline_hook. Only with a difference that you'll have to connect a component to ejabberd instead of getting messages on REST API.

How do I update my web app's database when a change is made on QuickBooks Online?

I have a web app with a MySQL database we maintain in the cloud that we are trying to integrate with our QuickBooks Online account. We want to sync data between or web app's database and QuickBooks online, such as customer names and addresses. If they update their address in or web app, it's easy to then update it in QuickBooks online using the QuickBooks Online API. However, if they tell us their new address over the phone and we change it directly in QuickBooks online, we have no idea how to have that trigger something so that it automatically updates our MySQL web app. How do we go about doing this or learning about this process?
Intuit/QuickBooks has an API that's specifically geared towards this use-case. From the docs:
The change data capture (CDC) operation returns a list of entities that have changed since a specified time. This operation is for an app that periodically polls Data Services and then refreshes its local copy of entity data.
Docs are here:
https://developer.intuit.com/docs/0100_accounting/0300_developer_guides/change_data_capture
Basically you make an OAuth signed HTTP GET request like this:
https://quickbooks.api.intuit.com/v3/company/1234/cdc?entities=Class,Item,Invoice&changedSince=2012-07-20T22:25:51-07:00
And you get back a list of objects that have changed since the given date/time.
Your application can remember the last time you called this, and periodically call this API to get things that have changed since the last time you called it.
You get back something like this:
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2013-04-03T10:36:19.393Z">
<CDCResponse>
<QueryResponse>
<Customer>...
</Customer>
<Customer>...
</Customer>
</QueryResponse>
<QueryResponse>
<Invoice>...
</Invoice>
<Invoice>...
</Invoice>
</QueryResponse>
</CDCResponse>
</IntuitResponse>