Duplicate Monit IDs in MMonit

when you’re using MMonit software with multiple VMs cloned from a template with monit installed, there are sometimes 2 VM get the same monit IDs. You’ll notice that there are errors on your MMonit dashboard which disappears after a while.

To view the monit id of your VMs, type the following command on your terminal

# monit -i

What do you do if you have hundreds or thousands of VMs? How will you know which ones have duplicate IDs?

I implemented a solution using SQL Triggers.

CREATE TABLE `duplicate_monitids` (
`ipaddrin` varchar(255) NOT NULL DEFAULT ”,
`monitid` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ipaddrin`)
)

delimiter //
CREATE TRIGGER duplicate_monitids AFTER UPDATE
ON host
FOR EACH ROW
BEGIN
INSERT INTO duplicate_monitids(ipaddrin,monitid) VALUES(NEW.ipaddrin,NEW.monitid);
END//
delimiter ;

Then to view the VMs which have duplicate IDs, run the following SQL Query

select ipaddrin from duplicate_monitids where monitid IN (select monitid from duplicate_monitids group by monitid having count(*) > 1);

Playing with Microsoft’s Sharepoint REST API

I couldn’t get Sharepoint to be loaded as an External Storage in Nextcloud. I had find a way to use the old school `curl` to debug the problem.

To properly authenticate, you will have to add some extra parameters to curl

$ curl –ntlm –negotiate -u <Domain>/<Username>:<Password> “http://<url>/<site>/_api/Web/getfolderbyserverrelativeurl(‘%2F<site>/<Folder>’)?$select=Length,TimeLastModified” -v

Notice the `–ntlm –negotiate`. These parameters enable “NTLM Authentication Scheme for HTTP” rather that the usual HTTP Basic Auth. This in turns make lots of back and forth between the curl and MS Sharepoint.

The logs of my HAProxy looks like this. We can see that the curl request has made 3 HTTP requests.

web sharepoint/sharepoint 0/0/1/8/9 401 503 - - ---- 2/2/0/1/0 0/0 "GET /my/_api/Web/getfolderbyserverrelativeurl('%2Fmy/MeraDocs')?=Length,TimeLastModified HTTP/1.1"
web sharepoint/sharepoint 0/0/0/8/8 401 830 - - ---- 2/2/0/1/0 0/0 "GET /my/_api/Web/getfolderbyserverrelativeurl('%2Fmy/MeraDocs')?=Length,TimeLastModified HTTP/1.1"
web sharepoint/sharepoint 0/0/0/15/18 200 3314 - - ---- 2/2/0/1/0 0/0 "GET /my/_api/Web/getfolderbyserverrelativeurl('%2Fmy/MeraDocs')?=Length,TimeLastModified HTTP/1.1"

However I was getting a 404 response in the third response initially. Turns out the API endpoints are different for OneDrive, SharePoint Online and SharePoint Server 2016:

Since I was using SharePoint Server locally, I chose the 2nd endpoint and it worked perfect.

[1] http://www.commandlinefu.com/commands/view/7005/get-a-file-from-sharepoint-with-curl

[2] https://stackoverflow.com/questions/15697157/using-curl-with-ntlm-auth-to-make-a-post-is-failing

[3] https://docs.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/sharepoint-server-2016

Kanasuk sugar

Brown sugar and white sugar are sold at the same price at the supermarket. Do you know why? Because the brown sugar is just white sugar with some added molasses to make it slightly reddish.

I saw Kanasuk sugar which was priced way above the usual sugars. Decided to give it a try.

When you open the packet, you have the pungent smell of sugarcane. It is real unrefined sugar. It tastes like sugarcane too. I used it to make my coffee only.

https://www.facebook.com/1844656215863308/videos/1937104419951820/

 

 

We cannot see Gravity but Scientists believe in it. But why don’t some Scientists just believe in God?

As the legend says, an apple fell on Newton while he was under a tree, it made him wonder why did the apple fall down on him.

We now know that it is because of Gravity. But how can we prove that Gravity is real?

Let’s take a 1KG  of stone for example. When we measure the force it exerts on the ground, we find that it is 10N (assuming acceleration due gravity to 10m/s^2). If we take a 2KG stone, the force exerted would be 20N. We can thus make a formula to calculate the force exerted F by an object of mass m

F = ma

F = m x 10

Despite not seeing gravity or knowing the “why” of how objects with mass attract to each other, we have a way of verifying this unknown force. This unseen force always behaves as predicted.

Have we been able to prove that 1 prayer equals 1 life saved at a hospital. 4 prayers have saved 4 lives? I haven’t seen such analysis being published yet. Maybe someone should start finding the correlation. We might be able to have the most solid proof that God exists, scientifically!

Read also: The 3 Arrays of Life