Giter Club home page Giter Club logo

printer-monitoring's Introduction

Printer monitoring app

Python app built to monitor statistics from network printers and send emails to report them

  • It utilizes a three-level classification system consisting of WARNING, CRITICAL and ERROR categories
  • Implements parallel execution when connecting to devices
  • Implements parallel execution when sending emails
  • Supported printer brand at the moment: Brother

Software used

  • Python v3.11.1

Tested on


Considerations

  1. About the full URI

    You need to manually find out the full URI of the CSV resource for each printer in your network and then add it to the devices.json file as a new dictionary in the list, separating it in keys: values pairs

    • In this case, the full URI for the tested printers were: http://192.168.1.5:80/etc/mnt_info.csv and http://192.168.120.17:80/etc/mnt_info.csv

    Tips:

    1. Inspecting web

      You can use the "Inspect" option when right-clicking on the button available in the web browser printer GUI when trying to download a CSV file (More useful and quicker tip)

      Steps:

      a) Go to the Network tab and now left-click the button.

      b) Close the window that just opened

      c) Under the Name column, click in the csv file and go to the Headers tab

      d) You will find the full URI in the Request URL field

    or

    1. Using a sniffer tool

      You can use a sniffer tool like Wireshark to inspect packets and find the full URI (Traffic could be encrypted in this situation)

Starting

Step 1/3: Clone the repo, create/activate a virtual environment and install dependencies

a) Clone repository into your machine

git clone https://github.com/mvarrone/printer-monitoring.git && cd printer-monitoring

b) Create a virtual environment and install dependencies

On Windows 1.Creating a virtual environment
python -m venv venv

2.Activating it

a) Using CMD

.\venv\Scripts\activate.bat

b) Using PowerShell

.\venv\Scripts\Activate.ps1

3.Installing dependencies

pip install -r requirements.txt

4.(OPTIONAL) Deactivating the virtual environment

deactivate
On Linux/Mac 1. Creating a virtual environment
python3 -m venv venv

2.Activating it

source venv/bin/activate

3.Installing dependencies

pip install -r requirements.txt

4.(OPTIONAL) Deactivating the virtual environment

deactivate

Step 2/3: Some changes before running

  1. This project was tested using a Gmail account so you need to create an application password inside Google Account settings

    a) Go to Google Account

    b) Security tab

    c) How to access to Google > 2-step verification

    d) App passwords

  • Once there, create an entry like this:

    a) Select app: Other. Name it whatever you want, for example, Python script

    b) Click on the Generate button

    c) Copy the 16 characters in length code that was generated

    d) Paste it in the app_password value in the config.json

  1. Modify sender_email and receiver_email values in config.json

  2. Modify devices.json in order to add your network printer devices

    Example:

    [
        {
            "protocol": "http",
            "ip_address": "192.168.1.5",
            "port": 80,
            "path": "etc",
            "csv_filename": "mnt_info.csv",
            "brand": "brother"
        }
    ]

Step 3/3: Run the script

On Windows
cd app && python .\main.py 
On Linux/Mac
cd app && python3 .\main.py 

Example provided

A Python 3 script and a CSV file were provided. See example Also, a results.json was recently provided

  • The intention of providing an example is for you to know how the data was originally downloaded from the printer device and how is processed in the Python file

  • I found it might be useful for cases where:

    • there is no printer available in your network
    • the printer exports some other format file
    • the printer does not provide a way to export data and you want to test it anyway
    • the CSV file has not the same structure

Contributing

Contributions to this project are welcome. If you find any issues or have suggestions for improvement, feel free to open an issue or submit a pull request

License

This project is licensed under the MIT License. See the License: MIT file for details

printer-monitoring's People

Contributors

mvarrone avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.