-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete graphite data when resource gets deleted #154
Conversation
|
||
WHISPER_PATH = "/var/lib/carbon/whisper/tendrl/" | ||
|
||
class UpdateGraphite(flows.BaseFlow): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call this "DeleteResourceFromGraphite"
from tendrl.monitoring_integration.grafana import create_dashboards | ||
|
||
|
||
WHISPER_PATH = "/var/lib/carbon/whisper/tendrl/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this path the same for all versions of carbon/graphite? Can you read this path from the Graphite/Carbon conf file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will retrieve the path from https://github.com/Tendrl/monitoring-integration/blob/master/etc/tendrl/monitoring-integration/graphite/carbon.conf.sample#L34, after it gets copied to the desired location
@@ -29,6 +29,20 @@ namespace.monitoring: | |||
type: Create | |||
version: 1 | |||
uuid: 1951e821-7aa9-4a91-8183-e73bc8275bde | |||
UpdateGraphite: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DeleteResourceFromGraphite
@shtripat I have made the changes, Please review |
self.update_graphite(cluster_id, resource_name, | ||
resource_type.lower()) | ||
|
||
def get_path(self): | ||
carbon_path = "/etc/tendrl/monitoring-integration/carbon.conf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file a ini format? If so cant we load ini to dict and refer fields.
self.update_graphite(cluster_id, resource_name, | ||
resource_type.lower()) | ||
|
||
def get_path(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call this get_data_dir_path
may be
@shtripat I have made the necessary changes, Please review |
str(cluster_id), | ||
"archive", "volumes") | ||
if not os.path.exists(archive_path): | ||
os.system("mkdir -p " + str(archive_path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os module has "makedirs" function, you can directly use that.
example: os.makedirs("a/b/c")
return None | ||
|
||
|
||
def update_graphite(self, cluster_id, resource_name, resource_type): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we divide this function into submodules? The function is way too long, which makes it difficult to read, understand and review.
"deletion from graphite failed"}) | ||
archive_path = os.path.join(archive_path, | ||
"volumes", vol_name) | ||
os.system("mkdir -p " + str(archive_path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
str(cluster_id), | ||
"archive", "nodes") | ||
if not os.path.exists(archive_path): | ||
os.system("mkdir -p " + str(archive_path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
for vol_name in volume_affected_list: | ||
archive_path = os.path.join(archive_path, | ||
"volumes", vol_name) | ||
os.system("mkdir -p " + str(archive_path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
resource_folder_name = str(host_name) + "_" + \ | ||
str(datetime.datetime.now().isoformat()) | ||
archive_path = os.path.join(archive_path, resource_folder_name) | ||
os.system("mkdir -p " + str(archive_path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
3b2fca1
to
6b8230f
Compare
@cloudbehl I have made the changes, Please review |
subvolume) | ||
brick_list = create_dashboards.get_resource_keys("", subvolume_brick_key) | ||
if flag: | ||
flag = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is flag being set as True
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my bad didnt check down enough :) Ack
6b8230f
to
02ddebc
Compare
|
||
def run(self): | ||
super(UpdateGraphite, self).run() | ||
cluster_id = self.parameters.get("TendrlContext.integration_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not cluster_id, stop adding confusing code and use integration_id everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r0h4n Made the required changes, Will make changes in other files also in separate PR
Tendrl-bug-id: #148