3rd FIle

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
3
Indexable
Never
# -*- coding: utf-8 -*-
"""
Created on Fri May 26 20:52:46 2023

@author: Kirpal R
"""

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

columns = ["cpu", "time", "hostname"]
df = pd.read_csv(r'C:\Users\kirpa\Downloads\hari.csv', usecols=columns)

plt.figure(figsize=(12,10))
sns.scatterplot(data=df,x='time',y='cpu')

for i in range(df.shape[0]):
    plt.text(x= df.time[i],y=df.cpu[i],s=df.hostname[i], 
             fontdict=dict(color='red',size=10),
             bbox=dict(facecolor='yellow',alpha=0.5))
    
plt.title("Host with CPU > 80") #title
plt.xlabel("Timeframe")                 #x label
plt.ylabel("CPU")                       #y label

plt.savefig("myImagePDF.png", format="png")
plt.show()

#mail
msg = MIMEText(output_msg)
msg['Subject'] = "ELK CPU ALERT"
msg['From'] = 'hbr@juniper.net'
msg['To'] = 'hbr@juniper.net'
msg['Importance'] = 'High'
s = smtplib.SMTP('smtp.juniper.net')
s.sendmail('hbr@juniper.net', ['hbr@juniper.net'], msg.as_string())
s.quit()