How to run Reports script in all devices and Configuring MailJet to send an Email

Introduction : We have the script to get report of all devices or selected .Here we have used Pubnub protocol to collect data from computers. Pubnub protocol establishes a secured, encrypted communication link between Master and Slave computers. Basically data are sent as real time messages with TLS and AES256 encryption. details are not stored anywhere, even in Pubnub Servers. For Sending report through mail by default we have used Mailjet API. We have used this concept in the following scripts:

  1. Virus Database Status
2) External IP Address 3) Software Inventory

  1. Hardware Inventory
How to run the script?

Please, Copy your script Procedure and follow the instructions in ITSM

Edit your parameters in script

  1. no=30
    ** Based on Endpoints the timeout is defined Eg.(for 100 devices timeout is 150 ) Maximum Timeout is 300

  2. Head_computer=r’LAVA-PC’ # Head computer Host name
    ** Head computer can be any of the devices from your Device

  3. KEY=r’CHANGE ME#Define your 9 digit strong alphanumeric key
    ** Your own 9 Digit Key. This key will helps you to have better and Secure communication with User or MSP’s

  4. emailto=‘’ # Email address to send the report
    ** Your Email address to send the Report

NOTE: Defining Head Computer and KEY is Mandatory

KEY is used here to differentiate the MSP’s while one or More user is running the script simultaneously. So we define 9 digit key here.

Please run this Script as System User Only

How does Script work ?

When you start running the script in all devices . Head computer will start creating a channel in pubnub protocol and it will subscribe to it . The head Computer i.e (Subscriber) will listen to the channel continuously with Timeout given. Apart from a head computer all devices start publishing the collected data to that particular channel. Head computer collects data from all devices and sends an report to given Email.

A channel represents a virtual path between publishing and subscribing clients in the PubNub Data Stream Network (DSN).

PUBNUB Protocol :

The first level of partitioning data between PubNub accounts is via the PubNub API keysets

Consider a publish key, subscribe key, and channel name the composite identifier for any message over the PubNub network. In other words, any channel is namespaced by the subscribe and publish keyset used to publish it.

For example, anyone publishing with a PubNub instance defined against keyset1 on channel1 can be received only by subscribers defined against keyset1 on channel1. To make it more clear, consider channel1’s real name in this case to be keyset1:channel1…
if someone published on a different keyset, but the same channel, since the channel is namespaced by the keyset, there would be no collision.

Configuring Mailjet:

In Mailjet emails and the data sent over the mails are not stored anywhere.User doesn’t want to configure Mailjet, already we have done for them on our own.We are explaining about it so that the user has more transprency of how the script and the concept used in the script works and to ensure them that their data is secure .Another adavntage is login credentials are not displayed explicitly and stored nowhere.

STEP [1]: Go to any browser and visit the page Sign up with any of your E-Mailid and Activate your account.

STEP [2]: After activating youraccount ,select “Start to integrate” under “I’m Developer” Tab

STEP [3]: In Credentials Tab Copy your API PUBLIC KEY and API SECRET KEY to use it in script

STEP [4] : Now copy your PUBLIC KEY and SECRET KEY in procedure.