Skip to main content

plugin integration and zoho authentication 2.0 tool

Project description

logo

Build Status Build Status Build Status

Description

This repository is dedicaded to ease plugin integrations for site24x7. It contains a set of plugins that can be used to monitor your infrastructure. and in order to install it you need to write below command into your terminal.

pip3 install site24x7 --force-reinstall
ls -l /usr/local/lib/python3/dist-packages/site24x7_plugin_helper

Usage

Below lines can be used to integrate your plugin.

import json
from site24x7 import Site24x7_plugin_helper
client = site24x7_plugin_helper.connector.request_client.RequestClient(
    author="TechStyleOS",
    plugin_version="1"
)
content = client.get('https://www.techstylefashiongroup.com/').content
client.__setitem__("content", content[0:20]) # site24x7 only accepts 20 characters
client.set_metric_types()
print(json.dumps(client.dict))

jenkins run command also example input

This bash command is for main.py file, it is dedicated to run the plugin on a jenkins cronjob. It is also an example of how to use.

if pip3 list | grep -F site24x7; then
    echo "site24x7 is installed"
else
    echo "site24x7 is not installed, installing it right now..."
    pip3 install site24x7
fi

SCRIPT_LOCATION=`python3 -c "import site24x7_plugin_helper;print(site24x7_plugin_helper.__file__.replace('__init__.py', 'main.py'))"`
query="select * from testtable"
this_plugin_name="my_testing_plugin"
python3 $SCRIPT_LOCATION \
    --plugin=$this_plugin_name \
    --query=$query \
    --database="mydb" \
    --server="myserver" \
    --username="myusername" \
    --password="mypassword" \
    # or you can give an environment for everything or some of them ABOVE
    # environment will be picked LAST
    --env="///src/site24x7_plugin_helper/.env"

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

TOOLS AND TECHNOLOGIES

Below is just neccesary tools and technologies to run this project.

how to fast and secure plugin placing on bash

PLUGIN_NAME="testplugin"
echo "installing $PLUGIN_NAME"
mkdir /opt/site24x7/monagent/plugins/$PLUGIN_NAME
mv .env /opt/site24x7/monagent/plugins/$PLUGIN_NAME/.env
mv $PLUGIN_NAME.py /opt/site24x7/monagent/plugins/$PLUGIN_NAME/$PLUGIN_NAME.py

how to install site24x7 agent on linux 64bit

DEVICE_KEY="XXX" # A long authentication key from site24x7.com
sudo wget https://staticdownloads.site24x7.com/server/Site24x7_Linux_64bit.install
sudo chmod 755 Site24x7_Linux_64bit.install
sudo ./Site24x7_Linux_64bit.install -i -key=$DEVICE_KEY

how to see how many plugin this server has on site24x7.com

await page.goto('https://site24x7.com/plugins/');
await page.evaulate(()=>{
    return document.querySelectorAll(".cursor.ng-scope").length;
}).then(result=>{
    console.log(result);
}).catch(error=>{
    console.log(error);
}).finally(()=>{
    browser.close();
}).then(()=>{
    console.log('done');
});

what is expected query(EXEC) input and expected output?

const rows = database.exec(query); 
console.log(rows);
// [(0, 'key', 'value'), (1, 'dev', 'renas'), ...rows]

const fs = require('fs');
console.log(fs.readFileSync('/tmp/testplugin.cache', 'utf8'))
// {
//     "plugin_version": "2",
//     "heartbeat_required": "true",
//     "CPU": 100,
//     "server": "localhost",
//     "database": "testdb",
//     "driverLocation": "/usr/local/lib/python3.6/dist-packages/pyodbc/drivers/pyodbc.so",
//     "query": "select * from testtable",
//     "thisPluginName": "testplugin",
//     "key": "value",
//     "dev": "renas"
// }

site24x7 agent ignored plugins

cat /opt/site24x7/monagent/temp/ignored_plugins.txt

site24x7 zoho api

from site24x7.utils.zoho import ZohoConnection

_client_id = "xxx"
_client_secret = "xxx"
code ="xxx"
zoho = ZohoConnection(_client_id, _client_secret, code=code)
print(zoho.headers)
zoho.get_current_status_all()
get = zoho.get('/api/current_status')
for i in zoho.get_up_monitors():
    print(i['name'], i['status'])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

site24x7-0.8.3.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

site24x7-0.8.3-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file site24x7-0.8.3.tar.gz.

File metadata

  • Download URL: site24x7-0.8.3.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for site24x7-0.8.3.tar.gz
Algorithm Hash digest
SHA256 9b20048076e44ed34023c782d722025b7b197cc6762880b4f474d3dbb6375e50
MD5 39afd10747336bd77bde3c6fe46d7638
BLAKE2b-256 30598a68167c02ba3b97a48ed06a066f1b3707249e41884e9e39053d54b536f5

See more details on using hashes here.

File details

Details for the file site24x7-0.8.3-py3-none-any.whl.

File metadata

  • Download URL: site24x7-0.8.3-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for site24x7-0.8.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a13391dc2f1081676c67d99e2289a24371ec8604642e0083cdd44407ac376760
MD5 e41583191ccbd4fabd3977167fbcb9e4
BLAKE2b-256 3c411dfb3ea2bfa4d33adea1f6316feedbfab079d6ae52cd7d7d5ed3d6b0d659

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page